/// <summary> /// Release managed resources /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DoClosed(object sender, EventArgs e) { if (percentageCompleted > 0) { controller.Librarian.ProgressChanged -= new ProgressChangedEventHandler(DoProgressChanged); } this.Closed -= new EventHandler(DoClosed); this.Closing -= new CancelEventHandler(DoClosing); if (percentageCompleted == 100) { string location = PathHelper.CleanDirectoryPath(locationBox.Text.Trim()); if (!String.IsNullOrEmpty(location)) { Settings.Default.ExportPlaylistFormat = ((ComboBoxItem)playlistBox.SelectedItem).Tag as string; Settings.Default.ExportSubdirectories = (bool)treeCheck.IsChecked; Settings.Default.ExportLocation = location; Settings.Default.Save(); } } controller = null; trackPIDs = null; // clear the encoderBox UI control encoderBox.SelectedItem = null; foreach (ComboBoxItem item in encoderBox.Items) { item.Content = null; } encoderBox.Items.Clear(); // dispose the encoders collection encoders.Dispose(); encoders = null; }