/// <summary> /// Dispatches an action to the Store. /// </summary> /// <param name="action">Action to be dispatched.</param> public void Dispatch(ReduxAction action) { // Action must not be null. if (action == null) { throw new ArgumentNullException("action", Properties.Resources.DISPATCH_ACTION_NULL_ERROR); } IState currentState = GetState(); InvokeDispatcher(action); IState nextState = GetState(); // Emit a StateChange event only if the state has changed. if (!EqualityComparer <IState> .Default.Equals(currentState, nextState)) { OnStateChange(nextState); } }
private void InvokeDispatcher(ReduxAction action) { Dispatcher(action); }