public static void Show(Exception e, Guid guid) { String message = String.Concat("Error ID: ", guid.ToString(), "\n\n", e.Message); TaskDialog dialog = new TaskDialog() { HyperlinksEnabled = true, DetailsExpanded = false, Cancelable = false, Icon = TaskDialogStandardIcon.Error, DetailsExpandedText = e.StackTrace, Caption = "Gmail Notifier Plus Error", InstructionText = "An unhandled exception occurred:", Text = message, FooterIcon = TaskDialogStandardIcon.Information, //Please <a href=\"#stub\">Click Here</a> to automagically report the issue.\ FooterText = "Press CTL + C to copy this error to the clipboard." }; dialog.HyperlinkClick += delegate(object sender, TaskDialogHyperlinkClickedEventArgs evt) { Send(guid); }; SetWindowPos(dialog.OwnerWindowHandle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); dialog.Show(); }
private void _LinkRemove_Click(object sender, EventArgs e) { TaskDialog dialog = new TaskDialog() { Caption = Program.MainForm.Text, InstructionText = Locale.Current.Preferences.Panels.Accounts.Account.RemoveConfirmation, OwnerWindowHandle = base.Handle }; TaskDialogButton buttonYes = new TaskDialogButton("yesButton", Locale.Current.Preferences.Panels.Accounts.Account.RemoveAccount); buttonYes.Default = true; buttonYes.Click += delegate(object s, EventArgs ev) { AccountListItem target = _ListAccounts.Items.Cast<AccountListItem>().Where(o => o.Account == _currentAccount).FirstOrDefault(); if(target != null){ _ListAccounts.Items.Remove(target); } Config.Current.Accounts.Remove(_currentAccount); Config.Current.Save(); _currentAccount = null; dialog.Close(); HidePanels(); _PanelAccounts.Show(); }; TaskDialogButton buttonNo = new TaskDialogButton("noButton", Locale.Current.Common.No); buttonNo.Click += delegate(object s, EventArgs ev) { dialog.Close(); }; dialog.Controls.Add(buttonYes); dialog.Controls.Add(buttonNo); dialog.Show(); }
private void _ButtonAccountAction_Click(object sender, EventArgs e) { Account account = _currentAccount ?? new Account(); account.Login = _TextAddress.Text; if (AccountExists(account, _currentAccount)) { TaskDialog dialog = new TaskDialog() { Caption = Program.MainForm.Text, InstructionText = Locale.Current.Preferences.Panels.Accounts.Account.Error, Cancelable = false, OwnerWindowHandle = this.Handle, Icon = TaskDialogStandardIcon.Warning }; dialog.Show(); return; } account.Password = _TextPassword.Text.Length > 0 ? _TextPassword.Text : account.Password; account.Browser = _ComboBrowser.SelectedValue as Shellscape.Browser; if (_CheckDefaultAccount.Checked) { Config.Current.Accounts.ForEach(a => a.Default = false); account.Default = true; } Account mailtoAccount = Config.Current.Accounts.Where(o => o.HandlesMailto).FirstOrDefault(); if (_CheckMailto.Checked) { if (mailtoAccount != null) { mailtoAccount.HandlesMailto = false; } account.HandlesMailto = true; ToggleMailto(true); } else { if (mailtoAccount == null) { ToggleMailto(false); } } if (_currentAccount == null) { _ListAccounts.Items.Add(new AccountListItem(account)); Config.Current.Accounts.Add(account); } Config.Current.Save(); if (_currentAccount != null) { Config.Current.Accounts.TriggerDirty(account); } _ButtonAccountAction.Enabled = false; this.HidePanels(); _PanelAccounts.Show(); }
private void _Updates_DownloadComplete(object sender, AsyncCompletedEventArgs e) { _config.StartupState = StartupState.Second; _config.Save(); Shellscape.UpdateManager.Current.Replace(Config.Current.AppDataPath, Path.GetDirectoryName(Application.ExecutablePath)); // @"C:\Users\Andrew\AppData\Roaming\Gmail Notifier Plus\Updates\test"); using(TaskDialog dialog = new TaskDialog() { Text = Locale.Current.Updates.Text, Icon = TaskDialogStandardIcon.Information }) { TaskDialogCommandLink yes = new TaskDialogCommandLink("yes", Locale.Current.Updates.YesText, Locale.Current.Updates.YesInstruction); yes.Click += delegate(object s, EventArgs ea) { EventHandler handler = null; handler = delegate(object o, EventArgs args) { Application.ApplicationExit -= handler; System.Diagnostics.Process.Start(Application.ExecutablePath); }; Application.ApplicationExit += handler; Invoke((Action)(() => Application.Exit())); dialog.Close(); }; TaskDialogCommandLink no = new TaskDialogCommandLink("no", Locale.Current.Updates.NoText, Locale.Current.Updates.NoInstruction); no.Click += delegate(object s, EventArgs ea) { dialog.Close(); }; dialog.Caption = dialog.InstructionText = "Gmail Notifier Plus " + Locale.Current.Updates.WindowTitle; dialog.Controls.Add(yes); dialog.Controls.Add(no); dialog.Show(); } }
private Boolean Ask(String function, String yes) { if (!Config.Current.Ask) { return true; } using (TaskDialog dialog = new TaskDialog() { Icon = TaskDialogStandardIcon.Information }) { TaskDialogCommandLink yesButton = new TaskDialogCommandLink("yes", "Yes, " + function, yes); yesButton.Click += delegate(object s, EventArgs ea) { dialog.Close(TaskDialogResult.Yes); }; TaskDialogCommandLink noButton = new TaskDialogCommandLink("no", "No", "Get me out of here..."); noButton.Click += delegate(object s, EventArgs ea) { dialog.Close(TaskDialogResult.No); }; dialog.InstructionText = "Are you sure you want to " + function + "?"; dialog.Caption = "Simple Power Plus - " + function; dialog.Controls.Add(yesButton); dialog.Controls.Add(noButton); var result = dialog.Show(); return result == TaskDialogResult.Yes; } }