Event data for before an update step is processed.
Inheritance: System.EventArgs
示例#1
0
        void InstallPendingUpdate()
        {
            BeforeArgs bArgs = new BeforeArgs();

            if (BeforeInstalling != null)
            {
                BeforeInstalling(this, bArgs);
            }

            // if the update is cancelled postpone the update until later
            if (bArgs.Cancel)
            {
                if (ClosingForInstall && ClosingAborted != null)
                {
                    ClosingAborted(this, EventArgs.Empty);
                    ClosingForInstall = false;
                }
                return;
            }

            // send the client the arguments that need to run on success and failure
            if (ServiceName != null)
            {
                updateHelper.RestartInfo(ServiceName, AutoUpdaterInfo.AutoUpdateID, Arguments, true);
            }
            else
            {
                updateHelper.RestartInfo(Application.ExecutablePath, AutoUpdaterInfo.AutoUpdateID, Arguments, false);
            }
        }
示例#2
0
        void auBackend_BeforeChecking(object sender, BeforeArgs e)
        {
            // disable any scheduled checking
            tmrWaitBeforeCheck.Enabled = false;

            SetMenuText(translation.CancelCheckingMenu);

            if (BeforeChecking != null)
            {
                BeforeChecking(this, e);
            }

            if (e.Cancel)
            {
                // close wyUpdate
                auBackend.Cancel();
                return;
            }

            // show the working animation
            SetUpdateStepOn(UpdateStepOn.Checking);
            UpdateProcessing(false);

            // setup the context menu
            CreateMenu(MenuType.CheckingMenu);
        }
示例#3
0
        void auBackend_BeforeDownloading(object sender, BeforeArgs e)
        {
            // call this function from ownerForm's thread context
            if (sender != null)
            {
                ownerForm.Invoke(new BeforeHandler(auBackend_BeforeDownloading), new object[] { null, e });
                return;
            }

            if (BeforeDownloading != null)
            {
                BeforeDownloading(this, e);
            }

            if (e.Cancel)
            {
                return;
            }

            SetMenuText(translation.CancelUpdatingMenu);

            // if the control is hidden show it now (so the user can cancel the downloading if they want)
            // show the 'working' animation
            SetUpdateStepOn(UpdateStepOn.DownloadingUpdate);
            UpdateProcessing(true);

            CreateMenu(MenuType.CancelDownloading);
        }
示例#4
0
        void auBackend_BeforeExtracting(object sender, BeforeArgs e)
        {
            // call this function from ownerForm's thread context
            if (sender != null)
            {
                ownerForm.Invoke(new BeforeHandler(auBackend_BeforeExtracting), new object[] { null, e });
                return;
            }

            SetUpdateStepOn(UpdateStepOn.ExtractingUpdate);

            CreateMenu(MenuType.CancelExtracting);
        }
示例#5
0
        /// <summary>
        /// Check for updates forcefully -- returns true if the updating has begun. Use the "CheckingFailed", "UpdateAvailable", or "UpToDate" events for the result.
        /// </summary>
        /// <param name="recheck">Recheck with the servers regardless of cached updates, etc.</param>
        /// <returns>Returns true if checking has begun, false otherwise.</returns>
        public bool ForceCheckForUpdate(bool recheck)
        {
            if (AutoUpdaterInfo == null)
            {
                throw new FailedToInitializeException();
            }

            // if not already checking for updates then begin checking.
            if (UpdateStepOn == UpdateStepOn.Nothing || (recheck && UpdateStepOn == UpdateStepOn.UpdateAvailable))
            {
                BeforeArgs bArgs = new BeforeArgs();

                if (BeforeChecking != null)
                {
                    BeforeChecking(this, bArgs);
                }

                if (bArgs.Cancel)
                {
                    // close wyUpdate
                    updateHelper.Cancel();
                    return(false);
                }

                // show the working animation
                UpdateStepOn = UpdateStepOn.Checking;

                if (recheck)
                {
                    updateHelper.ForceRecheckForUpdate();
                }
                else
                {
                    updateHelper.CheckForUpdate();
                }

                return(true);
            }

            return(false);
        }
示例#6
0
        void ExtractUpdate()
        {
            BeforeArgs bArgs = new BeforeArgs();

            if (BeforeExtracting != null)
            {
                BeforeExtracting(this, bArgs);
            }

            if (bArgs.Cancel)
            {
                // close wyUpdate
                updateHelper.Cancel();
                return;
            }

            UpdateStepOn = UpdateStepOn.ExtractingUpdate;

            // extract the update
            updateHelper.BeginExtraction();
        }
示例#7
0
        void DownloadUpdate()
        {
            BeforeArgs bArgs = new BeforeArgs();

            if (BeforeDownloading != null)
            {
                BeforeDownloading(this, bArgs);
            }

            if (bArgs.Cancel)
            {
                // close wyUpdate
                updateHelper.Cancel();
                return;
            }

            // if the control is hidden show it now (so the user can cancel the downloading if they want)
            // show the 'working' animation
            UpdateStepOn = UpdateStepOn.DownloadingUpdate;

            updateHelper.DownloadUpdate();
        }
        void auBackend_BeforeInstalling(object sender, BeforeArgs e)
        {
            if (sender != null)
            {
                // call this function from ownerForm's thread context
                InvokeMyself(new BeforeHandler(auBackend_BeforeInstalling), new object[] {null, e});
                return;
            }

            if (BeforeInstalling != null)
                BeforeInstalling(this, e);
        }
        void DownloadUpdate()
        {
            BeforeArgs bArgs = new BeforeArgs();

            if (BeforeDownloading != null)
                BeforeDownloading(this, bArgs);

            if (bArgs.Cancel)
            {
                // close wyUpdate
                updateHelper.Cancel();
                return;
            }

            // if the control is hidden show it now (so the user can cancel the downloading if they want)
            // show the 'working' animation
            UpdateStepOn = UpdateStepOn.DownloadingUpdate;

            updateHelper.DownloadUpdate();
        }
        void auBackend_BeforeInstalling(object sender, BeforeArgs e)
        {
            // call this function from ownerForm's thread context
            if (sender != null)
            {
                ownerForm.Dispatcher.Invoke(DispatcherPriority.Normal, new BeforeHandler(auBackend_BeforeInstalling), null, e);
                return;
            }

            if (BeforeInstalling != null)
                BeforeInstalling(this, e);
        }
        void auBackend_BeforeExtracting(object sender, BeforeArgs e)
        {
            // call this function from ownerForm's thread context
            if (sender != null)
            {
                ownerForm.Dispatcher.Invoke(DispatcherPriority.Normal, new BeforeHandler(auBackend_BeforeExtracting), null, e);
                return;
            }

            SetUpdateStepOn(UpdateStepOn.ExtractingUpdate);

            CreateMenu(MenuType.CancelExtracting);
        }
        void auBackend_BeforeDownloading(object sender, BeforeArgs e)
        {
            // call this function from ownerForm's thread context
            if (sender != null)
            {
                ownerForm.Dispatcher.Invoke(DispatcherPriority.Normal, new BeforeHandler(auBackend_BeforeDownloading), null, e);
                return;
            }

            if (BeforeDownloading != null)
                BeforeDownloading(this, e);

            if (e.Cancel)
                return;

            SetMenuText(translation.CancelUpdatingMenu);

            // if the control is hidden show it now (so the user can cancel the downloading if they want)
            // show the 'working' animation
            SetUpdateStepOn(UpdateStepOn.DownloadingUpdate);
            UpdateProcessing(true);

            CreateMenu(MenuType.CancelDownloading);
        }
        void auBackend_BeforeChecking(object sender, BeforeArgs e)
        {
            // disable any scheduled checking
            tmrWaitBeforeCheck.Enabled = false;

            SetMenuText(translation.CancelCheckingMenu);

            if (BeforeChecking != null)
                BeforeChecking(this, e);

            if (e.Cancel)
            {
                // close wyUpdate
                auBackend.Cancel();
                return;
            }

            // show the working animation
            SetUpdateStepOn(UpdateStepOn.Checking);
            UpdateProcessing(false);

            // setup the context menu
            CreateMenu(MenuType.CheckingMenu);
        }
示例#14
0
 private void automaticUpdater_BeforeDownloading(object sender, BeforeArgs e)
 {
     checkForUpdatesButtonItem.Text = automaticUpdater.Translation.CancelUpdatingMenu;
 }
        void InstallPendingUpdate()
        {
            BeforeArgs bArgs = new BeforeArgs();

            if (BeforeInstalling != null)
                BeforeInstalling(this, bArgs);

            // if the update is cancelled postpone the update until later
            if (bArgs.Cancel)
            {
                if (ClosingForInstall && ClosingAborted != null)
                {
                    ClosingAborted(this, EventArgs.Empty);
                    ClosingForInstall = false;
                }
                return;
            }

            // send the client the arguments that need to run on success and failure
            if (ServiceName != null)
                updateHelper.RestartInfo(ServiceName, AutoUpdaterInfo.AutoUpdateID, Arguments, true);
            else
                updateHelper.RestartInfo(Application.ExecutablePath, AutoUpdaterInfo.AutoUpdateID, Arguments, false);
        }
        /// <summary>
        /// Check for updates forcefully.
        /// </summary>
        /// <param name="recheck">Recheck with the servers regardless of cached updates, etc.</param>
        /// <returns>Returns true if checking has begun, false otherwise.</returns>
        public bool ForceCheckForUpdate(bool recheck)
        {
            if (AutoUpdaterInfo == null)
                throw new FailedToInitializeException();

            // if not already checking for updates then begin checking.
            if (UpdateStepOn == UpdateStepOn.Nothing || (recheck && UpdateStepOn == UpdateStepOn.UpdateAvailable))
            {
                BeforeArgs bArgs = new BeforeArgs();

                if (BeforeChecking != null)
                    BeforeChecking(this, bArgs);

                if (bArgs.Cancel)
                {
                    // close wyUpdate
                    updateHelper.Cancel();
                    return false;
                }

                // show the working animation
                UpdateStepOn = UpdateStepOn.Checking;

                if (recheck)
                    updateHelper.ForceRecheckForUpdate();
                else
                    updateHelper.CheckForUpdate();

                return true;
            }

            return false;
        }
示例#17
0
 /// <summary>
 /// Handler method that's called when <see cref="MainForm.AutomaticUpdater"/> starts downloading an update.
 /// </summary>
 /// <param name="sender">Object from which this event originated, <see cref="MainForm.AutomaticUpdater"/> in this case.</param>
 /// <param name="e">Arguments associated with this event.</param>
 void AutomaticUpdater_BeforeDownloading(object sender, BeforeArgs e)
 {
     _statusLabel.Text = "Downloading updates...";
 }
        void ExtractUpdate()
        {
            BeforeArgs bArgs = new BeforeArgs();

            if (BeforeExtracting != null)
                BeforeExtracting(this, bArgs);

            if (bArgs.Cancel)
            {
                // close wyUpdate
                updateHelper.Cancel();
                return;
            }

            UpdateStepOn = UpdateStepOn.ExtractingUpdate;

            // extract the update
            updateHelper.BeginExtraction();
        }
        void auBackend_BeforeExtracting(object sender, BeforeArgs e)
        {
            if (sender != null)
            {
                // call this function from ownerForm's thread context
                InvokeMyself(new BeforeHandler(auBackend_BeforeExtracting), new object[] {null, e});
                return;
            }

            SetUpdateStepOn(UpdateStepOn.ExtractingUpdate);

            CreateMenu(MenuType.CancelExtracting);
        }