예제 #1
0
        private void HandleCreateListCommand(object parameter)
        {
            if (this.Title == null)
            {
                this.Message = "Title can not be null!";
                return;
            }

            if (this.Todos.Count == 0)
            {
                this.Message = "Todo list must contain at least one !";
                return;
            }
            var filledTodoes = this.Todos.Where(t => !string.IsNullOrEmpty(t.Text));

            if (filledTodoes.Count() == 0)
            {
                this.Message = "Todo list must contain at least one Todo!";
                return;
            }

            DataPersister.CreateNewTodosList(this.Title, filledTodoes);
            this.Title = "";
            this.Todos.Clear();
            this.TodoLists = DataPersister.GetTodoLists();
        }