protected override async Task InitializeAsync() { await base.InitializeAsync(); var items = await TodoStorage.GetItemsAsync(); using (_todoItems.SuspendChangeNotifications()) { _todoItems.ReplaceRange(items); } }
public void Run(string[] args) { if (args.Length == 0) { throw new TodoListException("No path. See usage (`help load`)"); } try { TodoStorage.SaveTodoList(args[0]); CLI.ColorfulWriteLine("Successfully saved!", CLI.ConsoleColors["success"]); } catch (Exception) { throw new TodoListException("An error occured while todo list was saving. Maybe file is invalid."); } }
public void Run(string[] args) { if (args.Length == 0) { throw new TodoListException("No path. See usage (`help load`)"); } if (!File.Exists(args[0])) { throw new TodoListException("File not found."); } try { CLI.ChangeCurrentTodoList(TodoStorage.LoadTodoList(args[0])); CLI.ColorfulWriteLine("Successfully loaded.", CLI.ConsoleColors["success"]); } catch (Exception) { throw new TodoListException("An error occured while todo list was loading. Maybe file is invalid."); } }
protected virtual async Task <bool> SaveItemAsync() { await TodoStorage.SaveItemAsync(TodoItem); return(true); }
protected override async Task <bool> SaveItemAsync() { await TodoStorage.AddItemAsync(TodoItem); return(true); }