title: EnableRaisingEvents (enabling and disabling it)
body: <p>I am maintaining some code which has two FileSystemWatcher events that makes it difficult to debug (and it has an error). So my idea is to simplify the code by making the execution sequential. Pretty much like this:</p>
  
  <pre><code>Main method
      1) normal code here
      2) enable event 1, let it check for files, disable it when it is done running once
      3) enable event 2, let it check for files, disable it when it is done running once
  </code></pre>
  
  <p>Then the database logs would make more sense. I would be able to see which part of the program that is doing something wrong.</p>
  
  <pre><code>private void InitializeFileSystemWatcher()
  {
      this.MessageMonitor = new FileSystemWatcher(this.MessagePath, this.MessageFilter);
      this.MessageMonitor.IncludeSubdirectories = true; // Recursive.
      this.MessageMonitor.Created += new FileSystemEventHandler(OnMessageReceived);
      this.MessageMonitor.EnableRaisingEvents = true;
  }
  </code></pre>
  
  <p>From the main, I can set the EnableRaisingEvents=true to EnableRaisingEvents=false. Both events indexes the files in some folder and enacts a callback method.</p>
  
  <p>My question is this: <strong>If the event is currently executing and I set EnableRaisingEvents=false, will it pause or continue to execute until it finishes?</strong></p>
  
  <p>If it does continue, I figure just to have a bool doRUN variable set at beginning and the end of the event as a check for the main method.</p>