//if postponed is clicked then the start time or the end time is changed
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            Conversions  objectConversions   = new Conversions();
            Parser       parserObject        = new Parser("display");
            List <Event> datagriditemSource  = parserObject.taskToBePerformed();
            TaskDetails  taskObj             = objectConversions.convertEventsIntoTaskdetails(datagriditemSource[id - 1]);
            string       DateToBePostponedTo = taskObj.getStartDate();
            string       TimeToBePostponedTo = hours.ToString() + ":" + minutes.ToString() + ":" + seconds.ToString();

            if (days != 0)
            {
                DateTime sDate = objectConversions.ConvertStringToDate(DateToBePostponedTo);
                DateToBePostponedTo = sDate.AddDays(days).ToShortDateString();
                EditCommand         = "edit id" + " \"" + id.ToString() + "\"" + " start" + " \"" + DateToBePostponedTo + "\"";
            }
            if (taskObj.getEndTime() != "null")
            {
                string endTime = (TimeSpan.Parse(taskObj.getEndTime()) + TimeSpan.Parse(TimeToBePostponedTo)).ToString();
                EditCommand = "edit id" + " \"" + id.ToString() + "\"" + " to" + " \"" + endTime + "\"" + " start" + " \"" + DateToBePostponedTo + "\"" + "reminder" + " \"1H" + "\"";
            }
            if (taskObj.getStartTime() != "null")
            {
                string startTime = (TimeSpan.Parse(taskObj.getStartTime()) + TimeSpan.Parse(TimeToBePostponedTo)).ToString();
                EditCommand = "edit id" + " \"" + id.ToString() + "\"" + " from" + " \"" + startTime + "\"" + " start" + " \"" + DateToBePostponedTo + "\"" + "\"" + "reminder" + " \"1H" + "\"";
            }
            this.Close();
        }
        public edit_event(int eventid)
        {
            InitializeComponent();
            id = eventid;
            Parser       obj           = new Parser("display");
            List <Event> currentevents = new List <Event>();

            currentevents = obj.taskToBePerformed();
            TaskDetails TaskDetailsObject = new TaskDetails();
            Conversions Conversionsobject = new Conversions();

            TaskDetailsObject = Conversionsobject.convertEventsIntoTaskdetails(currentevents[id]);

            textBox2.Text  = TaskDetailsObject.getEventname() == "null" ? " " : TaskDetailsObject.getEventname();
            textBox3.Text  = TaskDetailsObject.getLocation() == "null" ? " " : TaskDetailsObject.getLocation();
            textBox4.Text  = TaskDetailsObject.getStartDate() == "null" ? " " : TaskDetailsObject.getStartDate();
            textBox5.Text  = TaskDetailsObject.getEndDate() == "null" ? " " : TaskDetailsObject.getEndDate();
            textBox6.Text  = TaskDetailsObject.getStartTime() == "null" ? " " : TaskDetailsObject.getStartTime();
            textBox7.Text  = TaskDetailsObject.getEndTime() == "null" ? " " : TaskDetailsObject.getEndTime();
            textBox9.Text  = currentevents[id].Remind_Me_Before == "null" ? " " : TaskDetailsObject.getRemainderTime();
            textBox10.Text = currentevents[id].Priority == "null" ? " " : TaskDetailsObject.getPriority();
            command        = "";
        }
 public string convertTaskDetailToWriteIntoFile(TaskDetails objectDetailsOfTask)
 {
     try
     {
         return(objectDetailsOfTask.getEventname() + ";" + objectDetailsOfTask.getLocation() + ";"
                + objectDetailsOfTask.getStartDate() + ";" + objectDetailsOfTask.getEndDate() + ";" +
                objectDetailsOfTask.getStartTime() + ";" + objectDetailsOfTask.getEndTime() + ";" +
                objectDetailsOfTask.getDuration() + ";" + objectDetailsOfTask.getPriority() + ";" +
                objectDetailsOfTask.getRemainderTime() + ";" + objectDetailsOfTask.getRepeat());
     }
     catch (Exception e)
     {
         StreamWriter loggingWriter = new StreamWriter("Logging.txt");
         loggingWriter.WriteLine(System.DateTime.Now + e.Message + "\n");
         loggingWriter.Close();
         return(null);
     }
 }