Пример #1
0
        /// <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));
        }
Пример #2
0
        /// <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));
        }
Пример #3
0
        /// <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);
        }
Пример #4
0
 private void CallCompletedFallbackHandler(CompletedState state)
 {
     if (state.Error != null)
     {
         throw state.Error;
     }
 }
Пример #5
0
 /// <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();
     }
 }