private void MenuVersionCheck_Execute(object sender, EventArgs e) { WinWrapper owner = new WinWrapper(this); try { ProgressDialog progressDialog = new ProgressDialog(); progressDialog.DoWork += new DoWorkEventHandler(this.MenuVersionCheckDoWork); progressDialog.Text = "Version Check ..."; progressDialog.ProgressBar.Style = ProgressBarStyle.Marquee; progressDialog.AutoClose = true; progressDialog.ShowDialog(owner); if (progressDialog.Result.Exception != null) { throw progressDialog.Result.Exception; } if (!progressDialog.Result.IsCancelled) { VersionChecker versionChecker = (VersionChecker)progressDialog.Result.Value; if (versionChecker.OnlineVersion > versionChecker.LocalVersion) { this.DisplayVersionCheckerResult(versionChecker); } else { MessageBox.Show(owner, "Your local version is up to date.", "Version Check", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } } catch (Exception ex) { MessageBox.Show(owner, "Exception occured while checking for a new version:\n\n" + ex.ToString(), "Check for new version.", MessageBoxButtons.OK, MessageBoxIcon.Hand); } }
private void DisplayAddinSettings(object sender, EventArgs e) { AddInSettingsForm addInSettingsForm = new AddInSettingsForm(); WinWrapper owner = new WinWrapper(this); addInSettingsForm.Connect = this; addInSettingsForm.ShowDialog(owner); }
/// <summary> /// Displays the addin settings. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void DisplayAddinSettings(object sender, EventArgs e) { AddInSettingsForm dlg = new AddInSettingsForm(); WinWrapper w = new WinWrapper(this); dlg.Connect = this; dlg.ShowDialog(w); }
private void DisplayVersionCheckerResult(VersionChecker vc) { string message = "There's a new version available of this addin.\n\n" + "Local version: " + vc.LocalVersion.ToString() + "\n" + "Online version: " + vc.OnlineVersion.ToString() + "\n\n" + "Would you like to open the project page on CodePlex to review the changes?"; WinWrapper w = new WinWrapper(this); if (MessageBox.Show(w, message, "BuildVersionIncrement", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { System.Diagnostics.Process.Start(vc.ProjectHomePage); } }
private void DisplayVersionCheckerResult(VersionChecker vc) { string text = string.Concat(new string[] { "There's a new version available of this addin.\n\nLocal version: ", vc.LocalVersion.ToString(), "\nOnline version: ", vc.OnlineVersion.ToString(), "\n\nWould you like to open the project page on CodePlex to review the changes?" }); WinWrapper owner = new WinWrapper(this); if (MessageBox.Show(owner, text, "BuildVersionIncrement", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { System.Diagnostics.Process.Start(vc.ProjectHomePage); } }
void MenuVersionCheck_Execute(object sender, EventArgs e) { WinWrapper w = new WinWrapper(this); try { ProgressDialog dlg = new ProgressDialog(); dlg.DoWork += new System.ComponentModel.DoWorkEventHandler(MenuVersionCheckDoWork); dlg.Text = "Version Check ..."; dlg.ProgressBar.Style = ProgressBarStyle.Marquee; dlg.AutoClose = true; dlg.ShowDialog(w); if (dlg.Result.Exception != null) { throw (dlg.Result.Exception); } else if (!dlg.Result.IsCancelled) { VersionChecker vc = (VersionChecker)dlg.Result.Value; if (vc.OnlineVersion > vc.LocalVersion) { DisplayVersionCheckerResult(vc); } else { MessageBox.Show(w, "Your local version is up to date.", "Version Check", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception ex) { MessageBox.Show(w, "Exception occured while checking for a new version:\n\n" + ex.ToString(), "Check for new version.", MessageBoxButtons.OK, MessageBoxIcon.Error); } }