Beispiel #1
0
 /// <summary>
 /// Displays a task dialog in front of the specified window and with the specified title, intruction, content, title, buttons and icon..
 /// </summary>
 /// <param name="owner">A window that will own the modal dialog box.</param>
 /// <param name="windowTitle">The text to display in the title bar of the task dialog.</param>
 /// <param name="mainInstruction">The instruction to display in the task dialog.</param>
 /// <param name="content">The text to display in the task dialog.</param>
 /// <param name="commonButtons">One of the TaskDialogCommonButtons values that specifies which buttons to display in the task dialog.</param>
 /// <param name="icon">One of the TaskDialogIcon values that specifies which icon to display in the task dialog.</param>
 /// <returns>One of the TaskDialogResult values.</returns>
 public static TaskDialogResult Show(Window owner, string windowTitle, string mainInstruction, string content, TaskDialogCommonButtons commonButtons, TaskDialogIcon icon)
 {
     TaskDialogWindow td = new TaskDialogWindow(null, true) { Owner = owner, WindowTitle = windowTitle, MainIcon = icon, MainInstruction = mainInstruction, ContentText = content, CommonButtons = commonButtons };
     td.DefaultButton = TaskDialogHelpers.GetFirstButton(commonButtons);
     td.UseCommandLinks = true;
     td.ShowDialog();
     return (TaskDialogResult)td.Tag;
 }
Beispiel #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TaskDialog"/> class.
 /// </summary>
 public TaskDialog()
 {
     _TaskDialogWindow = new TaskDialogWindow(this, true);
     try
     {
         _TaskDialogWindow.Owner = TaskDialog.DefaultOwnerWindow;
     }
     catch { }
     _TaskDialogWindow.WindowTitle = TaskDialogHelpers.ProductName;
 }
Beispiel #3
0
 public static string TaskDialogToString(TaskDialogWindow w)
 {
     return(_Sep + Environment.NewLine + w.WindowTitle + Environment.NewLine +
            (!string.IsNullOrEmpty(w.MainInstruction) ? _Sep + Environment.NewLine + w.MainInstruction + Environment.NewLine : string.Empty) +
            (!string.IsNullOrEmpty(w.ContentText) ? _Sep + Environment.NewLine + w.ContentText + Environment.NewLine : string.Empty) +
            (!string.IsNullOrEmpty(w.ExpandedInformation) && !w.ExpandFooterArea && w.IsExpanded ? _Sep + Environment.NewLine + w.ExpandedInformation + Environment.NewLine : string.Empty) +
            (w.RadioButtons != null && w.RadioButtons.Count > 0 ? _Sep + Environment.NewLine + RadioButtonsToText(w.RadioButtons) + Environment.NewLine : string.Empty) +
            (w.Buttons != null && w.Buttons.Count > 0 ? _Sep + Environment.NewLine + ButtonsToText(w.Buttons) + Environment.NewLine : string.Empty) +
            (w.CommonButtons != TaskDialogCommonButtons.None ? _Sep + Environment.NewLine + ButtonsToText(w.CommonButtons) + Environment.NewLine : string.Empty) +
            (!string.IsNullOrEmpty(w.FooterText) ? _Sep + Environment.NewLine + w.FooterText + Environment.NewLine : string.Empty) +
            (!string.IsNullOrEmpty(w.ExpandedInformation) && w.ExpandFooterArea && w.IsExpanded ? _Sep + Environment.NewLine + w.ExpandedInformation + Environment.NewLine : string.Empty));
 }
Beispiel #4
0
 /// <summary>
 /// Displays a task dialog in front of the specified window and with specified text, title, buttons, icon, and default button.
 /// </summary>
 /// <param name="owner">A window that will own the modal dialog box.</param>
 /// <param name="text">The text to display in the task dialog.</param>
 /// <param name="title">The text to display in the title bar of the task dialog.</param>
 /// <param name="buttons">One of the TaskDialogCommonButtons values that specifies which buttons to display in the task dialog.</param>
 /// <param name="icon">One of the TaskDialogIcon values that specifies which icon to display in the task dialog.</param>
 /// <param name="defaultButton">TaskDialogResult value that specifies the default button for the task dialog.</param>
 /// <returns>One of the TaskDialogResult values.</returns>
 public static TaskDialogResult Show(Window owner, string text, string title, TaskDialogCommonButtons buttons, TaskDialogIcon icon, TaskDialogResult defaultButton)
 {
     TaskDialogWindow td = new TaskDialogWindow(null, false)
     {
         Owner = owner,
         WindowTitle = title,
         MainIcon = icon,
         ContentText = text,
         CommonButtons = buttons,
         DefaultButton = defaultButton,
     };
     td.ShowDialog();
     return (TaskDialogResult)td.Tag;
 }
 public static string TaskDialogToString(TaskDialogWindow w)
 {
     return _Sep + Environment.NewLine + w.WindowTitle + Environment.NewLine +
           (!string.IsNullOrEmpty(w.MainInstruction) ? _Sep + Environment.NewLine + w.MainInstruction + Environment.NewLine : string.Empty) +
           (!string.IsNullOrEmpty(w.ContentText) ? _Sep + Environment.NewLine + w.ContentText + Environment.NewLine : string.Empty) +
           (!string.IsNullOrEmpty(w.ExpandedInformation) && !w.ExpandFooterArea && w.IsExpanded ? _Sep + Environment.NewLine + w.ExpandedInformation + Environment.NewLine : string.Empty) +
           (w.RadioButtons != null && w.RadioButtons.Count > 0 ? _Sep + Environment.NewLine + RadioButtonsToText(w.RadioButtons) + Environment.NewLine : string.Empty) +
           (w.Buttons != null && w.Buttons.Count > 0 ? _Sep + Environment.NewLine + ButtonsToText(w.Buttons) + Environment.NewLine : string.Empty) +
           (w.CommonButtons != TaskDialogCommonButtons.None ? _Sep + Environment.NewLine + ButtonsToText(w.CommonButtons) + Environment.NewLine : string.Empty) +
           (!string.IsNullOrEmpty(w.FooterText) ? _Sep + Environment.NewLine + w.FooterText + Environment.NewLine : string.Empty) +
           (!string.IsNullOrEmpty(w.ExpandedInformation) && w.ExpandFooterArea && w.IsExpanded ? _Sep + Environment.NewLine + w.ExpandedInformation + Environment.NewLine : string.Empty);
 }
 public static string MessageBoxToString(TaskDialogWindow w)
 {
     return _Sep + Environment.NewLine + w.WindowTitle + Environment.NewLine +
            _Sep + Environment.NewLine + w.ContentText + Environment.NewLine +
            _Sep + Environment.NewLine + ButtonsToText(w.Buttons, w.CommonButtons) + Environment.NewLine + _Sep;
 }
Beispiel #7
0
 public static string MessageBoxToString(TaskDialogWindow w)
 {
     return(_Sep + Environment.NewLine + w.WindowTitle + Environment.NewLine +
            _Sep + Environment.NewLine + w.ContentText + Environment.NewLine +
            _Sep + Environment.NewLine + ButtonsToText(w.Buttons, w.CommonButtons) + Environment.NewLine + _Sep);
 }