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