public void Dispatch(IRealmAction action) { TState localState = _dispatch(action); if (localState != null) { State = localState; OnChange(null); } }
public static AppState RootReducer(AppState appState, IRealmAction action) { if (appState == null) { throw new ArgumentNullException(nameof(appState)); } return(new AppState { Count = CounterReducer(appState.Count, action) }); }
public static bool IsLoadingReducer(bool isLoading, IRealmAction action) { switch (action) { case Actions.IsLoading.Set a: return(a.Value); default: return(isLoading); } }
public TState Invoke(IRealmAction action) { if (action is IAsyncRealmAction) { action.GetType().GetMethod("Invoke").Invoke(action, null); return(default(TState)); } else { return(_next(action)); } }
public static AppState RootReducer(AppState appState, IRealmAction action) { if (appState == null) { throw new ArgumentNullException(nameof(appState)); } return(new AppState { IsLoading = IsLoadingReducer(appState.IsLoading, action), Count = CounterReducer(appState.Count, action), WeatherForecasts = WeatherForecastsReducer(appState.WeatherForecasts, action) }); }
public static int CounterReducer(int count, IRealmAction action) { switch (action) { case Actions.Counter.IncrementByValue a: return(count + a.Value); case Actions.Counter.DecrementByValue a: return(count - a.Value); case Actions.Counter.Dispose _: case Actions.Counter.Reset _: return(0); default: return(count); } }
public TState Invoke(IRealmAction action) { if (!Configured) { Configured = true; } switch (action) { case RealmReduxDevToolsAppState <TState> a: return(a.State); default: TState nextState = Next(action); if (nextState != null && Array.IndexOf(ActionsToIgnore, action.GetType()) == -1) { History.Add(new Tuple <string, string>(UriHelper.Uri, JsonSerializer.Serialize <TState>(nextState))); reduxDevToolsInterop.Send(action, nextState); } return(nextState); } }
internal TState InitialDispatch(IRealmAction action) { TState localState = _rootReducer(State, action); return(localState); }
public static IEnumerable <WeatherForecast> WeatherForecastsReducer(IEnumerable <WeatherForecast> weatherForecasts, IRealmAction action) { switch (action) { case Actions.WeatherForecasts.Set a: return(a.Value); case Actions.WeatherForecasts.Clear _: return(new List <WeatherForecast>()); default: return(weatherForecasts); } }