private void FormAbout_Load(object sender, EventArgs e) { this.GetAssemblyAttributes (); this.Text = _assemblyTitle; ApplicationVersion appVersion = new ApplicationVersion(_assemblyVersion); labelVersion.Text += appVersion.ToString(); lnkCompanyName.Text = _assemblyCompany; labelCopyright.Text = _assemblyCopyright; }
public static int Comparison(ApplicationVersion version1, ApplicationVersion version2) { if (version1.PrimaryVersion < version2.PrimaryVersion || (version1.PrimaryVersion == version2.PrimaryVersion && version1.SecondaryVersion < version2.SecondaryVersion) || (version1.PrimaryVersion == version2.PrimaryVersion && version1.SecondaryVersion == version2.SecondaryVersion && version1.BuildNr < version2.BuildNr)) { return(-1); } else if (version1.PrimaryVersion == version2.PrimaryVersion && version1.SecondaryVersion == version2.SecondaryVersion && version1.BuildNr == version2.BuildNr) { return(0); } else if (version1.PrimaryVersion > version2.PrimaryVersion || (version1.PrimaryVersion == version2.PrimaryVersion && version1.SecondaryVersion > version2.SecondaryVersion) || (version1.PrimaryVersion == version2.PrimaryVersion && version1.SecondaryVersion == version2.SecondaryVersion && version1.BuildNr > version2.BuildNr)) { return(1); } return(0); }
// Callback method must have the same signature as the // AsyncCallback delegate. private void CallbackCheckForNewMyZillaVersion(IAsyncResult ar) { // Retrieve the delegate. AsyncCheckForNewMyZillaVersion dlgt = (AsyncCheckForNewMyZillaVersion)ar.AsyncState; // Call EndInvoke to retrieve the results. object[] result = dlgt.EndInvoke(ar); string publishedMyZillaVersion = result[0] as string; bool forceCheck = (result[1] == null ? false : (bool)result[1]); Form owner = result[2] as Form; if (!String.IsNullOrEmpty(publishedMyZillaVersion)) { ApplicationVersion publishedVersion = new ApplicationVersion(publishedMyZillaVersion); ApplicationVersion applicationInstanceVersion = new ApplicationVersion(Application.ProductVersion); MyZillaSettingsDataSet _appSettings = MyZillaSettingsDataSet.CreateInstance(Utils.UserAppDataPath); MyZillaSettingsDataSet.GlobalSettingsRow settings = _appSettings.GetGlobalSettings(); if (forceCheck || (publishedVersion > (new ApplicationVersion(settings.LastMyZillaVersion)))) { if (publishedVersion > applicationInstanceVersion) { FormNewVersion newVersion = new FormNewVersion(publishedVersion.ToString()); if (this.InvokeRequired) { this.BeginInvoke(new MethodInvoker(delegate() { newVersion.ShowDialog(this); })); } } else { if (forceCheck) { if (owner.InvokeRequired) { this.BeginInvoke(new MethodInvoker(delegate() { MessageBox.Show(owner, "No update is available!", "MyZilla", MessageBoxButtons.OK, MessageBoxIcon.Information); })); } } } } } }
public static bool operator ==(ApplicationVersion version1, ApplicationVersion version2) { return(ApplicationVersion.Comparison(version1, version2) == 0); }
public static int Comparison(ApplicationVersion version1, ApplicationVersion version2) { if (version1.PrimaryVersion < version2.PrimaryVersion || (version1.PrimaryVersion == version2.PrimaryVersion && version1.SecondaryVersion < version2.SecondaryVersion) || (version1.PrimaryVersion == version2.PrimaryVersion && version1.SecondaryVersion == version2.SecondaryVersion && version1.BuildNr < version2.BuildNr)) return -1; else if (version1.PrimaryVersion == version2.PrimaryVersion && version1.SecondaryVersion == version2.SecondaryVersion && version1.BuildNr == version2.BuildNr) return 0; else if (version1.PrimaryVersion > version2.PrimaryVersion || (version1.PrimaryVersion == version2.PrimaryVersion && version1.SecondaryVersion > version2.SecondaryVersion) || (version1.PrimaryVersion == version2.PrimaryVersion && version1.SecondaryVersion == version2.SecondaryVersion && version1.BuildNr > version2.BuildNr)) return 1; return 0; }