private void FileDrop(object sender, DragEventArgs e) { if (!e.Data.GetDataPresent(DataFormats.FileDrop)) return; var files = (string[]) e.Data.GetData(DataFormats.FileDrop); if (files[0].Split('.')[(files[0].Split('.').Length) - 1] == "jar") { var perms = Permission.GetPermissionsFromPlugin(this, files[0]); if (perms.Count > 0) { var permString = "These are this plugin's permissions: "; foreach (var perm in perms) { permString += perm.Node(); if (perm != perms[perms.Count - 1]) { permString += ", "; } } MessageBox.Show(this, permString); } } else { if (TaskDialog.OSSupportsTaskDialogs) { using (var dialog = new TaskDialog()) { dialog.WindowTitle = Properties.Resources.Error; dialog.MainInstruction = Properties.Resources.Drop_Invalid_plugin_file; dialog.Content = Properties.Resources.Drop_Invalid_plugin_file_detail; dialog.ExpandedInformation = Properties.Resources.Drop_Invalid_plugin_file_detail_expanded; dialog.Footer = Properties.Resources.Drop_Invalid_plugin_file_footer; dialog.FooterIcon = TaskDialogIcon.Information; dialog.EnableHyperlinks = true; var okButton = new TaskDialogButton(ButtonType.Ok); dialog.Buttons.Add(okButton); dialog.ShowDialog(this); } } } }
public UIDialogResult DisplayBugReportUI(Report report) { using (var dialog = new TaskDialog()) { dialog.WindowTitle = string.Format(Messages.Normal_Window_Title, report.GeneralInfo.HostApplication); dialog.Content = Messages.Normal_Window_Message; dialog.CustomMainIcon = SystemIcons.Warning; var continueButton = new TaskDialogButton("Continue"); var quitButton = new TaskDialogButton("Quit"); dialog.Buttons.Add(continueButton); dialog.Buttons.Add(quitButton); TaskDialogButton button = dialog.ShowDialog(); //if (button == continueButton) return new UIDialogResult(button == continueButton ? ExecutionFlow.ContinueExecution : ExecutionFlow.BreakExecution, SendReport); } }
public bool? AskToInstallNpeOnWindows8() { using (var dialog = new TaskDialog()) { dialog.WindowTitle = Resources.Resources.Dialog_Title; dialog.MainInstruction = "Great! You are running on Windows 8"; dialog.Content = "There is also a Windows Store app of NuGet Package Explorer that is designed to be touch friendly, fast and fluid. Do you want to install it now?"; dialog.AllowDialogCancellation = true; dialog.CenterParent = true; dialog.ButtonStyle = TaskDialogButtonStyle.CommandLinks; var yesButton = new TaskDialogButton { Text = "Yes", CommandLinkNote = "Go to the Store and install it now." }; var noButton = new TaskDialogButton { Text = "No", CommandLinkNote = "Don't bother." }; var remindButton = new TaskDialogButton("Remind me next time"); dialog.Buttons.Add(yesButton); dialog.Buttons.Add(noButton); dialog.Buttons.Add(remindButton); TaskDialogButton result = dialog.ShowDialog(); if (result == yesButton) { return true; } else if (result == noButton) { return false; } else { return null; } } }
public static void Show(Window owner, string title, string instruction, string content, string verbose, string footer, TaskDialogIcon icon) { using (var dialog = new TaskDialog()) { dialog.Width = 240; dialog.WindowTitle = title; dialog.MainInstruction = instruction; dialog.Content = content; dialog.ExpandedInformation = verbose; dialog.Footer = footer; dialog.FooterIcon = icon; dialog.EnableHyperlinks = true; var okButton = new TaskDialogButton(ButtonType.Ok); dialog.Buttons.Add(okButton); dialog.HyperlinkClicked += (sender, args) => { Process.Start(args.Href); }; dialog.ShowDialog(owner); } }
private Tuple<bool?, bool> ConfirmMoveFileUsingTaskDialog(string fileName, string targetFolder, int numberOfItemsLeft, string mainInstruction) { string content = String.Format( CultureInfo.CurrentCulture, Resources.Resources.MoveContentFileToFolderExplanation, targetFolder); var dialog = new TaskDialog { MainInstruction = mainInstruction, Content = content, WindowTitle = Resources.Resources.Dialog_Title, ButtonStyle = TaskDialogButtonStyle.CommandLinks }; if (numberOfItemsLeft > 0) { dialog.VerificationText = "Do this for the next " + numberOfItemsLeft + " file(s)."; } var moveButton = new TaskDialogButton { Text = "Yes", CommandLinkNote = "'" + fileName + "' will be added to '" + targetFolder + "' folder." }; var noMoveButton = new TaskDialogButton { Text = "No", CommandLinkNote = "'" + fileName + "' will be added to the package root." }; dialog.Buttons.Add(moveButton); dialog.Buttons.Add(noMoveButton); dialog.Buttons.Add(new TaskDialogButton(ButtonType.Cancel)); TaskDialogButton result = dialog.ShowDialog(Window.Value); bool? movingFile; if (result == moveButton) { movingFile = true; } else if (result == noMoveButton) { movingFile = false; } else { // Cancel button clicked movingFile = null; } bool remember = dialog.IsVerificationChecked; return Tuple.Create(movingFile, remember); }
private static bool? ConfirmWithCancelUsingTaskDialog(string message, string title) { using (var dialog = new TaskDialog()) { dialog.WindowTitle = Resources.Resources.Dialog_Title; dialog.MainInstruction = title; dialog.AllowDialogCancellation = true; dialog.Content = message; dialog.CenterParent = true; dialog.MainIcon = TaskDialogIcon.Warning; //dialog.ButtonStyle = TaskDialogButtonStyle.CommandLinks; var yesButton = new TaskDialogButton("Yes"); var noButton = new TaskDialogButton("No"); var cancelButton = new TaskDialogButton("Cancel"); dialog.Buttons.Add(yesButton); dialog.Buttons.Add(noButton); dialog.Buttons.Add(cancelButton); TaskDialogButton result = dialog.ShowDialog(); if (result == yesButton) { return true; } else if (result == noButton) { return false; } return null; } }
private static bool ConfirmUsingTaskDialog(string message, string title, bool isWarning) { using (var dialog = new TaskDialog()) { dialog.WindowTitle = Resources.Resources.Dialog_Title; dialog.MainInstruction = title; dialog.Content = message; dialog.AllowDialogCancellation = true; dialog.CenterParent = true; //dialog.ButtonStyle = TaskDialogButtonStyle.CommandLinks; if (isWarning) { dialog.MainIcon = TaskDialogIcon.Warning; } var yesButton = new TaskDialogButton("Yes"); var noButton = new TaskDialogButton("No"); dialog.Buttons.Add(yesButton); dialog.Buttons.Add(noButton); TaskDialogButton result = dialog.ShowDialog(); return result == yesButton; } }
private static bool ConfirmCloseEditorUsingTaskDialog(string title, string message) { using (var dialog = new TaskDialog()) { dialog.WindowTitle = Resources.Resources.Dialog_Title; dialog.MainInstruction = title; dialog.Content = message; dialog.AllowDialogCancellation = false; dialog.CenterParent = true; dialog.ButtonStyle = TaskDialogButtonStyle.CommandLinks; var yesButton = new TaskDialogButton { Text = "Yes", CommandLinkNote = "Return to package view and lose all your changes." }; var noButton = new TaskDialogButton { Text = "No", CommandLinkNote = "Stay at the metadata editor and fix the error." }; dialog.Buttons.Add(yesButton); dialog.Buttons.Add(noButton); TaskDialogButton result = dialog.ShowDialog(); return result == yesButton; } }
internal void SetButtonElevationRequired(TaskDialogButton button) { if( IsDialogRunning ) { NativeMethods.SendMessage(Handle, (int)NativeMethods.TaskDialogMessages.SetButtonElevationRequiredState, new IntPtr(button.Id), new IntPtr(button.ElevationRequired ? 1 : 0)); } }
public SpectumChoiceBox(SpectrumEntry currentSpectrum, ISpecrumProvider provider) { _currentSpectrums = currentSpectrum; _choice = currentSpectrum; var icon = RadioStreamerResources.RadioIcon; _dialog = new TaskDialog { WindowIcon = icon, MainIcon = TaskDialogIcon.Information, WindowTitle = RadioStreamerResources.SpectrumChoiceWindowLabel, MainInstruction = RadioStreamerResources.SpectrumChoiceMainInstruction }; _okButton = new TaskDialogButton(ButtonType.Ok); _dialog.Buttons.Add(_okButton); _dialog.Buttons.Add(new TaskDialogButton(ButtonType.Close)); foreach (var name in provider.SpectrumEntries) { var btn = new TaskDialogRadioButton {Text = name.Name}; _dialog.RadioButtons.Add(btn); _spectrumMapping[btn] = name; if (currentSpectrum.ID == name.ID) btn.Checked = true; } _dialog.RadioButtonClicked += DialogOnRadioButtonClicked; }