Beispiel #1
0
 static void Main(string[] args)
 {
     while (true)
     {
         UI.ShowMainMenu();
         int input;
         Int32.TryParse(Console.ReadLine(), out input);
         if (input == 1)
         {
             UI.Clear();
             UI.ShowAllTodos();
             Int32.TryParse(Console.ReadLine(), out input);
             if (input == 1)
             {
                 UI.ShowMarkAsDone();
                 Int32.TryParse(Console.ReadLine(), out input);
                 Console.Write(TodoManager.MarkAsDone(input));
                 FileHandler.UpdateFile();
                 UI.ShowSuccess();
                 Console.ReadLine();
             }
         }
         else if (input == 2)
         {
             UI.ShowCreateDialog();
             string str = Console.ReadLine();
             TodoManager.Create(str);
             FileHandler.UpdateFile();
         }
         else
         {
         }
     }
 }
        public static void UpdateFile()
        {
            List <Todo> allTodos = TodoManager.getTodos();

            System.IO.File.WriteAllText(path, string.Empty);
            using (System.IO.StreamWriter file = new System.IO.StreamWriter(path))
            {
                foreach (Todo todo in allTodos)
                {
                    file.WriteLine(todo.toCSV());
                }
            }
        }