Пример #1
0
 private void Exit()
 {
     if (iProcessedOptions)
     {
         iHideCursorOption.EventValueChanged            -= OnOptionChanged;
         iRotaryControlsOption.EventValueChanged        -= OnOptionChanged;
         iShowToolTipsOption.EventValueChanged          -= OnOptionChanged;
         iShowExtendedTrackInfoOption.EventValueChanged -= OnOptionChanged;
         iFontsOption.EventValueChanged -= OnOptionChanged;
     }
     if (iSystrayForm != null && !iSystrayForm.IsDisposed)
     {
         iSystrayForm.Invoke((Action) delegate()
         {
             iSystrayForm.Close();
             iSystrayForm.Dispose();
             iSystrayForm = null;
         });
     }
     StopStack();
     if (iNamedMutex != null)
     {
         iNamedMutex.Close();
         iNamedMutex = null;
     }
     if (iUpdateOnExit)
     {
         // allow updater to spawn its process before shutting down
         using (EventWaitHandle waitHandle = new EventWaitHandle(false, EventResetMode.AutoReset, kUpdateReadySignal))
         {
             using (EventWaitHandle waitHandle2 = new EventWaitHandle(false, EventResetMode.AutoReset, kUpdateStartedSignal))
             {
                 waitHandle.Set();
                 waitHandle2.WaitOne();
             }
         }
     }
     if (iSessionHookAdded)
     {
         try
         {
             // try to clean up session notifications, but don't worry if this fails as it should be cleaned up by OS anyway.
             WTSUnRegisterSessionNotification((new WindowInteropHelper(this)).Handle);
             HwndSource source = PresentationSource.FromVisual(this) as HwndSource;
             if (source != null)
             {
                 source.RemoveHook(HandleSessionEvents);
             }
         }
         catch { }
     }
     CefSharp.Cef.Shutdown();
 }