/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } if (TasksTimer != null) { TasksTimer.Dispose(); } base.Dispose(disposing); }
/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> public void Dispose(bool disposing) { if (disposing) { IsDisposing = true; if (TasksTimer != null) { TasksTimer.Dispose(); } // Clear list. var items = IssueList.ToArray(); IssueList.Clear(); // Remove events. foreach (var item in items) { item.Checking -= Item_Checking; item.Checked -= Item_Checked; item.Fixing -= Item_Fixing; item.Fixed -= Item_Fixed; } } }
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(); } }