private void Run()
 {
     try {
         Engine.Run();
     } catch (Exception e) {
         System.Windows.MessageBox.Show(e.ToString(), "Engine failure", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
         System.Diagnostics.Debug.WriteLine(string.Format("Engine failure: {0}", e));
     } finally {
         Engine = null;
         _Injector = null;
         GC.Collect();
         var h = Stopped;
         if (h != null)
             h(this, EventArgs.Empty);
     }
 }
 public EngineInstance(string title)
 {
     Engine = new FormEngine(title);
     Engine.Components.Add(_Injector = new ComponentInjector(Engine));
 }
 public ComponentInjector(FormEngine engine)
 {
     _Engine = engine;
 }