/// <summary> /// Informs attached handlers about a command's exit. Can be positive or negative. /// </summary> /// <param name="state">The state.</param> private void SynchronizedCompleted(CompletedState state) { if (state.Aborted) { this.CommandManager.CommandAborted(state); //return; } if (this.CompletedHandler == null) { this.CallCompletedFallbackHandler(state); return; } if (this.CommandManager == null) { CompletedHandler(state); return; } this.CommandManager.MarshallBack(() => this.CompletedHandler(state)); }
/// <summary> /// A synchronized completed call to marshall back to the calling thread. /// </summary> /// <param name="state">The state.</param> public void Completed(CompletedState state) { if (completedAlreadyCalled) { return; } completedAlreadyCalled = true; this.SynchronizedCompleted(state); }
private void CallCompletedFallbackHandler(CompletedState state) { if (state.Error != null) { throw state.Error; } }
/// <summary> /// To be called when a command was actively aborted (not via Exception). /// </summary> /// <param name="state">The state.</param> public void CommandAborted(CompletedState state) { var found = this.UndoStack.Any(command => command.Commands.Any(abstractCommand => abstractCommand == state.Command as AbstractCommand)); if (found) { // loose the aborted command this.UndoStack.Pop(); } }