Exemple #1
0
        public bool ReadData(string source)
        {
            if (!File.Exists(source))
            {
                return(false);
            }

            _sourse = source;

            StreamReader sr = new StreamReader(source);

            string line;

            while ((line = sr.ReadLine()) != null)
            {
                string[] fields = line.Split('|');

                TaskEntry task = new TaskEntry();
                task.Name     = fields[1];
                task.TaskDate = (fields[2] != "") ? (DateTime?)Convert.ToDateTime(fields[2]) : null;
                task.IsDone   = (fields[0] == "1");

                AddTask(task);
            }

            sr.Close();

            return(true);
        }
Exemple #2
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            FormAdd addForm = new FormAdd();

            if (addForm.ShowDialog() == DialogResult.OK)
            {
                TaskEntry task = new TaskEntry();
                task.Name     = addForm.Name;
                task.TaskDate = (DateTime?)addForm.TaskDate;
                task.IsDone   = addForm.IsDone;

                AddTask(task);
            }
        }
Exemple #3
0
 private void AddTask(TaskEntry task)
 {
     _manager.AddTask(task);
     //   bindingSourceTasks.ResetBindings(false);
     UpdateTable();
 }
Exemple #4
0
 public bool Filter(TaskEntry task)
 {
     return(!task.IsOverdue);
 }
Exemple #5
0
 public bool Filter(TaskEntry task)
 {
     return(!task.IsDone);
 }
Exemple #6
0
 public void AddTask(TaskEntry task)
 {
     _entries.Add(task);
 }