private void UserControl_Unloaded(object sender, RoutedEventArgs e) { SettingsManager.UnLoadMonitor(DebugModeCheckBox); GameScanLocationsView?.DetachFromSourceCollection(); //GameScanLocationsListBox.ItemsSource = null; SettingsManager.UnLoadMonitor(GameScanLocationsListBox); SettingsManager.UnLoadMonitor(StartWithWindowsCheckBox); StartWithWindowsStateComboBox.ItemsSource = null; SettingsManager.UnLoadMonitor(StartWithWindowsStateComboBox); SettingsManager.UnLoadMonitor(AlwaysOnTopCheckBox); SettingsManager.UnLoadMonitor(AllowOnlyOneCopyCheckBox); SettingsManager.UnLoadMonitor(ShowFormInfoCheckBox); SettingsManager.UnLoadMonitor(ShowTestButtonCheckBox); SettingsManager.UnLoadMonitor(GuideButtonActionTextBox); SettingsManager.UnLoadMonitor(AutoDetectForegroundWindowCheckBox); SettingsManager.UnLoadMonitor(IsProcessDPIAwareCheckBox); SettingsManager.UnLoadMonitor(MinimizeToTrayCheckBox); // Direct Input SettingsManager.UnLoadMonitor(ExcludeVirtualDevicesCheckBox); SettingsManager.UnLoadMonitor(ExcludeSupplementalDevicesCheckBox); SettingsManager.UnLoadMonitor(UseDeviceBufferedDataCheckBox); SettingsManager.UnLoadMonitor(AcquireHiddenDevicesInExclusiveModeCheckBox); SettingsManager.UnLoadMonitor(AcquireMappedDevicesInExclusiveModeCheckBox); // Load other settings manually. SettingsManager.UnLoadMonitor(ShowProgramsTabCheckBox); SettingsManager.UnLoadMonitor(ShowSettingsTabCheckBox); SettingsManager.UnLoadMonitor(ShowDevicesTabCheckBox); SettingsManager.UnLoadMonitor(IncludeProductsCheckBox); LocationFolderBrowserDialog?.Dispose(); LocationFolderBrowserDialog = null; }
private void UserControl_Unloaded(object sender, RoutedEventArgs e) { IsDisposing = true; // Clear list. var items = IssueList?.ToArray(); IssueList?.Clear(); if (items != null) { // Remove events. foreach (var item in items) { item.Checking -= Item_Checking; item.Checked -= Item_Checked; item.Fixing -= Item_Fixing; item.Fixed -= Item_Fixed; } } WarningsView?.DetachFromSourceCollection(); //MainDataGrid.ItemsSource = null; if (Warnings != null) { Warnings.SynchronizingObject = null; Warnings.Clear(); Warnings = null; } if (TasksTimer != null) { TasksTimer.DoWork -= QueueTimer_DoWork; TasksTimer.Queue.ListChanged -= Data_ListChanged; TasksTimer.Dispose(); } if (QueueMonitorTimer != null) { QueueMonitorTimer.Tick -= QueueMonitorTimer_Tick; QueueMonitorTimer.Dispose(); } }