コード例 #1
0
        public void AddToTaskFile(SingleTask CurrentSingleTask)
        {
            string Path = GetPathAndThrowExeptionIfRequired();

            using (StreamWriter SW = new StreamWriter(Path, true))
            {
                SW.WriteLine(CurrentSingleTask.TimeCreated + " " + CurrentSingleTask.Task + " AT " + CurrentSingleTask.ScheduledTime);
            }
        }
コード例 #2
0
        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
            }
        }