public void HandleServerAction(IDispatcherAction action) { if (action == null) throw new ArgumentNullException("action"); Dispatch(new DispatcherMessage(MessageSourceOptions.Server, action)); }
public void HandleViewAction(IDispatcherAction action) { if (action == null) throw new ArgumentNullException("action"); _dispatcher(new DispatcherMessage(MessageSourceOptions.View, action)); }
public DispatcherActionMatcher(IDispatcherAction action) { if (action == null) { throw new ArgumentNullException(nameof(action)); } _action = action; }
public void HandleServerAction(IDispatcherAction action) { if (action == null) { throw new ArgumentNullException("action"); } _dispatcher(null, new DispatcherMessage(MessageSourceOptions.Server, action)); }
public void HandleViewAction(IDispatcherAction action) { if (action == null) { throw new ArgumentNullException("action"); } Dispatch(new DispatcherMessage(MessageSourceOptions.View, action)); }
public DispatcherMessage(MessageSourceOptions source, IDispatcherAction action) { if ((source != MessageSourceOptions.Server) && (source != MessageSourceOptions.View)) throw new ArgumentOutOfRangeException("source"); if (action == null) throw new ArgumentNullException("action"); Source = source; Action = action; }
public DispatcherMessage(MessageSourceOptions source, IDispatcherAction action) { if ((source != MessageSourceOptions.Server) && (source != MessageSourceOptions.View)) { throw new ArgumentOutOfRangeException("source"); } if (action == null) { throw new ArgumentNullException("action"); } Source = source; Action = action; }
#pragma warning restore CS0618 // Type or member is obsolete /// <summary> /// Dispatches an action that will be sent to all callbacks registered with this dispatcher. /// </summary> /// <param name="action">The action to dispatch; may not be null.</param> public void Dispatch(IDispatcherAction action) { if (action == null) { throw new ArgumentNullException(nameof(action)); } // The obsolete MessageSourceOptions handling needs to stay in the meantime, so just dispatch this as any arbitrary source. // Eventually this method should absorb the Dispatch(DispatcherMessage message) method's behaviour but dispatch the action // directly down to the event handler without wrapping it in a DispatcherMessage. #pragma warning disable CS0618 // Type or member is obsolete Dispatch(new DispatcherMessage(MessageSourceOptions.View, action)); #pragma warning restore CS0618 // Type or member is obsolete }
/// <summary> /// This method signature combines the condition and the work into a single delegate - if it returns ActionMatchOptions.Handled then the /// action will be considered matched and no subsequent Else methods will be considered but if it returns ActionMatchOptions.Ignored then /// it will be considered unmatched. The callback will not be called if the current action does not match type T and it will never be called /// with a null reference. It will throw an exception for a null IDispatcherAction, null condition or null work reference. /// </summary> public static IMatchDispatcherActions If <T>(this IDispatcherAction action, Func <T, ActionMatchOptions> work) where T : class, IDispatcherAction { return(new DispatcherActionMatcher(action).Else(work)); }
/// <summary> /// This will execute the specified callback with a non-null reference if the current IDispatcherAction matches type T and /// if that instance of T meets the specified conditions. It will never call the work action with a null reference and it will never /// return a null reference. It will throw an exception for a null IDispatcherAction, null condition or null work reference. /// </summary> public static IMatchDispatcherActions If <T>(this IDispatcherAction action, Func <T, bool> condition, Action <T> work) where T : class, IDispatcherAction { return(new DispatcherActionMatcher(action).Else(condition, work)); }