Esempio n. 1
0
 private void checkForUpdatesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         this.Cursor = Cursors.WaitCursor;
         if (this.NewVersionBGWorker.IsBusy)
         {
             string msg = "The Version Checker is currently busy. Please try again in a moment.";
             MessageBox.Show(msg);
         }
         else
         {
             if (NewVersionChecker.CheckLatestVerisonNumber(NewVersionChecker.ProductType.TCF_S))
             {
                 //Found a VersionNumber, now check if it's newer
                 Assembly asm = Assembly.GetExecutingAssembly();
                 AssemblyName asmName = asm.GetName();
                 NewVersionChecker.CompareToLatestVersion(asmName.Version);
                 if (NewVersionChecker.NewerVersionAvailable)
                 {
                     NewVersionFrm nvf = new NewVersionFrm(asmName.Version.ToString(),
                         NewVersionChecker.NewerVersionNumber, NewVersionChecker.NewerVersionURL);
                     nvf.ShowDialog();
                 }
                 else MessageBox.Show("Congratulations! You have the most recent version of this program!\n" +
                     "This version number is " + asmName.Version.ToString(), "No Update Needed! - V" +
                     asmName.Version.ToString());
             }
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Unable to connect to the server www.optecinc.com",
             "Version Information Unavailable");
     }
     finally { this.Cursor = Cursors.Default; }
 }
Esempio n. 2
0
 private void NewVersionBGWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         //Check For A newer verison of the driver
         EventLogger.LogMessage("Checking for application updates", TraceLevel.Info);
         if (NewVersionChecker.CheckLatestVerisonNumber(NewVersionChecker.ProductType.TCF_S))
         {
             //Found a VersionNumber, now check if it's newer
             Assembly asm = Assembly.GetExecutingAssembly();
             AssemblyName asmName = asm.GetName();
             NewVersionChecker.CompareToLatestVersion(asmName.Version);
             if (NewVersionChecker.NewerVersionAvailable)
             {
                 EventLogger.LogMessage("This application is NOT the most recent version available", TraceLevel.Warning);
                 NewVersionFrm nvf = new NewVersionFrm(asmName.Version.ToString(),
                     NewVersionChecker.NewerVersionNumber, NewVersionChecker.NewerVersionURL);
                 nvf.ShowDialog();
             }
             else
             {
                 EventLogger.LogMessage("This application is the most recent version available", TraceLevel.Info);
             }
         }
     }
     catch (Exception ex)
     {
         EventLogger.LogMessage(ex);
     } // Just ignore all errors. They mean the computer isn't connected to internet.
 }