/// <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) { if (_taskDialog != null) { _taskDialog.Dispose(); _taskDialog = null; } } base.Dispose(disposing); }
/// <summary> /// Shows the form as a modal dialog box with the specified owner. /// </summary> /// <param name="owner">Any object that implements IWin32Window that represents the top-level window that will own the modal dialog box.</param> /// <returns>One of the DialogResult values.</returns> public DialogResult ShowDialog(IWin32Window owner) { // Remove any exising task dialog that is showing if (_taskDialog != null) _taskDialog.Dispose(); // Create visual form to show our defined task properties _taskDialog = new VisualTaskDialog(this); if (owner == null) _taskDialog.StartPosition = FormStartPosition.CenterScreen; else _taskDialog.StartPosition = FormStartPosition.CenterParent; // Return result of showing the task dialog return _taskDialog.ShowDialog(owner); }