Exemple #1
0
 public override void ProcessInput(object input, out PaintDotNet.Updates.State newState)
 {
     if (input.Equals(PrivateInput.GoToExtracting))
     {
         newState = new ExtractingState(this.zipTempName, this.downloadMe);
     }
     else if (input.Equals(PrivateInput.GoToError))
     {
         string str;
         if (this.exception is WebException)
         {
             str = UpdatesState.WebExceptionToErrorMessage((WebException)this.exception);
         }
         else
         {
             str = PdnResources.GetString("Updates.DownloadingState.GenericError");
         }
         newState = new ErrorState(this.exception, str);
     }
     else
     {
         if (!input.Equals(PrivateInput.GoToAborted))
         {
             throw new ArgumentException();
         }
         newState = new AbortedState();
     }
 }
Exemple #2
0
 public override void ProcessInput(object input, out PaintDotNet.Updates.State newState)
 {
     if (input.Equals(PrivateInput.GoToUpdateAvailable))
     {
         newState = new UpdateAvailableState(this.manifest.VersionInfos[this.latestVersionIndex]);
     }
     else if (input.Equals(PrivateInput.GoToError))
     {
         string str;
         if (this.exception is WebException)
         {
             str = UpdatesState.WebExceptionToErrorMessage((WebException)this.exception);
         }
         else
         {
             str = PdnResources.GetString("Updates.CheckingState.GenericError");
         }
         newState = new ErrorState(this.exception, str);
     }
     else if (input.Equals(PrivateInput.GoToDone))
     {
         newState = new DoneState();
     }
     else
     {
         if (!input.Equals(PrivateInput.GoToAborted))
         {
             throw new ArgumentException();
         }
         newState = new AbortedState();
     }
 }
 public override void ProcessInput(object input, out PaintDotNet.Updates.State newState)
 {
     if (!input.Equals(UpdatesAction.Continue))
     {
         throw new ArgumentException();
     }
     newState = new CheckingState();
 }
Exemple #4
0
 public StateMachine(PaintDotNet.Updates.State initialState, IEnumerable inputAlphabet)
 {
     this.initialState  = initialState;
     this.inputAlphabet = new ArrayList();
     foreach (object obj2 in inputAlphabet)
     {
         this.inputAlphabet.Add(obj2);
     }
 }
Exemple #5
0
 private void OnStateBegin(PaintDotNet.Updates.State state)
 {
     if ((this.syncContext != null) && this.syncContext.InvokeRequired)
     {
         object[] args = new object[] { state };
         this.syncContext.BeginInvoke(new Action <PaintDotNet.Updates.State>(this.OnStateBegin), args);
     }
     else
     {
         this.StateBegin.Raise <PaintDotNet.Updates.State>(this, state);
     }
 }
Exemple #6
0
 public override void ProcessInput(object input, out PaintDotNet.Updates.State newState)
 {
     if (input.Equals(UpdatesAction.Continue))
     {
         newState = new InstallingState(this.installerPath);
     }
     else
     {
         if (!input.Equals(UpdatesAction.Cancel))
         {
             throw new ArgumentException();
         }
         newState = new DoneState();
     }
 }
Exemple #7
0
 private void SetCurrentState(PaintDotNet.Updates.State newState)
 {
     if ((this.currentState != null) && this.currentState.IsFinalState)
     {
         ExceptionUtil.ThrowInvalidOperationException("state machine is already in a final state");
     }
     this.currentState = newState;
     this.currentState.StateMachine = this;
     this.OnNewState(this.currentState);
     this.currentState.OnEnteredState();
     if (!this.currentState.IsFinalState)
     {
         this.ProcessQueuedInput();
     }
 }
Exemple #8
0
 public void Abort()
 {
     if (!this.disposed)
     {
         this.pleaseAbort = true;
         PaintDotNet.Updates.State currentState = this.stateMachine.CurrentState;
         if ((currentState != null) && currentState.CanAbort)
         {
             this.stateMachine.CurrentState.Abort();
         }
         this.stateMachineNotBusy.WaitOne();
         this.inputAvailable.Set();
         this.stateMachineThread.Join();
         if (this.threadException != null)
         {
             throw new WorkerThreadException("State machine thread threw an exception", this.threadException);
         }
     }
 }
Exemple #9
0
 public override void ProcessInput(object input, out PaintDotNet.Updates.State newState)
 {
     if (input.Equals(PrivateInput.GoToReadyToInstall))
     {
         newState = new ReadyToInstallState(this.installerPath, this.newVersionInfo);
     }
     else if (input.Equals(PrivateInput.GoToError))
     {
         string errorMessage = PdnResources.GetString("Updates.ExtractingState.GenericError");
         newState = new ErrorState(this.exception, errorMessage);
     }
     else
     {
         if (!input.Equals(PrivateInput.GoToAborted))
         {
             throw new ArgumentException();
         }
         newState = new AbortedState();
     }
 }
Exemple #10
0
 public abstract void ProcessInput(object input, out PaintDotNet.Updates.State newState);
Exemple #11
0
 public override void ProcessInput(object input, out PaintDotNet.Updates.State newState)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Exemple #12
0
 private void OnNewState(PaintDotNet.Updates.State newState)
 {
     this.NewState.Raise <PaintDotNet.Updates.State>(this, newState);
 }