private void AddTodoTask(object value) { TodoTask model = new TodoTask(); model.Description = value.ToString(); TodoTaskViewModel viewModel = new TodoTaskViewModel(model); TodoTaskItems.Add(viewModel); }
private void LoadTodoTaskFile(object obj) { TodoTaskItems.Clear(); System.IO.FileStream file = System.IO.File.Open("mytasks.txt", System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite); System.IO.StreamReader reader = new System.IO.StreamReader(file); while (reader.EndOfStream == false) { TodoTask todoTask = new TodoTask(); todoTask.Description = reader.ReadLine(); TodoTaskItems.Add(new TodoTaskViewModel(todoTask)); } reader.Dispose(); file.Dispose(); }