コード例 #1
0
        private void ExecuteAddCommand(string title)
        {
            try
            {
                var index = this.Items.IndexOf(this.SelectedItem);
                var item  = new TodoItemViewModel(TodoItemRepository.GetDefault().Factory(title: title));
                // Set the ListId
                item.TodoItem.ListId = TodoList.Id;

                // Add to repo
                TodoItemRepository.GetForToDoListId(TodoList.Id).InsertItem(item.TodoItem);

                // Insert into ViewModel collection
                this.Items.Insert((index > -1) ? index : 0, item);
                this.SelectedItem = item;
            }
            catch { this.SelectedItem = null; }
        }
コード例 #2
0
        private void ExecuteAddCommand(string title)
        {
            try
            {
                var index = this.Items.IndexOf(this.SelectedItem);
                var item = new TodoItemViewModel(TodoItemRepository.GetDefault().Factory(title: title));
                // Set the ListId
                item.TodoItem.ListId = TodoList.Id;

                // Add to repo
                TodoItemRepository.GetForToDoListId(TodoList.Id).InsertItem(item.TodoItem);

                // Insert into ViewModel collection
                this.Items.Insert((index > -1) ? index : 0, item);
                this.SelectedItem = item;
            }
            catch { this.SelectedItem = null; }
        }