private void CheckVersion(VersionInfo localVersionInfo, string remoteFile) #endif { Uri webFile = new Uri(remoteFile); string localFile = System.IO.Path.GetTempFileName(); if (this.DownloadFile(webFile, localFile)) { string message = string.Empty; this.versionInfoManager.Load(localFile); this.versionInfo = this.versionInfoManager.VersionInformation; bool newVersion = false; if (localVersionInfo.AssemblyVersion != this.versionInfo.AssemblyVersion) { newVersion = true; } if (this.VersionChecked != null) { NewVersionEventArgs e = new NewVersionEventArgs(); e.NewVersion = newVersion; e.VersionInformation = this.versionInfo; this.VersionChecked(this, e); } } File.Delete(localFile); }
/// <summary> /// Version Checker Handler for version checks. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Envman.VersionManager.NewVersionEventArgs"/> instance containing the event data.</param> private void VersionChecker_NewVersionChecked( object sender, NewVersionEventArgs e) { string msg = string.Empty; if (e.NewVersion) { this.versionInfo = e.VersionInformation; msg = "New version " + VersionInfo.VersionFormatter( this.versionInfo.AssemblyVersion) + " released"; this.TsmiNewVersionInfo.Text = msg; this.TsmiNewVersionInfo.Visible = true; if (this.showFrmVersionInfo) { FrmVersionInfo versionInfoForm = new FrmVersionInfo(); versionInfoForm.Icon = Properties.Resources.EnvManICO; versionInfoForm.Message = msg; if (versionInfoForm.ShowDialog() == DialogResult.OK) { this.TsmiClick(this.TsmiNewVersionInfo, null); } } } else { msg = "You have the current version."; if (this.showFrmVersionInfo) { MessageBox.Show( msg, "EnvMan", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
/// <summary> /// Handles the VersionChecked event of the versionChecker control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="SFC.EnvMan.VersionManager.NewVersionEventArgs"/> instance containing the event data.</param> private void VersionChecker_VersionChecked( object sender, NewVersionEventArgs e) { }