示例#1
0
 public virtual Task FireAsync <TArgument>(ParameterizedTrigger <TTrigger, TArgument> parameterizedTrigger,
                                           TArgument argument)
 {
     return(!IsEnabled
         ? TaskHelpers.CompletedTask
         : AwaitableExecutionHelper.FireCoreAsync(parameterizedTrigger, argument, this));
 }
示例#2
0
 public override async Task FireAsync(TTrigger trigger)
 {
     if (m_monitor.TryEnter())
     {
         try { await base.FireAsync(trigger).ConfigureAwait(false); }
         finally { m_monitor.Exit(); }
     }
     else
     {
         if (IsEnabled)
         {
             AwaitableExecutionHelper.ThrowInTransition();
         }
     }
 }
示例#3
0
 public override async Task FireAsync <TArgument>(ParameterizedTrigger <TTrigger, TArgument> parameterizedTrigger,
                                                  TArgument argument)
 {
     if (m_monitor.TryEnter())
     {
         try { await base.FireAsync(parameterizedTrigger, argument).ConfigureAwait(false); }
         finally { m_monitor.Exit(); }
     }
     else
     {
         if (IsEnabled)
         {
             AwaitableExecutionHelper.ThrowInTransition();
         }
     }
 }
示例#4
0
 public override async Task MoveToStateAsync(TState state,
                                             StateTransitionOption option = StateTransitionOption.Default)
 {
     if (m_monitor.TryEnter())
     {
         try { await base.MoveToStateAsync(state, option).ConfigureAwait(false); }
         finally { m_monitor.Exit(); }
     }
     else
     {
         if (IsEnabled)
         {
             AwaitableExecutionHelper.ThrowInTransition();
         }
     }
 }
示例#5
0
 public virtual Task FireAsync(TTrigger trigger)
 {
     return(!IsEnabled ? TaskHelpers.CompletedTask : AwaitableExecutionHelper.FireCoreAsync(trigger, this));
 }
示例#6
0
 public virtual Task MoveToStateAsync(TState state, StateTransitionOption option = StateTransitionOption.Default)
 {
     return(!IsEnabled
         ? TaskHelpers.CompletedTask
         : AwaitableExecutionHelper.MoveToStateCoreAsync(state, option, this));
 }