Skip to content

Instantly share code, notes, and snippets.

@harriyott
Created March 30, 2018 11:23
Show Gist options
  • Save harriyott/44f3c334551d4384ff9d8e2e2ce18d33 to your computer and use it in GitHub Desktop.
Save harriyott/44f3c334551d4384ff9d8e2e2ce18d33 to your computer and use it in GitHub Desktop.
private readonly Timer _timer = new Timer(300) { AutoReset = false, Enabled = false };
// ...
_timer.Elapsed += (s, a) =>
{
Console.Beep(1500, 200);
_timer.Enabled = false;
};
// ...
private void OnDirectoryChange(object s, FileSystemEventArgs a)
{
if (_timer.Enabled) return;
_timer.Enabled = true;
_timer.Start();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment