Example #1
0
            public Task OnLoad(DataStore <CellsModel> store)
            {
                this.store = store;
                var map = targetView.GetLinkMap();

                map.Get <Button>("Undo").SetOnClickAction(delegate {
                    store.Dispatch(new UndoAction <CellsModel>());
                });
                map.Get <Button>("Redo").SetOnClickAction(delegate {
                    store.Dispatch(new RedoAction <CellsModel>());
                });
                map.Get <Button>("AddManyEntries").SetOnClickAction(async delegate {
                    await CellsModelTests.SimulateManyChangesInModel(store);
                });
                uiRows = map.Get <GameObject>("Rows");

                store.AddStateChangeListenerDebounced(m => m.cells, UpdateCellsGridUi, delayInMs: 300);
                return(Task.FromResult(true));
            }
Example #2
0
        public static async Task ShowIn(ViewStack viewStack)
        {
            // Call model unit tests manually before the UI is shown:
            CellsModelTests.TestFromAndToRowName();
            CellsModelTests.TestDataStoreTransitiveChanges();

            CellsModel model = new CellsModel(ImmutableDictionary <CellPos, Cell> .Empty);
            Middleware <CellsModel>      logging   = Middlewares.NewLoggingMiddleware <CellsModel>();
            UndoRedoReducer <CellsModel> undoLogic = new UndoRedoReducer <CellsModel>();
            DataStore <CellsModel>       store     = new DataStore <CellsModel>(undoLogic.Wrap(CellsReducers.MainReducer), model, logging);

            MyPresenter presenter = new MyPresenter();

            presenter.targetView = viewStack.ShowView("7GUIs_Task7_Cells");
            await presenter.LoadModelIntoView(store);

            await TaskV2.Delay(2000);

            Toast.Show("Now simulating some table model changes..");
            // Simulate changes in the model to check if the UI updates correctly:
            CellsModelTests.SimulateSomeChangesInModel(store);
        }