public void AddToTaskFile(SingleTask CurrentSingleTask) { string Path = GetPathAndThrowExeptionIfRequired(); using (StreamWriter SW = new StreamWriter(Path, true)) { SW.WriteLine(CurrentSingleTask.TimeCreated + " " + CurrentSingleTask.Task + " AT " + CurrentSingleTask.ScheduledTime); } }
public void AddTask(string Task, TimeSpan ScheduledTime) { if (Task == null || Task.Length == 0) { throw new WindowClosedException(); } if (IsConflictingTime(ScheduledTime)) { throw new ConflictingScheduledTimeException(); } SingleTask CurrentSingleTask = new SingleTask(DateTime.Now.TimeOfDay, Task, ScheduledTime); //creating a new task using (BackEnd FileHandler = new BackEnd(TaskDateTime)) { FileHandler.AddToTaskFile(CurrentSingleTask); // updating teh corresponding file with the current task } }