protected virtual void OnStateChanged(IState <AuthState> state, StateEventKind eventKind)
 {
     if (eventKind == StateEventKind.Updated)
     {
         NotifyAuthenticationStateChanged(Task.FromResult((AuthenticationState)state.LastValue));
     }
 }
Example #2
0
 public static void RemoveEventHandler <T>(this IState <T> state,
                                           StateEventKind eventFilter, Action <IState <T>, StateEventKind> handler)
 {
     if ((eventFilter & StateEventKind.Invalidated) != 0)
     {
         state.Invalidated -= handler;
     }
     if ((eventFilter & StateEventKind.Updating) != 0)
     {
         state.Updating -= handler;
     }
     if ((eventFilter & StateEventKind.Updated) != 0)
     {
         state.Updated -= handler;
     }
 }
Example #3
0
        // Add/RemoveEventHandler

        public static void AddEventHandler(this IState state,
                                           StateEventKind eventFilter, Action <IState, StateEventKind> handler)
        {
            if ((eventFilter & StateEventKind.Invalidated) != 0)
            {
                state.Invalidated += handler;
            }
            if ((eventFilter & StateEventKind.Updating) != 0)
            {
                state.Updating += handler;
            }
            if ((eventFilter & StateEventKind.Updated) != 0)
            {
                state.Updated += handler;
            }
        }
Example #4
0
 protected virtual void OnStateChanged(IState <AuthState> state, StateEventKind eventKind)
 {
     using var _ = ExecutionContextEx.SuppressFlow();
     Task.Run(() =>
              NotifyAuthenticationStateChanged(Task.FromResult((AuthenticationState)state.LastValue))).Ignore();
 }