示例#1
0
        /// <summary>Performs an action based on the <c>UpdateAction</c>.</summary>
        /// <param name="sender">The object that called the event.</param>
        /// <param name="e">The <c>System.Windows.RoutedEventArgs</c> instance containing the event data.</param>
        void PerformAction(object sender, RoutedEventArgs e)
        {
            switch (Core.Instance.UpdateAction)
            {
            case UpdateAction.DownloadCompleted:
            case UpdateAction.UpdatesFound:
                DownloadInstallUpdates();
                break;

            case UpdateAction.Downloading:
            case UpdateAction.Installing:
                if (WcfService.AbortInstall())
                {
                    Core.Instance.UpdateAction = UpdateAction.Canceled;
                }

                break;

            case UpdateAction.CheckForUpdates:
            case UpdateAction.Canceled:
            case UpdateAction.ErrorOccurred:
                Core.Instance.UpdateAction = UpdateAction.CheckingForUpdates;
                Core.CheckForUpdates();
                break;

            case UpdateAction.RebootNeeded:
                Utilities.StartProcess(@"shutdown.exe", "-r -t 00");
                break;
            }
        }