Esempio n. 1
0
        private void DispachAction()
        {
            object action = null;

            switch (_optionType)
            {
            case OptionType.Remove:
                action = new RemoveSelectedTodosAction();
                break;

            case OptionType.SellectAll:
                action = new UpdateSelectedAllToDoAction
                {
                    IsSelected = _toggle
                };
                break;

            case OptionType.ToggleCompliteg:
                action = new CompleteSelectedTodosAction
                {
                    IsCompleted = _toggle
                };
                break;
            }

            if (action == null)
            {
                return;
            }
            ToDoApplication?.CurrentStore?.Dispatch(action);
            _toggle = !_toggle;
        }
Esempio n. 2
0
 private static ToDo[] UpdateSelectedAllToDoReducer(ToDo[] previousState,
                                                    UpdateSelectedAllToDoAction action)
 {
     return(previousState.UpdateItem(toDo => new ToDo
     {
         Id = toDo.Id,
         Text = toDo.Text,
         Selected = action.IsSelected,
         Completed = toDo.Completed
     }));
 }