//-------------------------------------------------------------------------------- #region ShowTaskDialogBox //-------------------------------------------------------------------------------- static public DialogResult ShowTaskDialogBox(string Title, string MainInstruction, string Content, string ExpandedInfo, string Footer, string VerificationText, string RadioButtons, string CommandButtons, eTaskDialogButtons Buttons, eSysIcons MainIcon, eSysIcons FooterIcon) { if (VistaTaskDialog.IsAvailableOnThisOS && !ForceEmulationMode) { // [OPTION 1] Show Vista TaskDialog VistaTaskDialog vtd = new VistaTaskDialog(); vtd.WindowTitle = Title; vtd.MainInstruction = MainInstruction; vtd.Content = Content; vtd.ExpandedInformation = ExpandedInfo; vtd.Footer = Footer; // Radio Buttons if (RadioButtons != "") { List <VistaTaskDialogButton> lst = new List <VistaTaskDialogButton>(); string[] arr = RadioButtons.Split(new char[] { '|' }); for (int i = 0; i < arr.Length; i++) { try { VistaTaskDialogButton button = new VistaTaskDialogButton(); button.ButtonId = 1000 + i; button.ButtonText = arr[i]; lst.Add(button); } catch (FormatException) { } } vtd.RadioButtons = lst.ToArray(); } // Custom Buttons if (CommandButtons != "") { List <VistaTaskDialogButton> lst = new List <VistaTaskDialogButton>(); string[] arr = CommandButtons.Split(new char[] { '|' }); for (int i = 0; i < arr.Length; i++) { try { VistaTaskDialogButton button = new VistaTaskDialogButton(); button.ButtonId = 2000 + i; button.ButtonText = arr[i]; lst.Add(button); } catch (FormatException) { } } vtd.Buttons = lst.ToArray(); } switch (Buttons) { case eTaskDialogButtons.YesNo: vtd.CommonButtons = VistaTaskDialogCommonButtons.Yes | VistaTaskDialogCommonButtons.No; break; case eTaskDialogButtons.YesNoCancel: vtd.CommonButtons = VistaTaskDialogCommonButtons.Yes | VistaTaskDialogCommonButtons.No | VistaTaskDialogCommonButtons.Cancel; break; case eTaskDialogButtons.OKCancel: vtd.CommonButtons = VistaTaskDialogCommonButtons.Ok | VistaTaskDialogCommonButtons.Cancel; break; case eTaskDialogButtons.OK: vtd.CommonButtons = VistaTaskDialogCommonButtons.Ok; break; case eTaskDialogButtons.Close: vtd.CommonButtons = VistaTaskDialogCommonButtons.Close; break; case eTaskDialogButtons.Cancel: vtd.CommonButtons = VistaTaskDialogCommonButtons.Cancel; break; default: vtd.CommonButtons = 0; break; } switch (MainIcon) { case eSysIcons.Information: vtd.MainIcon = VistaTaskDialogIcon.Information; break; case eSysIcons.Question: vtd.MainIcon = VistaTaskDialogIcon.Information; break; case eSysIcons.Warning: vtd.MainIcon = VistaTaskDialogIcon.Warning; break; case eSysIcons.Error: vtd.MainIcon = VistaTaskDialogIcon.Error; break; } switch (FooterIcon) { case eSysIcons.Information: vtd.FooterIcon = VistaTaskDialogIcon.Information; break; case eSysIcons.Question: vtd.FooterIcon = VistaTaskDialogIcon.Information; break; case eSysIcons.Warning: vtd.FooterIcon = VistaTaskDialogIcon.Warning; break; case eSysIcons.Error: vtd.FooterIcon = VistaTaskDialogIcon.Error; break; } vtd.EnableHyperlinks = false; vtd.ShowProgressBar = false; vtd.AllowDialogCancellation = (Buttons == eTaskDialogButtons.Cancel || Buttons == eTaskDialogButtons.Close || Buttons == eTaskDialogButtons.OKCancel || Buttons == eTaskDialogButtons.YesNoCancel); vtd.CallbackTimer = false; vtd.ExpandedByDefault = false; vtd.ExpandFooterArea = false; vtd.PositionRelativeToWindow = true; vtd.RightToLeftLayout = false; vtd.NoDefaultRadioButton = false; vtd.CanBeMinimized = Parent == null;// add a public property vtd.ShowMarqueeProgressBar = false; vtd.UseCommandLinks = (CommandButtons != ""); vtd.UseCommandLinksNoIcon = false; vtd.VerificationText = VerificationText; vtd.VerificationFlagChecked = false; vtd.ExpandedControlText = "Hide details"; vtd.CollapsedControlText = "Show details"; vtd.Callback = null; // Show the Dialog DialogResult result = (DialogResult)vtd.Show((vtd.CanBeMinimized ? null : Form.ActiveForm), out VerificationChecked, out RadioButtonResult); // if a command button was clicked, then change return result // to "DialogResult.OK" and set the CommandButtonResult if ((int)result >= 2000) { CommandButtonResult = ((int)result - 2000); result = DialogResult.OK; } if (RadioButtonResult >= 1000) { RadioButtonResult -= 1000; // deduct the ButtonID start value for radio buttons } return(result); } else { // [OPTION 2] Show Emulated Form frmTaskDialog td = new frmTaskDialog(); td.Title = Title; td.MainInstruction = MainInstruction; td.Content = Content; td.ExpandedInfo = ExpandedInfo; td.Footer = Footer; td.RadioButtons = RadioButtons; td.CommandButtons = CommandButtons; td.Buttons = Buttons; td.MainIcon = MainIcon; td.FooterIcon = FooterIcon; td.VerificationText = VerificationText; td.Width = EmulatedFormWidth; td.BuildForm(); DialogResult result = td.ShowDialog(Parent ?? Form.ActiveForm ?? (Application.OpenForms.Count == 0 ? null : Application.OpenForms[0])); RadioButtonResult = td.RadioButtonIndex; CommandButtonResult = td.CommandButtonClickedIndex; VerificationChecked = td.VerificationCheckBoxChecked; return(result); } }
//-------------------------------------------------------------------------------- #region ShowTaskDialogBox //-------------------------------------------------------------------------------- public DialogResult ShowTaskDialogBox(IWin32Window Owner, string Title, string MainInstruction, string Content, string ExpandedInfo, string Footer, string VerificationText, string RadioButtons, string CommandButtons, TaskDialogButtons Buttons, SysIcons MainIcon, SysIcons FooterIcon, int DefaultIndex) { DialogResult result; if (OnTaskDialogShown != null) { OnTaskDialogShown(null, EventArgs.Empty); } if (VistaTaskDialog.IsAvailableOnThisOS) { // [OPTION 1] Show Vista TaskDialog VistaTaskDialog vtd = new VistaTaskDialog(); vtd.WindowTitle = Title; vtd.MainInstruction = MainInstruction; vtd.Content = Content; vtd.ExpandedInformation = ExpandedInfo; vtd.Footer = Footer; // Radio Buttons if (RadioButtons != "") { List <VistaTaskDialogButton> lst = new List <VistaTaskDialogButton>(); string[] arr = RadioButtons.Split(new char[] { '|' }); for (int i = 0; i < arr.Length; i++) { try { VistaTaskDialogButton button = new VistaTaskDialogButton(); button.ButtonId = 1000 + i; button.ButtonText = arr[i]; lst.Add(button); } catch (FormatException) { } } vtd.RadioButtons = lst.ToArray(); vtd.NoDefaultRadioButton = (DefaultIndex == -1); if (DefaultIndex >= 0) { vtd.DefaultRadioButton = DefaultIndex; } } // Custom Buttons if (CommandButtons != "") { List <VistaTaskDialogButton> lst = new List <VistaTaskDialogButton>(); string[] arr = CommandButtons.Split(new char[] { '|' }); for (int i = 0; i < arr.Length; i++) { try { VistaTaskDialogButton button = new VistaTaskDialogButton(); button.ButtonId = 2000 + i; button.ButtonText = arr[i]; lst.Add(button); } catch (FormatException) { } } vtd.Buttons = lst.ToArray(); if (DefaultIndex >= 0) { vtd.DefaultButton = DefaultIndex; } } switch (Buttons) { case TaskDialogButtons.YesNo: vtd.CommonButtons = VistaTaskDialogCommonButtons.Yes | VistaTaskDialogCommonButtons.No; break; case TaskDialogButtons.YesNoCancel: vtd.CommonButtons = VistaTaskDialogCommonButtons.Yes | VistaTaskDialogCommonButtons.No | VistaTaskDialogCommonButtons.Cancel; break; case TaskDialogButtons.OKCancel: vtd.CommonButtons = VistaTaskDialogCommonButtons.Ok | VistaTaskDialogCommonButtons.Cancel; break; case TaskDialogButtons.OK: vtd.CommonButtons = VistaTaskDialogCommonButtons.Ok; break; case TaskDialogButtons.Close: vtd.CommonButtons = VistaTaskDialogCommonButtons.Close; break; case TaskDialogButtons.Cancel: vtd.CommonButtons = VistaTaskDialogCommonButtons.Cancel; break; default: vtd.CommonButtons = 0; break; } switch (MainIcon) { case SysIcons.Information: vtd.MainIcon = VistaTaskDialogIcon.Information; break; case SysIcons.Question: vtd.MainIcon = VistaTaskDialogIcon.Question; break; case SysIcons.Warning: vtd.MainIcon = VistaTaskDialogIcon.Warning; break; case SysIcons.Error: vtd.MainIcon = VistaTaskDialogIcon.Error; break; } switch (FooterIcon) { case SysIcons.Information: vtd.FooterIcon = VistaTaskDialogIcon.Information; break; case SysIcons.Question: vtd.FooterIcon = VistaTaskDialogIcon.Question; break; case SysIcons.Warning: vtd.FooterIcon = VistaTaskDialogIcon.Warning; break; case SysIcons.Error: vtd.FooterIcon = VistaTaskDialogIcon.Error; break; } vtd.EnableHyperlinks = true; vtd.ShowProgressBar = false; vtd.AllowDialogCancellation = (Buttons == TaskDialogButtons.Cancel || Buttons == TaskDialogButtons.Close || Buttons == TaskDialogButtons.OKCancel || Buttons == TaskDialogButtons.YesNoCancel); vtd.CallbackTimer = false; vtd.ExpandedByDefault = false; vtd.ExpandFooterArea = false; vtd.PositionRelativeToWindow = true; vtd.RightToLeftLayout = false; vtd.NoDefaultRadioButton = false; vtd.CanBeMinimized = false; vtd.ShowMarqueeProgressBar = false; vtd.UseCommandLinks = (CommandButtons != ""); vtd.UseCommandLinksNoIcon = false; vtd.VerificationText = VerificationText; vtd.VerificationFlagChecked = false; vtd.ExpandedControlText = Locale.localizedString("More Options", "Bookmark"); vtd.CollapsedControlText = Locale.localizedString("More Options", "Bookmark"); vtd.Callback = delegate(VistaActiveTaskDialog taskDialog, VistaTaskDialogNotificationArgs args, object callbackData) { if (!String.IsNullOrEmpty(args.Hyperlink)) { HelpDelegate(args.Hyperlink); } return(false); }; // Show the Dialog result = (DialogResult) vtd.Show((vtd.CanBeMinimized ? null : Owner), out _verificationChecked, out _radioButtonResult); // if a command button was clicked, then change return result // to "DialogResult.OK" and set the CommandButtonResult if ((int)result >= 2000) { CommandButtonResult = ((int)result - 2000); result = DialogResult.OK; } if (RadioButtonResult >= 1000) { RadioButtonResult -= 1000; // deduct the ButtonID start value for radio buttons } } else { // [OPTION 2] Show Emulated Form using (TaskDialogForm td = new TaskDialogForm()) { td.Title = Title; td.MainInstruction = MainInstruction; td.Content = Content; td.ExpandedInfo = ExpandedInfo; td.Footer = Footer; td.RadioButtons = RadioButtons; td.CommandButtons = CommandButtons; td.PlaySystemSounds = PlaySystemSounds; td.Buttons = Buttons; td.MainIcon = MainIcon; td.FooterIcon = FooterIcon; td.VerificationText = VerificationText; td.Width = EmulatedFormWidth; td.DefaultButtonIndex = DefaultIndex; td.BuildForm(); result = td.ShowDialog(Owner); RadioButtonResult = td.RadioButtonIndex; CommandButtonResult = td.CommandButtonClickedIndex; VerificationChecked = td.VerificationCheckBoxChecked; } } if (OnTaskDialogClosed != null) { OnTaskDialogClosed(null, EventArgs.Empty); } return(result); }
private static TaskDialogResult ShowTaskDialog(TaskDialogOptions options) { VistaTaskDialog vtd = new VistaTaskDialog(); vtd.WindowTitle = options.Title; vtd.MainInstruction = options.MainInstruction; vtd.Content = options.Content; vtd.ExpandedInformation = options.ExpandedInfo; vtd.Footer = options.FooterText; if (options.CommandButtons != null && options.CommandButtons.Length > 0) { List <VistaTaskDialogButton> lst = new List <VistaTaskDialogButton>(); for (int i = 0; i < options.CommandButtons.Length; i++) { try { VistaTaskDialogButton button = new VistaTaskDialogButton(); button.ButtonId = GetButtonIdForCommandButton(i); button.ButtonText = options.CommandButtons[i]; lst.Add(button); } catch (FormatException) { } } vtd.Buttons = lst.ToArray(); if (options.DefaultButtonIndex.HasValue && options.DefaultButtonIndex >= 0 && options.DefaultButtonIndex.Value < vtd.Buttons.Length) { vtd.DefaultButton = vtd.Buttons[options.DefaultButtonIndex.Value].ButtonId; } } else if (options.RadioButtons != null && options.RadioButtons.Length > 0) { List <VistaTaskDialogButton> lst = new List <VistaTaskDialogButton>(); for (int i = 0; i < options.RadioButtons.Length; i++) { try { VistaTaskDialogButton button = new VistaTaskDialogButton(); button.ButtonId = GetButtonIdForRadioButton(i); button.ButtonText = options.RadioButtons[i]; lst.Add(button); } catch (FormatException) { } } vtd.RadioButtons = lst.ToArray(); vtd.NoDefaultRadioButton = (!options.DefaultButtonIndex.HasValue || options.DefaultButtonIndex.Value == -1); if (options.DefaultButtonIndex.HasValue && options.DefaultButtonIndex >= 0 && options.DefaultButtonIndex.Value < vtd.RadioButtons.Length) { vtd.DefaultButton = vtd.RadioButtons[options.DefaultButtonIndex.Value].ButtonId; } } bool hasCustomCancel = false; if (options.CustomButtons != null && options.CustomButtons.Length > 0) { List <VistaTaskDialogButton> lst = new List <VistaTaskDialogButton>(); for (int i = 0; i < options.CustomButtons.Length; i++) { try { VistaTaskDialogButton button = new VistaTaskDialogButton(); button.ButtonId = GetButtonIdForCustomButton(i); button.ButtonText = options.CustomButtons[i]; if (!hasCustomCancel) { hasCustomCancel = (button.ButtonText == "Close" || button.ButtonText == "Cancel"); } lst.Add(button); } catch (FormatException) { } } vtd.Buttons = lst.ToArray(); if (options.DefaultButtonIndex.HasValue && options.DefaultButtonIndex.Value >= 0 && options.DefaultButtonIndex.Value < vtd.Buttons.Length) { vtd.DefaultButton = vtd.Buttons[options.DefaultButtonIndex.Value].ButtonId; } vtd.CommonButtons = VistaTaskDialogCommonButtons.None; } else { vtd.CommonButtons = ConvertCommonButtons(options.CommonButtons); if (options.DefaultButtonIndex.HasValue && options.DefaultButtonIndex >= 0) { vtd.DefaultButton = GetButtonIdForCommonButton(options.CommonButtons, options.DefaultButtonIndex.Value); } } vtd.MainIcon = options.MainIcon; vtd.CustomMainIcon = options.CustomMainIcon; vtd.FooterIcon = options.FooterIcon; vtd.CustomFooterIcon = options.CustomFooterIcon; vtd.EnableHyperlinks = DetectHyperlinks(options.Content, options.ExpandedInfo, options.FooterText); vtd.AllowDialogCancellation = (options.AllowDialogCancellation || hasCustomCancel || options.CommonButtons == TaskDialogCommonButtons.Close || options.CommonButtons == TaskDialogCommonButtons.OKCancel || options.CommonButtons == TaskDialogCommonButtons.YesNoCancel); vtd.CallbackTimer = options.EnableCallbackTimer; vtd.ExpandedByDefault = options.ExpandedByDefault; vtd.ExpandFooterArea = options.ExpandToFooter; vtd.PositionRelativeToWindow = true; vtd.RightToLeftLayout = false; vtd.NoDefaultRadioButton = false; vtd.CanBeMinimized = false; vtd.ShowProgressBar = options.ShowProgressBar; vtd.ShowMarqueeProgressBar = options.ShowMarqueeProgressBar; vtd.UseCommandLinks = (options.CommandButtons != null && options.CommandButtons.Length > 0); vtd.UseCommandLinksNoIcon = false; vtd.VerificationText = options.VerificationText; vtd.VerificationFlagChecked = options.VerificationByDefault; vtd.ExpandedControlText = "Hide details"; vtd.CollapsedControlText = "Show details"; vtd.Callback = options.Callback; vtd.CallbackData = options.CallbackData; vtd.Config = options; TaskDialogResult result = null; int diagResult = 0; TaskDialogSimpleResult simpResult = TaskDialogSimpleResult.None; bool verificationChecked = false; int radioButtonResult = -1; int? commandButtonResult = null; int? customButtonResult = null; //diagResult = vtd.Show((vtd.CanBeMinimized ? null : options.Owner), out verificationChecked, out radioButtonResult); IntPtr ownerHandle = options.OwnerHandle; if (options.Owner != null) { WindowInteropHelper helper = new WindowInteropHelper(options.Owner); ownerHandle = helper.Owner; } diagResult = vtd.Show((vtd.CanBeMinimized ? IntPtr.Zero : ownerHandle), out verificationChecked, out radioButtonResult); if (diagResult >= CommandButtonIDOffset) { simpResult = TaskDialogSimpleResult.Command; commandButtonResult = diagResult - CommandButtonIDOffset; } else if (radioButtonResult >= RadioButtonIDOffset) { simpResult = (TaskDialogSimpleResult)diagResult; radioButtonResult -= RadioButtonIDOffset; } else if (diagResult >= CustomButtonIDOffset) { simpResult = TaskDialogSimpleResult.Custom; customButtonResult = diagResult - CustomButtonIDOffset; } else { simpResult = (TaskDialogSimpleResult)diagResult; } result = new TaskDialogResult( simpResult, (String.IsNullOrEmpty(options.VerificationText) ? null : (bool?)verificationChecked), ((options.RadioButtons == null || options.RadioButtons.Length == 0) ? null : (int?)radioButtonResult), ((options.CommandButtons == null || options.CommandButtons.Length == 0) ? null : commandButtonResult), ((options.CustomButtons == null || options.CustomButtons.Length == 0) ? null : customButtonResult)); return(result); }
static private int maxHeightExpandedInfo = 700; //ToDo: Use Screen Height //-------------------------------------------------------------------------------- #region ShowTaskDialogBox //-------------------------------------------------------------------------------- static public DialogResult ShowTaskDialogBox(string Title, string MainInstruction, string Content, string ExpandedInfo, string Footer, string VerificationText, string RadioButtons, string CommandButtons, TaskDialogButtons Buttons, TaskDialogIcons MainIcon, TaskDialogIcons FooterIcon) { if (VistaTaskDialog.IsAvailableOnThisOS && !ForceEmulationMode) { // [OPTION 1] Show Vista TaskDialog VistaTaskDialog vtd = new VistaTaskDialog(); vtd.WindowTitle = Title; vtd.MainInstruction = MainInstruction; vtd.Content = Content; vtd.ExpandedInformation = ExpandedInfo; vtd.Footer = Footer; // Radio Buttons if (RadioButtons != "") { List <VistaTaskDialogButton> lst = new List <VistaTaskDialogButton>(); string[] arr = RadioButtons.Split(new char[] { '|' }); for (int i = 0; i < arr.Length; i++) { try { VistaTaskDialogButton button = new VistaTaskDialogButton(); button.ButtonId = 1000 + i; button.ButtonText = arr[i]; lst.Add(button); } catch (FormatException) { } } vtd.RadioButtons = lst.ToArray(); } // Custom Buttons if (CommandButtons != "") { List <VistaTaskDialogButton> lst = new List <VistaTaskDialogButton>(); string[] arr = CommandButtons.Split(new char[] { '|' }); for (int i = 0; i < arr.Length; i++) { try { VistaTaskDialogButton button = new VistaTaskDialogButton(); button.ButtonId = 2000 + i; button.ButtonText = arr[i]; lst.Add(button); } catch (FormatException) { } } vtd.Buttons = lst.ToArray(); } switch (Buttons) { case TaskDialogButtons.YesNo: vtd.CommonButtons = VistaTaskDialogCommonButtons.Yes | VistaTaskDialogCommonButtons.No; break; case TaskDialogButtons.YesNoCancel: vtd.CommonButtons = VistaTaskDialogCommonButtons.Yes | VistaTaskDialogCommonButtons.No | VistaTaskDialogCommonButtons.Cancel; break; case TaskDialogButtons.OKCancel: vtd.CommonButtons = VistaTaskDialogCommonButtons.Ok | VistaTaskDialogCommonButtons.Cancel; break; case TaskDialogButtons.OK: vtd.CommonButtons = VistaTaskDialogCommonButtons.Ok; break; case TaskDialogButtons.Close: vtd.CommonButtons = VistaTaskDialogCommonButtons.Close; break; case TaskDialogButtons.Cancel: vtd.CommonButtons = VistaTaskDialogCommonButtons.Cancel; break; default: vtd.CommonButtons = 0; break; } switch (MainIcon) { case TaskDialogIcons.Information: vtd.MainIcon = VistaTaskDialogIcon.Information; break; case TaskDialogIcons.Question: vtd.MainIcon = VistaTaskDialogIcon.Information; break; case TaskDialogIcons.Warning: vtd.MainIcon = VistaTaskDialogIcon.Warning; break; case TaskDialogIcons.Error: vtd.MainIcon = VistaTaskDialogIcon.Error; break; } switch (FooterIcon) { case TaskDialogIcons.Information: vtd.FooterIcon = VistaTaskDialogIcon.Information; break; case TaskDialogIcons.Question: vtd.FooterIcon = VistaTaskDialogIcon.Information; break; case TaskDialogIcons.Warning: vtd.FooterIcon = VistaTaskDialogIcon.Warning; break; case TaskDialogIcons.Error: vtd.FooterIcon = VistaTaskDialogIcon.Error; break; } vtd.EnableHyperlinks = false; vtd.ShowProgressBar = false; vtd.AllowDialogCancellation = (Buttons == TaskDialogButtons.Cancel || Buttons == TaskDialogButtons.Close || Buttons == TaskDialogButtons.OKCancel || Buttons == TaskDialogButtons.YesNoCancel); vtd.CallbackTimer = false; vtd.ExpandedByDefault = false; vtd.ExpandFooterArea = false; vtd.PositionRelativeToWindow = true; vtd.RightToLeftLayout = false; vtd.NoDefaultRadioButton = false; vtd.CanBeMinimized = false; vtd.ShowMarqueeProgressBar = false; vtd.UseCommandLinks = (CommandButtons != ""); vtd.UseCommandLinksNoIcon = false; vtd.VerificationText = VerificationText; vtd.VerificationFlagChecked = false; vtd.ExpandedControlText = Properties.Resources.TASKDIALOG_HIDEDETAILS; vtd.CollapsedControlText = Properties.Resources.TASKDIALOG_SHOWDETAILS; vtd.Callback = null; // Show the Dialog DialogResult result = (DialogResult)vtd.Show((vtd.CanBeMinimized ? null : Form.ActiveForm), out VerificationChecked, out RadioButtonResult); // if a command button was clicked, then change return result // to "DialogResult.OK" and set the CommandButtonResult if ((int)result >= 2000) { CommandButtonResult = ((int)result - 2000); result = DialogResult.OK; } if (RadioButtonResult >= 1000) { RadioButtonResult -= 1000; // deduct the ButtonID start value for radio buttons } return(result); } else { // [OPTION 2] Show Emulated Form EmulatedTaskDialog td = new EmulatedTaskDialog(); //ML-2422: Can't confirm error message, with a lot of detailed information. td.ExpandedInfo = ExpandedInfo; try { int expandedInfoHeight = td.GetExpandedInfoLabelHeight; if (expandedInfoHeight > maxHeightExpandedInfo) { td.ExpandedInfo = td.ExpandedInfo.Substring(0, (int)(td.ExpandedInfo.Length * ((int)(maxHeightExpandedInfo / expandedInfoHeight)))); } } catch (Exception e) { Trace.WriteLine("Can't cut text in EmulatedTaskDialog: " + e.ToString()); } td.TopMost = true; td.Title = Title; td.MainInstruction = MainInstruction; td.Content = Content; td.Footer = Footer; td.RadioButtons = RadioButtons; td.CommandButtons = CommandButtons; td.Buttons = Buttons; td.MainIcon = MainIcon; td.FooterIcon = FooterIcon; td.VerificationText = VerificationText; td.Width = EmulatedFormWidth; td.BuildForm(); DialogResult result = td.ShowDialog(); RadioButtonResult = td.RadioButtonIndex; CommandButtonResult = td.CommandButtonClickedIndex; VerificationChecked = td.VerificationCheckBoxChecked; return(result); } }