public TaskManager(TodoItem[] items)
 {
     if (items != null)
     {
         TodoItems = new ObservableCollection<TodoItem>(items);
     }
 }
        //TODO: 2.0 - Implment LiveTileHelper
        public static void UpdateLiveTile(bool createIfNotExists, TodoItem[] incompleteTodoItems)
        {
            //TODO: 2.1 - Instantiat an instance of IconicTileData
            //  For indecies 0-2 if they exist set in order iconicTileData.WideContent1-3
            //  Call UpdateOrCreateTile passing "/", the tile data instance, and forwarding the argument createIfNotExists that was passed to this method

            var iconicTileData = new IconicTileData
            {
                Title = "TIG Todo",
                Count = incompleteTodoItems.Length,
                SmallIconImage = new Uri("Assets/Tiles/IconicTileSmall.png", UriKind.Relative),
                IconImage = new Uri("Assets/Tiles/IconicTileMediumLarge.png", UriKind.Relative),
            };

            if (incompleteTodoItems.Length > 0)
            {
                iconicTileData.WideContent1 = incompleteTodoItems[0].Text ?? "";
            }
            if (incompleteTodoItems.Length > 1)
            {
                iconicTileData.WideContent2 = incompleteTodoItems[1].Text ?? "";
            }
            if (incompleteTodoItems.Length > 2)
            {
                iconicTileData.WideContent3 = incompleteTodoItems[2].Text ?? "";
            }

            UpdateOrCreateTile("/", iconicTileData, createIfNotExists);
        }
        public static void UpdateLiveTile(bool createIfNotExists,
            TodoItem[] incompleteTodoItems)
        {
            var iconicTileData = new IconicTileData()
            {
                Title = "TIG Todo",
                Count = incompleteTodoItems.Length,
                SmallIconImage = new Uri("Assets/Tiles/IconicTileSmall.png",
                    UriKind.Relative),
                IconImage = new Uri("Assets/Tiles/IconicTileMediumLarge.png",
                    UriKind.Relative),
            };

            switch (incompleteTodoItems.Length)
            {
                case 0:
                    iconicTileData.WideContent1 = string.Empty;
                    iconicTileData.WideContent2 = string.Empty;
                    iconicTileData.WideContent3 = string.Empty;
                    break;
                case 1:
                    iconicTileData.WideContent1 = incompleteTodoItems[0].Text ?? string.Empty;
                    iconicTileData.WideContent2 = string.Empty;
                    iconicTileData.WideContent3 = string.Empty;
                    break;
                case 2:
                    iconicTileData.WideContent1 = incompleteTodoItems[0].Text ?? string.Empty;
                    iconicTileData.WideContent2 = incompleteTodoItems[1].Text ?? string.Empty;
                    iconicTileData.WideContent3 = string.Empty;
                    break;
                default:
                    iconicTileData.WideContent1 = incompleteTodoItems[0].Text ?? string.Empty;
                    iconicTileData.WideContent2 = incompleteTodoItems[1].Text ?? string.Empty;
                    iconicTileData.WideContent3 = incompleteTodoItems[2].Text ?? string.Empty;
                    break;
            }

            UpdateOrCreateTile("/", iconicTileData, createIfNotExists);
        }
 public void RemoveItem(TodoItem todoItem)
 {
     TodoItems.Remove(todoItem);
 }
 public void AddTodoItem()
 {
     TodoItems.Add(NewTodoItem);
     NewTodoItem = new TodoItem();
 }
 public int SaveTask(TodoItem item)
 {
     return db.SaveItem<TodoItem>(item);
 }
 private void DeleteExecutedHandler(TodoItem todoItem)
 {
     taskManager.RemoveItem(todoItem);
 }
 private bool DeleteCanExecuteHandler(TodoItem todoItem)
 {
     return true;
 }
 public void ToggleItemCompletion(TodoItem todoItem)
 {
     todoItem.IsCompleted = !todoItem.IsCompleted;
     _repository.SaveTask(todoItem);
 }
 public void RemoveItem(TodoItem todoItem)
 {
     TodoItems.Remove(todoItem);
     _repository.DeleteTask(todoItem.ID);
 }
 public void AddTodoItem()
 {
     _repository.SaveTask(NewTodoItem);
     TodoItems.Add(NewTodoItem);
     NewTodoItem = new TodoItem();
 }
Exemple #12
0
 public int SaveTask(TodoItem item)
 {
     return(db.SaveItem <TodoItem>(item));
 }
 public TodoListViewModel(TodoItem[] items)
 {
     taskManager = new TaskManager(items);
 }