/// <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; }
/// <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; }