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