Beispiel #1
0
		public App ()
		{
			var initialState = new ApplicationState {
				Todos = ImmutableArray<Todo>.Empty,
				Filter = TodosFilter.All
			};

//			//MainPage = new MainPage ();
//			NavigationPage navPage = new NavigationPage (
//				                         new DevFrame () {
//					TimeMachineStore = (IStore<TimeMachineState>)Store,
//					//Content = new TimeMachine(),
//				});
//
            var masterDetail = new MasterDetailPage ();

            bool enableTimeMachine = true;
            if (enableTimeMachine) {
                Store = new TimeMachineStore<ApplicationState> (initialState, ApplicationReducer.Execute);

                masterDetail.Master = 
                    new NavigationPage (
                        new DevFrame ((IStore<TimeMachineState>)Store) { 
                            Title = "Time Machine"
                        }
                    ) { Title = "Menu" };
                
            } else {
                Store = new Store<ApplicationState>(initialState, ApplicationReducer.Execute);
            }

            masterDetail.Detail = 
                new NavigationPage (
                    new MainPage () { Title = "Todo List" }
                );

            MainPage = masterDetail;
		}
Beispiel #2
0
 public static ApplicationState Execute(ApplicationState previousState, IAction action)
 {
     return new ApplicationState
     {
         Filter = action is FilterTodosAction ? ((FilterTodosAction)action).Filter : previousState.Filter,
         Todos = TodosReducer(previousState.Todos, action)
     };
 }