public TaskDialog() { Buttons = new TaskDialogButtonCollection(); RadioButtons = new TaskDialogButtonCollection(); Reset(); }
/// <summary> /// Get the dialog buttons that apply based on the update URL. /// </summary> /// <param name="updateUrl">URL to the latest version update</param> /// <returns></returns> private static TaskDialogButtonCollection GetUpdateDialogButtons(Uri updateUrl) { TaskDialogButtonCollection buttons = new TaskDialogButtonCollection(); // install only works for msi if (Path.GetExtension(updateUrl.LocalPath).Equals(".msi", StringComparison.OrdinalIgnoreCase)) { buttons.Add(new TaskDialogCommandLinkButton(Dialog.DownloadAndInstallUpdateOptionTitle, Dialog.DownloadAndInstallUpdateOptionDescription) { Tag = UpdateDialogResponse.DownloadInstall }); } // all update package types can be downloaded or ignored buttons.Add(new TaskDialogCommandLinkButton(Dialog.DownloadUpdateOnlyOptionTitle, Dialog.DownloadUpdateOnlyOptionDescription) { Tag = UpdateDialogResponse.DownloadOnly }); buttons.Add(new TaskDialogCommandLinkButton(Dialog.IgnoreUpdateOptionTitle, Dialog.IgnoreUpdateOptionDescription) { Tag = UpdateDialogResponse.Cancel }); return(buttons); }
public static VideoCaptureFormat?PromptFormat() { var pressedButton = TaskDialog.ShowDialog(new() { Caption = "Choose a video format", Heading = "Which format would you like to record in?", Buttons = new TaskDialogButtonCollection() { new TaskDialogCommandLinkButton() { Text = "MP4", DescriptionText = "What most pages and messengers actually use when serving Gifs, because it's way smaller.", Tag = VideoCaptureFormat.Mp4, }, new TaskDialogCommandLinkButton() { Text = "WebM", DescriptionText = "Open video format. May produce even smaller files than MP4. Try this when MP4 didn't work for you last time.", Tag = VideoCaptureFormat.Webm, }, new TaskDialogCommandLinkButton() { Text = "GIF", DescriptionText = "Legacy format that produces large files. Most of the time, embeddable as an image (like PNG or JPG).", Tag = VideoCaptureFormat.Gif, }, TaskDialogButton.Cancel, } }); return(pressedButton.Tag == null ? null // "Cancel" : (VideoCaptureFormat)pressedButton.Tag); }
private static TaskDialogButton Show(IWin32Window?parent, string title, string instructionText, string text, TaskDialogIcon icon, params TaskDialogButton[] buttons) { var owner = parent?.Handle ?? IntPtr.Zero; var buttonCollection = new TaskDialogButtonCollection(); foreach (var b in buttons) { buttonCollection.Add(b); } var page = new TaskDialogPage() { Caption = title, Heading = instructionText, Text = text, Icon = icon, Buttons = buttonCollection }; return(TaskDialog.ShowDialog(owner, page)); }