public void PopulateTasksWithoutThread(object taskObject) { Task TaskObject = (Task)taskObject; TaskButton TaskButtonObject = new TaskButton(ref TaskObject); TaskButtonObject.Width = TasksFlowPanel.Width - 30; TaskButtonObject.Height = 70; TaskButtonObject.Padding = new Padding(5, 5, 5, 5); TaskButtonObject.MouseClick += new MouseEventHandler(TaskButtonClick); TasksFlowPanel.Controls.Add(TaskButtonObject); if (TaskButtonList == null) { TaskButtonList = new List <TaskButton>(); } TaskButtonList.Add(TaskButtonObject); }
protected override void OnShown(EventArgs e) { this.SetTitleText(); base.OnShown(e); if (PdnInfo.IsExpired) { foreach (Form form in Application.OpenForms) { form.Enabled = false; } TaskButton button = new TaskButton(PdnResources.GetImageResource("Icons.MenuUtilitiesCheckForUpdatesIcon.png").Reference, PdnResources.GetString("ExpiredTaskDialog.CheckForUpdatesTB.ActionText"), PdnResources.GetString("ExpiredTaskDialog.CheckForUpdatesTB.ExplanationText")); TaskButton button2 = new TaskButton(PdnResources.GetImageResource("Icons.MenuHelpPdnWebsiteIcon.png").Reference, PdnResources.GetString("ExpiredTaskDialog.GoToWebSiteTB.ActionText"), PdnResources.GetString("ExpiredTaskDialog.GoToWebSiteTB.ExplanationText")); TaskButton button3 = new TaskButton(PdnResources.GetImageResource("Icons.CancelIcon.png").Reference, PdnResources.GetString("ExpiredTaskDialog.DoNotCheckForUpdatesTB.ActionText"), PdnResources.GetString("ExpiredTaskDialog.DoNotCheckForUpdatesTB.ExplanationText")); TaskButton[] buttonArray = new TaskButton[] { button, button2, button3 }; TaskDialog dialog1 = new TaskDialog { Icon = base.Icon, Title = PdnInfo.FullAppName, TaskImage = PdnResources.GetImageResource("Icons.WarningIcon.png").Reference, ScaleTaskImageWithDpi = true, IntroText = PdnResources.GetString("ExpiredTaskDialog.InfoText"), TaskButtons = buttonArray, AcceptButton = button, CancelButton = button3, PixelWidth96Dpi = 450 }; TaskButton button4 = dialog1.Show(this); if (button4 == button) { UpdatesService.Instance.PerformUpdateCheck(); } else if (button4 == button2) { PdnInfo.LaunchWebSite(this, "redirect/pdnexpired.html"); } base.Close(); } if (this.appWorkspace.ActiveDocumentWorkspace != null) { this.appWorkspace.ActiveDocumentWorkspace.Focus(); } else { this.appWorkspace.Focus(); } }
private static DialogResult ShowExpandCanvasTaskDialog(IWin32Window owner, Surface thumbnail) { DialogResult yes; Icon icon = PdnResources.GetImageResource("Icons.MenuEditPasteIcon.png").Reference.ToIcon(); string str = PdnResources.GetString("ExpandCanvasQuestion.Title"); RenderArgs args = new RenderArgs(thumbnail); Image bitmap = args.Bitmap; string str2 = PdnResources.GetString("ExpandCanvasQuestion.IntroText"); TaskButton button = new TaskButton(PdnResources.GetImageResource("Icons.ExpandCanvasQuestion.YesTB.Image.png").Reference, PdnResources.GetString("ExpandCanvasQuestion.YesTB.ActionText"), PdnResources.GetString("ExpandCanvasQuestion.YesTB.ExplanationText")); TaskButton button2 = new TaskButton(PdnResources.GetImageResource("Icons.ExpandCanvasQuestion.NoTB.Image.png").Reference, PdnResources.GetString("ExpandCanvasQuestion.NoTB.ActionText"), PdnResources.GetString("ExpandCanvasQuestion.NoTB.ExplanationText")); TaskButton button3 = new TaskButton(PdnResources.GetImageResource("Icons.CancelIcon.png").Reference, PdnResources.GetString("ExpandCanvasQuestion.CancelTB.ActionText"), PdnResources.GetString("ExpandCanvasQuestion.CancelTB.ExplanationText")); int num = (TaskDialog.DefaultPixelWidth96Dpi * 3) / 2; TaskDialog dialog2 = new TaskDialog { Icon = icon, Title = str, TaskImage = bitmap, ScaleTaskImageWithDpi = true, IntroText = str2 }; dialog2.TaskButtons = new TaskButton[] { button, button2, button3 }; dialog2.AcceptButton = button; dialog2.CancelButton = button3; dialog2.PixelWidth96Dpi = num; TaskButton button4 = dialog2.Show(owner); if (button4 == button) { yes = DialogResult.Yes; } else if (button4 == button2) { yes = DialogResult.No; } else { yes = DialogResult.Cancel; } args.Dispose(); args = null; return(yes); }
private DialogResult AskInstallNowOrOnExit(IWin32Window owner, string newVersionName, string moreInfoUrl) { Image reference; Func <bool> < > 9__1; Icon icon = PdnResources.GetImageResource("Icons.MenuUtilitiesCheckForUpdatesIcon.png").Reference.ToIcon(); string str = PdnResources.GetString("UpdatePromptTaskDialog.Title"); ImageResource imageResource = PdnResources.GetImageResource("Images.UpdatePromptTaskDialog.TaskImage.png"); try { reference = imageResource.Reference; } catch (Exception) { reference = null; } string str2 = PdnResources.GetString("UpdatePromptTaskDialog.IntroText"); TaskAuxLabel label = new TaskAuxLabel { Text = newVersionName, TextFont = new Font(this.host.UISite.Font.FontFamily, this.host.UISite.Font.Size * 1.35f, FontStyle.Regular) }; TaskButton button = new TaskButton(PdnResources.GetImageResource("Icons.Updates.InstallAtExit.png").Reference, PdnResources.GetString("UpdatePromptTaskDialog.InstallOnExitTB.ActionText"), PdnResources.GetString("UpdatePromptTaskDialog.InstallOnExitTB.DescriptionText")); TaskButton tail = new TaskButton(PdnResources.GetImageResource("Icons.Updates.InstallNow.png").Reference, PdnResources.GetString("UpdatePromptTaskDialog.InstallNowTB.ActionText"), PdnResources.GetString("UpdatePromptTaskDialog.InstallNowTB.DescriptionText")); string str3 = PdnResources.GetString("UpdatePromptTaskDialog.AuxButtonText"); Action auxButtonClickHandler = delegate { (< > 9__1 ?? (< > 9__1 = () => ShellUtil.LaunchUrl2(this.host.UISite.Win32Window, moreInfoUrl))).Eval <bool>().Observe(); }; TaskAuxButton button3 = new TaskAuxButton { Text = str3 }; button3.Clicked += delegate(object s, EventArgs e) { auxButtonClickHandler(); }; TaskButton[] buttonArray = (from tb in Enumerable.Empty <TaskButton>().Concat <TaskButton>(((PdnInfo.IsExpired || ShellUtil.IsActivityQueuedForRestart) ? null : button)).Concat <TaskButton>(tail) where tb > null select tb).ToArrayEx <TaskButton>(); TaskDialog dialog2 = new TaskDialog { Icon = icon, Title = str, TaskImage = reference, IntroText = str2, TaskButtons = buttonArray, AcceptButton = tail, CancelButton = null, PixelWidth96Dpi = (TaskDialog.DefaultPixelWidth96Dpi * 3) / 2 }; dialog2.AuxControls = new TaskAuxControl[] { label, button3 }; TaskButton button4 = dialog2.Show(owner); if (button4 == tail) { return(DialogResult.Yes); } if (button4 == button) { return(DialogResult.OK); } return(DialogResult.Cancel); }
private void LanguageMenuItem_Click(object sender, EventArgs e) { // Save off the old locale name in case they decide to cancel string oldLocaleName = PdnResources.Culture.Name; // Now, apply the chosen language so that the confirmation buttons show up in the right language ToolStripMenuItem miwt = (ToolStripMenuItem)sender; string newLocaleName = (string)miwt.Tag; PdnResources.SetNewCulture(newLocaleName); // Load the text and buttons in the new language Icon formIcon = Utility.ImageToIcon(PdnResources.GetImageResource("Icons.MenuHelpLanguageIcon.png").Reference); string title = PdnResources.GetString("ConfirmLanguageDialog.Title"); Image taskImage = null; string introText = PdnResources.GetString("ConfirmLanguageDialog.IntroText"); Image restartImage = PdnResources.GetImageResource("Icons.RightArrowBlue.png").Reference; string explanationTextFormat = PdnResources.GetString("ConfirmLanguageDialog.RestartTB.ExplanationText.Format"); CultureInfo newCI = new CultureInfo(newLocaleName); // We prefer to show "English (United States)" as just "English" CultureInfo en_US = new CultureInfo("en-US"); if (newCI.Equals(en_US)) { newCI = newCI.Parent; } string languageName = newCI.NativeName; string explanationText = string.Format(explanationTextFormat, languageName); TaskButton restartTB = new TaskButton( restartImage, PdnResources.GetString("ConfirmLanguageDialog.RestartTB.ActionText"), explanationText); Image cancelImage = PdnResources.GetImageResource("Icons.CancelIcon.png").Reference; TaskButton cancelTB = new TaskButton( cancelImage, PdnResources.GetString("ConfirmLanguageDialog.CancelTB.ActionText"), PdnResources.GetString("ConfirmLanguageDialog.CancelTB.ExplanationText")); int width96dpi = (TaskDialog.DefaultPixelWidth96Dpi * 5) / 4; TaskButton clickedTB = TaskDialog.Show( AppWorkspace, formIcon, title, taskImage, true, introText, new TaskButton[] { restartTB, cancelTB }, restartTB, cancelTB, width96dpi); if (clickedTB == restartTB) { // Next, apply restart logic CloseAllWorkspacesAction cawa = new CloseAllWorkspacesAction(); cawa.PerformAction(AppWorkspace); if (!cawa.Cancelled) { SystemLayer.Shell.RestartApplication(); Startup.CloseApplication(); } } else { // Revert to the old language PdnResources.SetNewCulture(oldLocaleName); } }
private static DialogResult ShowExpandCanvasTaskDialog(IWin32Window owner, Surface thumbnail) { DialogResult result; Icon formIcon = Utility.ImageToIcon(PdnResources.GetImageResource("Icons.MenuEditPasteIcon.png").Reference); string formTitle = PdnResources.GetString("ExpandCanvasQuestion.Title"); RenderArgs taskImageRA = new RenderArgs(thumbnail); Image taskImage = taskImageRA.Bitmap; string introText = PdnResources.GetString("ExpandCanvasQuestion.IntroText"); TaskButton yesTB = new TaskButton( PdnResources.GetImageResource("Icons.ExpandCanvasQuestion.YesTB.Image.png").Reference, PdnResources.GetString("ExpandCanvasQuestion.YesTB.ActionText"), PdnResources.GetString("ExpandCanvasQuestion.YesTB.ExplanationText")); TaskButton noTB = new TaskButton( PdnResources.GetImageResource("Icons.ExpandCanvasQuestion.NoTB.Image.png").Reference, PdnResources.GetString("ExpandCanvasQuestion.NoTB.ActionText"), PdnResources.GetString("ExpandCanvasQuestion.NoTB.ExplanationText")); TaskButton cancelTB = new TaskButton( TaskButton.Cancel.Image, PdnResources.GetString("ExpandCanvasQuestion.CancelTB.ActionText"), PdnResources.GetString("ExpandCanvasQuestion.CancelTB.ExplanationText")); int width96dpi = (TaskDialog.DefaultPixelWidth96Dpi * 3) / 2; TaskButton clickedTB = TaskDialog.Show( owner, formIcon, formTitle, taskImage, false, introText, new TaskButton[] { yesTB, noTB, cancelTB }, yesTB, cancelTB, width96dpi); if (clickedTB == yesTB) { result = DialogResult.Yes; } else if (clickedTB == noTB) { result = DialogResult.No; } else { result = DialogResult.Cancel; } taskImageRA.Dispose(); taskImageRA = null; return result; }
public void ClickButton(TaskButton button) { SendMessage(Handle, TASKDIALOG_MESSAGE.TDM_CLICK_BUTTON, (IntPtr)TaskDialog.CurrentPage.ToId(button.GlobalId), IntPtr.Zero); }
protected override void OnDragDrop(DragEventArgs drgevent) { base.Activate(); if ((!PdnBaseForm.IsInThreadModalLoop && base.Enabled) && drgevent.Data.GetDataPresent(System.Windows.Forms.DataFormats.FileDrop)) { string[] data = drgevent.Data.GetData(System.Windows.Forms.DataFormats.FileDrop) as string[]; if (data == null) { return; } string[] fileNames = this.PruneDirectories(data); bool flag = true; if (fileNames.Length == 0) { return; } if ((fileNames.Length == 1) && (this.appWorkspace.DocumentWorkspaces.Length == 0)) { flag = false; } else { string str4; string str = (fileNames.Length > 1) ? "Plural" : "Singular"; Icon icon = PdnResources.GetImageResource("Icons.DragDrop.OpenOrImport.FormIcon.png").Reference.ToIcon(); string str2 = PdnResources.GetString("DragDrop.OpenOrImport.Title"); string str3 = PdnResources.GetString("DragDrop.OpenOrImport.InfoText." + str); TaskButton button = new TaskButton(PdnResources.GetImageResource("Icons.MenuFileOpenIcon.png").Reference, PdnResources.GetString("DragDrop.OpenOrImport.OpenButton.ActionText"), PdnResources.GetString("DragDrop.OpenOrImport.OpenButton.ExplanationText." + str)); if (this.appWorkspace.DocumentWorkspaces.Length == 0) { str4 = PdnResources.GetString("DragDrop.OpenOrImport.ImportLayers.ExplanationText.NoImagesYet.Plural"); } else { str4 = PdnResources.GetString("DragDrop.OpenOrImport.ImportLayers.ExplanationText." + str); } TaskButton button2 = new TaskButton(PdnResources.GetImageResource("Icons.MenuLayersAddNewLayerIcon.png").Reference, PdnResources.GetString("DragDrop.OpenOrImport.ImportLayers.ActionText." + str), str4); TaskButton button3 = new TaskButton(PdnResources.GetImageResource("Icons.CancelIcon.png").Reference, PdnResources.GetString("TaskButton.Cancel.ActionText"), PdnResources.GetString("TaskButton.Cancel.ExplanationText")); TaskDialog dialog2 = new TaskDialog { Icon = icon, Title = str2, ScaleTaskImageWithDpi = false, IntroText = str3 }; dialog2.TaskButtons = new TaskButton[] { button, button2, button3 }; dialog2.CancelButton = button3; TaskButton button4 = dialog2.Show(this); if (button4 == button) { flag = false; } else if (button4 == button2) { flag = true; } else { return; } } if (!flag) { this.appWorkspace.OpenFilesInNewWorkspace(fileNames); } else { if (this.appWorkspace.ActiveDocumentWorkspace == null) { SizeInt32 newDocumentSize = this.appWorkspace.GetNewDocumentSize(); this.appWorkspace.CreateBlankDocumentInNewWorkspace(newDocumentSize, Document.DefaultDpuUnit, Document.GetDefaultDpu(Document.DefaultDpuUnit), false); } HistoryMemento memento = new ImportFromFileAction().ImportMultipleFiles(this.appWorkspace.ActiveDocumentWorkspace, fileNames); if (memento != null) { this.appWorkspace.ActiveDocumentWorkspace.History.PushNewMemento(memento); } } } base.OnDragDrop(drgevent); }
public void Dispose() { TaskLabel.Dispose(); TaskProgressBar.Dispose(); TaskButton.Dispose(); }
static TaskDialogPage MakeSamplePages() { var basicTaskDialogPage = new TaskDialogPage { WindowTitle = "Samples", MainInstructionText = "Select sample", TaskButtonStyle = TaskDialogTaskButtonStyle.CommandLink, MainIcon = TaskDialogIcon.FromHIcon(StockIcons.UsersLarge.Handle), ProgressBar = TaskDialogProgressBarType.Marquee, }; var radioTaskDialogPage = new TaskDialogPage { WindowTitle = "Samples Of Radio", TaskButtonStyle = TaskDialogTaskButtonStyle.CommandLink, }; var progressTaskDialogPage = new TaskDialogPage { WindowTitle = "Samples Of Progress", TaskButtonStyle = TaskDialogTaskButtonStyle.CommandLink, ProgressBar = TaskDialogProgressBarType.Default, }; var autoCloseTaskDialogPage = new TaskDialogPage { WindowTitle = "Auto Close Dialog", ProgressBar = TaskDialogProgressBarType.Default, }; var ultimateTaskDialogPage = new TaskDialogPage { WindowTitle = "Full Sample", AllowDialogCancellation = true, MainIcon = TaskDialogIcon.Error, FooterIcon = TaskDialogIcon.Error, CanBeMinimized = true, ExpandedByDefault = true, CollapsedControlText = "Collapsed", ExpandedControlText = "Expanded", ContentText = "Here is contet text.\nYou can use <A HREF=\"http://www.googole.co.jp/\">hyperlink</A>.", EnableHyperLinks = true, CommonButtons = TaskDialogCommonButtonFlags.Ok | TaskDialogCommonButtonFlags.Yes | TaskDialogCommonButtonFlags.Retry | TaskDialogCommonButtonFlags.No | TaskDialogCommonButtonFlags.Close | TaskDialogCommonButtonFlags.Cancel, ExpandedInformationText = "Here is expanded Information.\nYou can use <A HREF=\"http://www.googole.co.jp/\">hyperlink</A>.", ExpandFooterArea = true, FooterText = "Here is fotter text.", MainInstructionText = "Here is main instruction text.", ProgressBar = TaskDialogProgressBarType.Default, VerificationText = "Here is verificaion text.", TaskButtonStyle = TaskDialogTaskButtonStyle.CommandLink, VerificationFlagCheckedByDefault = true, NoDefaultRadioButton = true, }; var buttonStyle = new TaskButton("Use Button Style Command Links."); var commandStyle = new TaskButton("Use CommanLink Style Command Links."); var noiconStyle = new TaskButton("Use NoIconCommandLink Style Command Links."); var radioSample = new TaskButton("Sample Of Radio."); var progressSample = new TaskButton("Sample Of Progress."); var ultimateSample = new TaskButton("Ultimate Sample."); var autoCloseSample = new TaskButton("Auto close Sample."); var modalSample = new TaskButton("Modal TaskDialog Sample."); var modelessSample = new TaskButton("Modeless TaskDialog Sample."); var close = new TaskButton("Close"); var radio1 = new TaskRadioButton("Radio1"); var radio2 = new TaskRadioButton("Radio2"); var radio3 = new TaskRadioButton("Radio3"); var progressNormal = new TaskRadioButton("None"); var progressError = new TaskRadioButton("Error"); var progressPause = new TaskRadioButton("Pause"); var disableButton = new TaskButton("dummy"); basicTaskDialogPage.SetButtons( buttonStyle, commandStyle, noiconStyle, radioSample, progressSample, autoCloseSample, ultimateSample, modalSample, modelessSample, close); radioTaskDialogPage.SetRadioButtons(radio1, radio2, radio3); radioTaskDialogPage.SetButtons(commandStyle); progressTaskDialogPage.SetRadioButtons(progressNormal, progressError, progressPause); progressTaskDialogPage.SetButtons(commandStyle); autoCloseTaskDialogPage.SetButtons(disableButton); radioTaskDialogPage.SetRadioButtons(radio1, radio2, radio3); ultimateTaskDialogPage.SetButtons(commandStyle); buttonStyle.Click += (_, ev) => { ev.CancelDialogClose = true; var navigatePage = MakeSamplePages(); navigatePage.TaskButtonStyle = TaskDialogTaskButtonStyle.Default; ev.ActiveTaskDialog.Navigate(navigatePage); }; commandStyle.Click += (_, ev) => { ev.CancelDialogClose = true; var navigatePage = MakeSamplePages(); navigatePage.TaskButtonStyle = TaskDialogTaskButtonStyle.CommandLink; ev.ActiveTaskDialog.Navigate(navigatePage); }; noiconStyle.Click += (_, ev) => { ev.CancelDialogClose = true; var navigatePage = MakeSamplePages(); navigatePage.TaskButtonStyle = TaskDialogTaskButtonStyle.NoIconCommandLink; ev.ActiveTaskDialog.Navigate(navigatePage); }; radioSample.Click += (_, ev) => { ev.CancelDialogClose = true; ev.ActiveTaskDialog.Navigate(radioTaskDialogPage); }; progressSample.Click += (_, ev) => { ev.CancelDialogClose = true; ev.ActiveTaskDialog.Navigate(progressTaskDialogPage); }; autoCloseSample.Click += (_, ev) => { ev.CancelDialogClose = true; ev.ActiveTaskDialog.Navigate(autoCloseTaskDialogPage); }; ultimateSample.Click += (_, ev) => { ev.CancelDialogClose = true; ev.ActiveTaskDialog.Navigate(ultimateTaskDialogPage); }; modalSample.Click += (_, ev) => { ev.CancelDialogClose = true; var modalTaskDialog = new TaskDialog(MakeSamplePages()); modalTaskDialog.DoModal(ev.ActiveTaskDialog.Handle); }; modelessSample.Click += async(_, ev) => { ev.CancelDialogClose = true; var modelessTaskDialog = new TaskDialog(MakeSamplePages()); await modelessTaskDialog.ShowAsync(); }; var large = StockIcons.ErrorLarge; var small = StockIcons.ErrorSmall; TaskDialogProgressBarState barState = TaskDialogProgressBarState.Normal; progressNormal.Click += (_, ev) => { barState = TaskDialogProgressBarState.Normal; ev.ActiveTaskDialog.SetProgressBarState(barState); }; progressError.Click += (_, ev) => { barState = TaskDialogProgressBarState.Error; ev.ActiveTaskDialog.SetProgressBarState(barState); }; progressPause.Click += (_, ev) => { barState = TaskDialogProgressBarState.Pause; ev.ActiveTaskDialog.SetProgressBarState(barState); }; progressTaskDialogPage.Load += (_, ev) => { ev.ActiveTaskDialog.SetProgressBarRange(0, 10000); }; progressTaskDialogPage.Timer += (_, ev) => { if (barState == TaskDialogProgressBarState.Normal) { ev.ActiveTaskDialog.SetProgressBarPos((int)(ev.TickCount % 10000)); } }; autoCloseTaskDialogPage.Load += (_, ev) => { ev.ActiveTaskDialog.SetProgressBarRange(0, 4000); ev.ActiveTaskDialog.EnableButton(disableButton, false); }; autoCloseTaskDialogPage.Timer += (_, ev) => { ev.ActiveTaskDialog.SetProgressBarPos((int)Math.Min(4000, ev.TickCount)); if (ev.TickCount > 4000) { ev.ActiveTaskDialog.ForceCancelClose(); } }; ultimateTaskDialogPage.HyperlinkClicked += (_, ev) => { MessageBox.Show(ev.Href); }; ultimateTaskDialogPage.Load += (_, ev) => { ev.ActiveTaskDialog.SetProgressBarRange(0, 10000); }; ultimateTaskDialogPage.Timer += (_, ev) => { ev.ActiveTaskDialog.SetProgressBarPos((int)(ev.TickCount % 10000)); }; return(basicTaskDialogPage); }
private void HandleEffectException(AppWorkspace appWorkspace, Effect effect, Exception ex) { try { AppWorkspace.Widgets.StatusBarProgress.ResetProgressStatusBar(); AppWorkspace.Widgets.StatusBarProgress.EraseProgressStatusBar(); } catch (Exception) { } // Figure out if it's a built-in effect, or a plug-in bool builtIn = IsBuiltInEffect(effect); if (builtIn) { // For built-in effects, tear down Paint.NET which will result in a crash log throw new ApplicationException("Effect threw an exception", ex); } else { Icon formIcon = Utility.ImageToIcon(PdnResources.GetImageResource("Icons.BugWarning.png").Reference); string formTitle = PdnResources.GetString("Effect.PluginErrorDialog.Title"); Image taskImage = null; string introText = PdnResources.GetString("Effect.PluginErrorDialog.IntroText"); TaskButton restartTB = new TaskButton( PdnResources.GetImageResource("Icons.RightArrowBlue.png").Reference, PdnResources.GetString("Effect.PluginErrorDialog.RestartTB.ActionText"), PdnResources.GetString("Effect.PluginErrorDialog.RestartTB.ExplanationText")); TaskButton doNotRestartTB = new TaskButton( PdnResources.GetImageResource("Icons.WarningIcon.png").Reference, PdnResources.GetString("Effect.PluginErrorDialog.DoNotRestartTB.ActionText"), PdnResources.GetString("Effect.PluginErrorDialog.DoNotRestartTB.ExplanationText")); string auxButtonText = PdnResources.GetString("Effect.PluginErrorDialog.AuxButton1.Text"); EventHandler auxButtonClickHandler = delegate(object sender, EventArgs e) { using (PdnBaseForm textBoxForm = new PdnBaseForm()) { textBoxForm.Name = "EffectCrash"; TextBox exceptionBox = new TextBox(); textBoxForm.Icon = Utility.ImageToIcon(PdnResources.GetImageResource("Icons.WarningIcon.png").Reference); textBoxForm.Text = PdnResources.GetString("Effect.PluginErrorDialog.Title"); exceptionBox.Dock = DockStyle.Fill; exceptionBox.ReadOnly = true; exceptionBox.Multiline = true; string exceptionText = AppWorkspace.GetLocalizedEffectErrorMessage(effect.GetType().Assembly, effect.GetType(), ex); exceptionBox.Font = new Font(FontFamily.GenericMonospace, exceptionBox.Font.Size); exceptionBox.Text = exceptionText; exceptionBox.ScrollBars = ScrollBars.Vertical; textBoxForm.StartPosition = FormStartPosition.CenterParent; textBoxForm.ShowInTaskbar = false; textBoxForm.MinimizeBox = false; textBoxForm.Controls.Add(exceptionBox); textBoxForm.Width = UI.ScaleWidth(700); textBoxForm.ShowDialog(); } }; TaskButton clickedTB = TaskDialog.Show( appWorkspace, formIcon, formTitle, taskImage, true, introText, new TaskButton[] { restartTB, doNotRestartTB }, restartTB, doNotRestartTB, TaskDialog.DefaultPixelWidth96Dpi * 2, auxButtonText, auxButtonClickHandler); if (clickedTB == restartTB) { // Next, apply restart logic CloseAllWorkspacesAction cawa = new CloseAllWorkspacesAction(); cawa.PerformAction(appWorkspace); if (!cawa.Cancelled) { SystemLayer.Shell.RestartApplication(); Startup.CloseApplication(); } } } }
private void NewsButton_MouseDown(object sender, MouseButtonEventArgs e) { TaskButton.UpdateColorToStart(); NewsButton.UpdateColorToEnd(); this.DataContext = new NewsViewModels(true); }
private void HandleEffectException(AppWorkspace appWorkspace, Effect effect, Exception ex) { try { AppWorkspace.Widgets.StatusBarProgress.ResetProgressStatusBar(); AppWorkspace.Widgets.StatusBarProgress.EraseProgressStatusBar(); } catch (Exception) { } // Figure out if it's a built-in effect, or a plug-in if (IsBuiltInEffect(effect)) { // For built-in effects, tear down Paint.NET which will result in a crash log throw new ApplicationException("Effect threw an exception", ex); } else { Icon formIcon = Utility.ImageToIcon(PdnResources.GetImageResource("Icons.BugWarning.png").Reference); string formTitle = PdnResources.GetString("Effect.PluginErrorDialog.Title"); Image taskImage = null; string introText = PdnResources.GetString("Effect.PluginErrorDialog.IntroText"); TaskButton restartTB = new TaskButton( PdnResources.GetImageResource("Icons.RightArrowBlue.png").Reference, PdnResources.GetString("Effect.PluginErrorDialog.RestartTB.ActionText"), PdnResources.GetString("Effect.PluginErrorDialog.RestartTB.ExplanationText")); TaskButton doNotRestartTB = new TaskButton( PdnResources.GetImageResource("Icons.WarningIcon.png").Reference, PdnResources.GetString("Effect.PluginErrorDialog.DoNotRestartTB.ActionText"), PdnResources.GetString("Effect.PluginErrorDialog.DoNotRestartTB.ExplanationText")); string auxButtonText = PdnResources.GetString("Effect.PluginErrorDialog.AuxButton1.Text"); void AuxButtonClickHandler(object sender, EventArgs e) { using (PdnBaseForm textBoxForm = new PdnBaseForm()) { textBoxForm.Name = "EffectCrash"; TextBox exceptionBox = new TextBox(); textBoxForm.Icon = Utility.ImageToIcon(PdnResources.GetImageResource("Icons.WarningIcon.png").Reference); textBoxForm.Text = PdnResources.GetString("Effect.PluginErrorDialog.Title"); exceptionBox.Dock = DockStyle.Fill; exceptionBox.ReadOnly = true; exceptionBox.Multiline = true; string exceptionText = AppWorkspace.GetLocalizedEffectErrorMessage(effect.GetType().Assembly, effect.GetType(), ex); exceptionBox.Font = new Font(FontFamily.GenericMonospace, exceptionBox.Font.Size); exceptionBox.Text = exceptionText; exceptionBox.ScrollBars = ScrollBars.Vertical; textBoxForm.StartPosition = FormStartPosition.CenterParent; textBoxForm.ShowInTaskbar = false; textBoxForm.MinimizeBox = false; textBoxForm.Controls.Add(exceptionBox); textBoxForm.Width = UI.ScaleWidth(700); textBoxForm.ShowDialog(); } } TaskButton clickedTB = TaskDialog.Show( appWorkspace, formIcon, formTitle, taskImage, true, introText, new TaskButton[] { restartTB, doNotRestartTB }, restartTB, doNotRestartTB, TaskDialog.DefaultPixelWidth96Dpi * 2, auxButtonText, AuxButtonClickHandler); if (clickedTB == restartTB) { // Next, apply restart logic CloseAllWorkspacesAction cawa = new CloseAllWorkspacesAction(); cawa.PerformAction(appWorkspace); if (!cawa.Cancelled) { SystemLayer.Shell.RestartApplication(); Startup.CloseApplication(); } } } }
public void loadTasks() { try { tasksGrid.Children.Clear(); tasksGrid.RowDefinitions.Clear(); tasksGrid.ColumnDefinitions.Clear(); if (selectBoardBox.SelectedItem != null) { string[] list = selectBoardBox.SelectedItem.ToString().Split('/'); if (list.Length >= 2) { BoardId = Convert.ToInt32(list[1]); } RestClient client = new RestClient(); client.Method = httpVerb.GET; if (!string.IsNullOrEmpty(ConfigurationSettings.AppSettings["ServerPatch"])) { client.ServiceUri = ConfigurationSettings.AppSettings["ServerPatch"]; } client.ServiceUri += "Tasks/" + BoardId; string response = client.getRequest(); var taskList = new ValueResponse <List <TaskPoco> >(true, string.Empty, null); taskList = JsonConvert.DeserializeObject <ValueResponse <List <TaskPoco> > >(response); TaskBoardXY location = new TaskBoardXY(); for (int columnCount = 0; columnCount < 6; columnCount++) //Ilość Kolumn tasków { ColumnDefinition colDef = new ColumnDefinition(); //colDef.Width = GridLength.Auto; tasksGrid.ColumnDefinitions.Add(colDef); } foreach (TaskPoco task in taskList.Value) { TaskButton taskButton = new TaskButton(task); taskButton.AddHandler(Button.ClickEvent, new RoutedEventHandler(openTaskWindow)); int dstRow = location.GetDestinationRow(task.TaskType); Grid.SetColumn(taskButton, location.GetColumn(task.TaskType)); Grid.SetRow(taskButton, dstRow - 1); tasksGrid.Children.Add(taskButton); } int rowsCount = location.GetMax(); for (int i = 0; i < rowsCount; i++) { RowDefinition rowDef = new RowDefinition(); rowDef.Height = GridLength.Auto; tasksGrid.RowDefinitions.Add(rowDef); } } } catch (Exception e) { MessageWindow message = new MessageWindow(e.Message); message.Show(); } }
public void EnableButton(TaskButton button, bool enable) { SendMessage(Handle, TASKDIALOG_MESSAGE.TDM_ENABLE_BUTTON, (IntPtr)TaskDialog.CurrentPage.ToId(button.GlobalId), (IntPtr)(enable ? 1 : 0)); }
public override void PerformAction(AppWorkspace appWorkspace) { DocumentWorkspace dw; if (this.closeMe == null) { dw = appWorkspace.ActiveDocumentWorkspace; } else { dw = this.closeMe; } if (dw != null) { if (dw.Document == null) { appWorkspace.RemoveDocumentWorkspace(dw); } else if (!dw.Document.Dirty) { appWorkspace.RemoveDocumentWorkspace(dw); } else { appWorkspace.ActiveDocumentWorkspace = dw; TaskButton saveTB = new TaskButton( ImageResource.Get("Icons.MenuFileSaveIcon.png").Reference, PdnResources.GetString("CloseWorkspaceAction.SaveButton.ActionText"), PdnResources.GetString("CloseWorkspaceAction.SaveButton.ExplanationText")); TaskButton dontSaveTB = new TaskButton( ImageResource.Get("Icons.MenuFileCloseIcon.png").Reference, PdnResources.GetString("CloseWorkspaceAction.DontSaveButton.ActionText"), PdnResources.GetString("CloseWorkspaceAction.DontSaveButton.ExplanationText")); TaskButton cancelTB = new TaskButton( ImageResource.Get("Icons.CancelIcon.png").Reference, PdnResources.GetString("CloseWorkspaceAction.CancelButton.ActionText"), PdnResources.GetString("CloseWorkspaceAction.CancelButton.ExplanationText")); string title = PdnResources.GetString("CloseWorkspaceAction.Title"); string introTextFormat = PdnResources.GetString("CloseWorkspaceAction.IntroText.Format"); string introText = string.Format(introTextFormat, dw.GetFriendlyName()); Image thumb = appWorkspace.GetDocumentWorkspaceThumbnail(dw); Bitmap taskImage = new Bitmap(thumb.Width + 2, thumb.Height + 2, PixelFormat.Format32bppArgb); using (Graphics g = Graphics.FromImage(taskImage)) { g.Clear(Color.Transparent); g.DrawImage( thumb, new Rectangle(1, 1, thumb.Width, thumb.Height), new Rectangle(0, 0, thumb.Width, thumb.Height), GraphicsUnit.Pixel); Utility.DrawDropShadow1px(g, new Rectangle(0, 0, taskImage.Width, taskImage.Height)); } Form mainForm = appWorkspace.FindForm(); if (mainForm != null) { PdnBaseForm asPDF = mainForm as PdnBaseForm; if (asPDF != null) { asPDF.RestoreWindow(); } } TaskButton clickedTB = TaskDialog.Show( appWorkspace, Utility.ImageToIcon(ImageResource.Get("Icons.WarningIcon.png").Reference, false), title, taskImage, false, introText, new TaskButton[] { saveTB, dontSaveTB, cancelTB }, saveTB, cancelTB, 340); if (clickedTB == saveTB) { if (dw.DoSave()) { this.cancelled = false; appWorkspace.RemoveDocumentWorkspace(dw); } else { this.cancelled = true; } } else if (clickedTB == dontSaveTB) { this.cancelled = false; appWorkspace.RemoveDocumentWorkspace(dw); } else { this.cancelled = true; } } } Utility.GCFullCollect(); }
public void SetButtonElevationRequiredState(TaskButton button, [MarshalAs(UnmanagedType.U1)] bool elevation) { SendMessage(Handle, TASKDIALOG_MESSAGE.TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE, (IntPtr)TaskDialog.CurrentPage.ToId(button.GlobalId), (IntPtr)(elevation ? 1 : 0)); }
public override void PerformAction(AppWorkspace appWorkspace) { if (appWorkspace == null) { throw new ArgumentNullException("appWorkspace"); } DocumentWorkspace dw; if (this.closeMe == null) { dw = appWorkspace.ActiveDocumentWorkspace; } else { dw = this.closeMe; } if (dw != null) { if (dw.Document == null) { appWorkspace.RemoveDocumentWorkspace(dw); } else if (!dw.Document.Dirty) { appWorkspace.RemoveDocumentWorkspace(dw); } else { appWorkspace.ActiveDocumentWorkspace = dw; TaskButton saveTB = new TaskButton( PdnResources.GetImageResource("Icons.MenuFileSaveIcon.png").Reference, PdnResources.GetString("CloseWorkspaceAction.SaveButton.ActionText"), PdnResources.GetString("CloseWorkspaceAction.SaveButton.ExplanationText")); TaskButton dontSaveTB = new TaskButton( PdnResources.GetImageResource("Icons.MenuFileCloseIcon.png").Reference, PdnResources.GetString("CloseWorkspaceAction.DontSaveButton.ActionText"), PdnResources.GetString("CloseWorkspaceAction.DontSaveButton.ExplanationText")); TaskButton cancelTB = new TaskButton( PdnResources.GetImageResource("Icons.CancelIcon.png").Reference, PdnResources.GetString("CloseWorkspaceAction.CancelButton.ActionText"), PdnResources.GetString("CloseWorkspaceAction.CancelButton.ExplanationText")); string title = PdnResources.GetString("CloseWorkspaceAction.Title"); string introTextFormat = PdnResources.GetString("CloseWorkspaceAction.IntroText.Format"); string introText = string.Format(introTextFormat, dw.GetFriendlyName()); Image thumb = appWorkspace.GetDocumentWorkspaceThumbnail(dw); if (thumb == null) { thumb = new Bitmap(32, 32); } Bitmap taskImage = new Bitmap(thumb.Width + 2, thumb.Height + 2, PixelFormat.Format32bppArgb); using (Graphics g = Graphics.FromImage(taskImage)) { g.Clear(Color.Transparent); g.DrawImage( thumb, new Rectangle(1, 1, thumb.Width, thumb.Height), new Rectangle(0, 0, thumb.Width, thumb.Height), GraphicsUnit.Pixel); Utility.DrawDropShadow1px(g, new Rectangle(0, 0, taskImage.Width, taskImage.Height)); } Form mainForm = appWorkspace.FindForm(); if (mainForm != null) { if (mainForm is PdnBaseForm asPDF) { asPDF.RestoreWindow(); } } Icon warningIcon; ImageResource warningIconImageRes = PdnResources.GetImageResource("Icons.WarningIcon.png"); if (warningIconImageRes != null) { Image warningIconImage = warningIconImageRes.Reference; warningIcon = Utility.ImageToIcon(warningIconImage, false); } else { warningIcon = null; } TaskButton clickedTB = TaskDialog.Show( appWorkspace, warningIcon, title, taskImage, false, introText, new TaskButton[] { saveTB, dontSaveTB, cancelTB }, saveTB, cancelTB, 340); if (clickedTB == saveTB) { if (dw.DoSave()) { this.Cancelled = false; appWorkspace.RemoveDocumentWorkspace(dw); } else { this.Cancelled = true; } } else if (clickedTB == dontSaveTB) { this.Cancelled = false; appWorkspace.RemoveDocumentWorkspace(dw); } else { this.Cancelled = true; } } } Utility.GCFullCollect(); }
protected void RightPanelInit( Listings listing ) { if ( view == null ) view = Find("secondaryMenuScrollArea") as GUIScrollView; if ( view != null ) { // get category button template if ( categoryToggleTemplate == null ) { categoryToggleTemplate = view.Find("button.category") as GUIToggle; } // get task button template if ( taskButtonTemplate == null ) { taskButtonTemplate = view.Find("button.task") as GUIButton; } // clear all elements view.Elements.Clear(); // set current listing current = listing; // put category title first (if there is one) if ( current.parent != null ) { // add element GUIToggle copy = categoryToggleTemplate.Clone() as GUIToggle; copy.name = "BACK"; copy.text = current.category; copy.UpdateContent(); copy.toggle = true; view.Elements.Add(copy); } // // do categories first foreach (Listings cat in listing.subCategories) { // add element GUIToggle copy = categoryToggleTemplate.Clone() as GUIToggle; copy.name = "CATEGORY"; copy.text = cat.category; copy.UpdateContent(); view.Elements.Add(copy); } // init dictionary if ( nameMap == null ) nameMap = new Dictionary<string, string>(); nameMap.Clear(); // now do items foreach( InteractionMap map in listing.items ) { // add element GUIButton temp = taskButtonTemplate.Clone() as GUIButton; TaskButton task = new TaskButton(temp); task.map = map; task.name = "TASK"; task.text = StringMgr.GetInstance().Get(map.item); task.UpdateContent(); view.Elements.Add(task); // add to name map nameMap[task.text] = map.item; } } BreadcrumbInit(); }