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(); } }
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(); }
public StateMachine(PaintDotNet.Updates.State initialState, IEnumerable inputAlphabet) { this.initialState = initialState; this.inputAlphabet = new ArrayList(); foreach (object obj2 in inputAlphabet) { this.inputAlphabet.Add(obj2); } }
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); } }
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(); } }
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(); } }
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); } } }
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(); } }
public abstract void ProcessInput(object input, out PaintDotNet.Updates.State newState);
public override void ProcessInput(object input, out PaintDotNet.Updates.State newState) { throw new Exception("The method or operation is not implemented."); }
private void OnNewState(PaintDotNet.Updates.State newState) { this.NewState.Raise <PaintDotNet.Updates.State>(this, newState); }