Exemple #1
0
        private void AddTodo(object sender, EventArgs e)
        {
            var description = newTodoView.Text.Trim();

            if (String.IsNullOrEmpty(description) || todos == null)
            {
                return;
            }

            var item = new TodoItem {
                Description = description
            };

            try   { _dataContext.AddTodo(item); }
            catch { return; } //eat the error because logging it at lower level
            newTodoView.Text = String.Empty;
            var vm = new TodoViewModel(item);

            todos.Insert(0, vm);                    // front of the list
            todoGridAdapter.NotifyDataSetChanged(); // redraw
        }