示例#1
0
 void IPlugin.Dispose()
 {
     if (PipeManager != null)
     {
         //only stop the server if this is the last instance!
         if (!BlnHasDuplicate)
         {
             PipeManager.StopServer();
         }
     }
 }
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);

            Hide();

            bool isNewVersion = CheckForNewVersion(false, false);

            mmApp.Configuration.ApplicationUpdates.AccessCount++;

            SaveSettings();

            if (!CloseAllTabs())
            {
                Show();
                e.Cancel = true;
                return;
            }

            if (mmApp.Configuration.UseSingleWindow)
            {
                PipeManager?.StopServer();

                if (App.Mutex != null)
                {
                    App.Mutex.Dispose();
                }
            }

            if (!isNewVersion &&
                mmApp.Configuration.ApplicationUpdates.AccessCount % 5 == 0 &&
                !UnlockKey.IsRegistered())
            {
                Hide();
                var rd = new RegisterDialog();
                rd.Owner = this;
                rd.ShowDialog();
            }

            mmApp.SendTelemetry("shutdown");

            e.Cancel = false;
        }