Beispiel #1
0
        /// <summary>
        /// Method called when dropping an item.
        /// </summary>
        /// <param name="dropInfo"></param>
        async void IDropTarget.Drop(IDropInfo dropInfo)
        {
            // Get source and target
            TodoViewModel sourceItem = dropInfo.Data as TodoViewModel;
            TodoViewModel targetItem = dropInfo.TargetItem as TodoViewModel;

            // Let the Todo-items switch places
            Todos.Move(Todos.IndexOf(sourceItem), Todos.IndexOf(targetItem));

            // Update todo order
            await UpdateTodoOrder();

            DragHandleActive = false;
        }
        public void UpdateToDo(TodoDto todo, bool completed)
        {
            if (completed)
            {
                total_finished++;
            }
            else
            {
                total_finished--;
            }
            var index    = Todos.IndexOf(todo);
            var category = Categories.Where(i => i.Id == todo.CategoryId).FirstOrDefault();

            Todos[index]          = todo;
            Todos[index].Category = category;
            todo.Completed        = completed;
            ApiMethods.UpdateTodo(todo);
        }