title: Backgroundworker Call DLL Send Stop Event
body: <p>I have a Tool which separates the GUI from my Workingengine. They are different Projects. Perhaps I want to use it later for a console application.
  I call the Engine (it's a dll) from GUI in a BackgroundWorker:</p>
  
  <pre><code>    _worker = new BackgroundWorker();
      _worker.WorkerSupportsCancellation = true;
      _worker.DoWork += DoWork;
      _worker.RunWorkerAsync();
      ...
  
  
      private void DoWork(object sender, DoWorkEventArgs e)
      {
          Engine.Engine engine = new Engine.Engine(someParams);
          engine.Log += OnLog; //Here I receive Logging to display in GUI
          engine.Start(); //Runs the logic
      }
  </code></pre>
  
  <p>What i now want is, to implement a stop button. The Engine may run quite a bit and makes transactions in Database (which i want to rollback if stop is clicked).</p>
  
  <p>I could do it by passing the backgroundworker down to my dll and check then for CancellationPending. Is there a different way to do that? I want to reuse the code for other projects, therefor I don't want to pass the Backgroundworker...</p>
  
  <p>What would be nice:</p>
  
  <p>Engine has a stop event, that sets a global flag to "cancel" which I can check periodically in code.
  This Event I would like to fire from the GUI. </p>
  
  <p>I hope you can understand what I mean :-)</p>
  
  <p>Thanks in advance for your help!</p>