Пример #1
0
        private void MainWindow_FormClosing(object sender, FormClosingEventArgs e)
        {
            // No idea which of these are triggering on rare occasions, perhaps Deactivate, sizechanged or filterWindow.
            FormClosing -= MainWindow_FormClosing;
            SizeChanged -= OnMinimizeWindow;

            _stashFileMonitor?.Dispose();
            _stashFileMonitor = null;
            _stashManager     = null;

            _backupBackgroundTask?.Dispose();

            _timerReportUsage?.Stop();
            _timerReportUsage?.Dispose();
            _timerReportUsage = null;

            _tooltipHelper?.Dispose();

            _buddyBackgroundThread?.Dispose();
            _buddyBackgroundThread = null;

            panelHelp.Controls.Clear();

            _injector?.Dispose();
            _injector = null;

            _backupServiceWorker?.Dispose();
            _backupServiceWorker = null;

            _window?.Dispose();
            _window = null;

            IterAndCloseForms(Controls);
        }
Пример #2
0
        private void MainWindow_FormClosing(object sender, FormClosingEventArgs e)
        {
            // No idea which of these are triggering on rare occasions, perhaps Deactivate, sizechanged or filterWindow.
            FormClosing -= MainWindow_FormClosing;
            SizeChanged -= OnMinimizeWindow;

            _stashFileMonitor?.Dispose();
            _stashFileMonitor = null;

            _minimizeToTrayHandler?.Dispose();
            _minimizeToTrayHandler = null;

            _backupBackgroundTask?.Dispose();
            _usageStatisticsReporter.Dispose();
            _automaticUpdateChecker.Dispose();

            _tooltipHelper?.Dispose();

            _buddyItemsService?.Dispose();
            _buddyItemsService = null;

            _injector?.Dispose();
            _injector = null;

            _backupServiceWorker?.Dispose();
            _backupServiceWorker = null;

            _window?.Dispose();
            _window = null;

            IterAndCloseForms(Controls);
        }