Ejemplo n.º 1
0
        private void OnUpgrade(SyncStatus status)
        {
            IConfigurator configurator = GetCompanyConfigurator();

            // Check New Updates
            int codeVersion = this.CompanyInfo.CodeVersion;

            int[] availableUpdates = configurator.ListUpdates();

            bool bDetectNewUpdate = false;

            foreach (int availableUpdate in availableUpdates)
            {
                if (codeVersion < availableUpdate)
                {
                    bDetectNewUpdate = true;
                    break;
                }
            }

            if (bDetectNewUpdate)
            {
                // Show Select New Update
                UpdateCompanyForm form = new UpdateCompanyForm(configurator, this.CompanyInfo);

                if (DialogResult.Retry == this.SnapIn.Console.ShowDialog(form))
                {
                    Process currentProcess = Process.GetCurrentProcess();

                    // Start a new Process
                    ProcessStartInfo start = configurator.BuildUpdateCommandForCommonComponents(form.GetUpdateId(), currentProcess.Id);

                    // Run Update Common Components
                    Process.Start(start);

                    // Close current process
                    currentProcess.CloseMainWindow();
                }
            }
            else
            {
                MessageBoxParameters msgBox = new MessageBoxParameters();
                msgBox.Icon    = MessageBoxIcon.Information;
                msgBox.Caption = SnapInResources.SoftwareUpdate_Caption;
                msgBox.Buttons = MessageBoxButtons.OK;
                msgBox.Text    = SnapInResources.SoftwareUpdateMsg_UnableFind;

                this.SnapIn.Console.ShowDialog(msgBox);
            }

            // TODO: Check Common Components Update
            //Process.GetCurrentProcess().CloseMainWindow();
        }
Ejemplo n.º 2
0
        private void OnUpgrade(SyncStatus status)
        {
            IConfigurator configurator = GetCompanyConfigurator();

            // Check New Updates
            int codeVersion = this.CompanyInfo.CodeVersion;
            int[] availableUpdates = configurator.ListUpdates();

            bool bDetectNewUpdate = false;

            foreach (int availableUpdate in availableUpdates)
            {
                if (codeVersion < availableUpdate)
                {
                    bDetectNewUpdate = true;
                    break;
                }
            }

            if (bDetectNewUpdate)
            {
                // Show Select New Update
                UpdateCompanyForm form = new UpdateCompanyForm(configurator, this.CompanyInfo);

                if (DialogResult.Retry == this.SnapIn.Console.ShowDialog(form))
                {
                    Process currentProcess = Process.GetCurrentProcess();

                    // Start a new Process
                    ProcessStartInfo start = configurator.BuildUpdateCommandForCommonComponents(form.GetUpdateId(), currentProcess.Id);

                    // Run Update Common Components
                    Process.Start(start);

                    // Close current process
                    currentProcess.CloseMainWindow();
                }
            }
            else
            {
                MessageBoxParameters msgBox = new MessageBoxParameters();
                msgBox.Icon = MessageBoxIcon.Information;
                msgBox.Caption = SnapInResources.SoftwareUpdate_Caption;
                msgBox.Buttons = MessageBoxButtons.OK;
                msgBox.Text = SnapInResources.SoftwareUpdateMsg_UnableFind;

                this.SnapIn.Console.ShowDialog(msgBox);
            }

            // TODO: Check Common Components Update
            //Process.GetCurrentProcess().CloseMainWindow();
        }