Exemplo n.º 1
0
        //initialize forms for lists from file and display them
        private void CreateToDoListFormFromFile(string file)
        {
            file    += ".json";
            fileName = Path.Combine(dir, file);
            string json = File.ReadAllText(fileName);
            List   list = new List();

            list = JsonConvert.DeserializeObject <List>(json);
            ToDoListForm toDo = new ToDoListForm(list);

            toDo.Show();
        }
Exemplo n.º 2
0
 //create list object, create todo form and display it
 public void BtnCreateList_Click(object sender, EventArgs e)
 {
     if (InitializeItemArray())
     {
         list     = new List(title, items);
         toDoList = new ToDoListForm(list);
         toDoList.Show();
         AddListToExisting();
         SaveListObjectToFile();
         this.Close();
     }
     else
     {
         MessageBox.Show(
             "Item list is empty!",
             "Error",
             MessageBoxButtons.OK,
             MessageBoxIcon.Error);
     }
 }