示例#1
0
 protected override void EnterStateInternal(WuProcessState oldState)
 {
     lock (JobLock)
     {
         var callbackReceiver = new CallbackReceiver(this);
         Job = new WuApiSearchJobAdapter(_searcher.BeginSearch("IsInstalled=0 and Type='Software' and IsHidden=0", callbackReceiver, null));
     }
 }
 protected override void EnterStateInternal(WuProcessState oldState)
 {
     lock (JobLock)
     {
         _uDownloader.Updates = (UpdateCollection)_updates;
         var callbackReceiver = new CallbackReceiver(this);
         Job       = new WuApiDownloadJobAdapter(_uDownloader.BeginDownload(callbackReceiver, callbackReceiver, null));
         StateDesc = $"Starting download of {_updates.Count} update(s)";
     }
 }
        public override void EnterState(WuProcessState oldState)
        {
            StateDesc = $"Restart delayed: {Delay} sec. The restart may fail, if the service has not the necessary privilege.";

            var psi = new ProcessStartInfo("shutdown", $"/r /t {Delay}");

            psi.CreateNoWindow  = true;
            psi.UseShellExecute = false;
            Process.Start(psi);
        }
 public override void EnterState(WuProcessState oldState)
 {
     if (oldState != null && oldState.StateId == WuStateId.Installing)
     {
         StateDesc = "To complete the installation of updates, a reboot is required.";
     }
     if (oldState == null)
     {
         StateDesc = "Before updates can be installed, a reboot is required.";
     }
 }
        public override void EnterState(WuProcessState oldState)
        {
            lock (JobLock)
            {
                if (IsDisposed)
                {
                    throw new ObjectDisposedException(this.GetType().FullName);
                }
                if (IsRunning)
                {
                    return;
                }

                EnterStateInternal(oldState);
                StartTimeoutTimer();
            }
        }
        protected override void EnterStateInternal(WuProcessState oldState)
        {
            lock (JobLock)
            {
                if (_uInstaller.IsBusy)
                {
                    throw new InvalidOperationException("Update installer is busy.");
                }
                if (_uInstaller.RebootRequiredBeforeInstallation)
                {
                    throw new InvalidOperationException("A reboot is required before update installation can start.");
                }

                _uInstaller.Updates = (UpdateCollection)_updates;
                var callbackReceiver = new CallbackReceiver(this);
                Job       = new WuApiInstallJobAdapter(_uInstaller.BeginInstall(callbackReceiver, callbackReceiver, null));
                StateDesc = $"Starting installation of {_updates.Count} update(s)";
            }
        }
示例#7
0
 public override void EnterState(WuProcessState oldState)
 {
 }
示例#8
0
 public override void EnterState(WuProcessState oldState) => StateDesc = Updates.OfType <IUpdate>().Count() + " update(s) installed";
示例#9
0
 public override void EnterState(WuProcessState oldState) => StateDesc = Updates.OfType <IUpdate>().Count(u => u.IsDownloaded) + " update(s) downloaded";
示例#10
0
 public override void EnterState(WuProcessState oldState) => StateDesc = Updates.OfType <IUpdate>().Count(u => !u.IsInstalled) + " update(s) found";
示例#11
0
 /// <summary>
 /// Called when this state becomes the current state.
 /// </summary>
 /// <param name="oldState">thr previous state, can be null, if its the first state</param>
 public abstract void EnterState(WuProcessState oldState);
 protected abstract void EnterStateInternal(WuProcessState oldState);