示例#1
0
        private static void GetPatchUpdateFiles()
        {
            int setupNumber              = 1;
            int patchNumber              = 1;
            int maxBuildNumber           = 1;
            IList <PatchFile> patchFiles = null;

            // Copy Config.xml file to application path.
            AppPatchUpdates.DownloadConfigFile();
            AppPatchUpdates.GetPatchReleaseInfo(out setupNumber, out patchNumber);

            try
            {
                patchFiles = AppPatchUpdates.GetPublishedFiles(setupNumber, patchNumber, out maxBuildNumber);
            }
            catch (Exception ex)
            {
                AppPatchUpdates.WriteErrorLog(ex.ToString());
            }

            if (patchFiles != null && patchFiles.Count > 0)
            {
                frmPatchUpdates wciUpdates = new frmPatchUpdates(patchFiles);
                wciUpdates.Show();

                AppPatchUpdates.UpdatePatchReleaseInfo(setupNumber, maxBuildNumber);
            }

            //Start WCI application
            StartMainApplication();
        }
示例#2
0
 /// <summary>
 /// To Start main application - IRN.exe
 /// </summary>
 private static void StartMainApplication()
 {
     try
     {
         string mainAppPath = Path.Combine(Application.StartupPath, "ChemInform.exe");
         Process.Start(mainAppPath);
     }
     catch (Exception ex)
     {
         AppPatchUpdates.WriteErrorLog(ex.ToString());
     }
 }
示例#3
0
        private void RunPatchUpdates()
        {
            CheckForIllegalCrossThreadCalls = false;

            this.Refresh();

            this.Visible = true;
            this.Cursor  = Cursors.WaitCursor;

            try
            {
                if (this.PatchFiles != null && this.PatchFiles.Count > 0)
                {
                    lblPatchUpdateStatus.Text = "Found new updates ...";
                    Application.DoEvents();

                    System.Threading.Thread.Sleep(500);

                    lblDownloadStatus.Text = "Downloading files ...";
                    Application.DoEvents();

                    AppPatchUpdates.Download(this.PatchFiles);

                    lblDownloadStatus.Text = "Download completed.";
                    Application.DoEvents();
                    System.Threading.Thread.Sleep(200);
                }
            }
            catch (Exception ex)
            {
                AppPatchUpdates.WriteErrorLog(ex.ToString());
                lblPatchUpdateStatus.Text = "Failed to download patch files.";
                lblPatchUpdateStatus.Refresh();
                Thread.Sleep(500);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }