/// <summary>Called when the form is closing.</summary> /// <param name="e">Cancelation arguments.</param> protected override void OnClosing(CancelEventArgs e) { // Undo event registrations if (_converter != null) { _converter.ProgressChanged -= new Toub.MediaCenter.Dvrms.Conversion.ProgressChangedEventHandler(converter_ProgressChanged); _converter.ConversionComplete -= new ConversionCompletedEventHandler(converter_ConversionComplete); _converter = null; } // Deter to base implementation base.OnClosing(e); }
/// <summary>Show the conversion dialog and start the conversion process.</summary> /// <param name="parent">Parent window for the dialog.</param> /// <param name="converter">The converter to use for conversion.</param> public void ShowDialog(IWin32Window parent, Converter converter) { if (converter == null) throw new ArgumentNullException("converter"); // Store the starting time for "time remaining" purposes _start = DateTime.Now; // Store, setup, and run asynchronously the converter _converter = converter; _converter.ProgressChanged += new Toub.MediaCenter.Dvrms.Conversion.ProgressChangedEventHandler(converter_ProgressChanged); _converter.ConversionComplete += new ConversionCompletedEventHandler(converter_ConversionComplete); _converter.ConvertAsync(); // Show the progress dialog ShowDialog(parent); }