private void btnWorkTimeAdd_Click(object sender, RoutedEventArgs e)
 {
     if (dataGridSelectedItemIndex != -1)
     {
         WorkTimeWindow workTimeWindow = new WorkTimeWindow();
         workTimeWindow.ShowDialog();
         if (workTimeWindow.ApplyChanges)
         {
             tasks[dataGridSelectedItemIndex].workTime.Add(workTimeWindow.prerioid);
         }
         IOScripts.SerializeTaskTemplate(tasks, tasksDataFile);
         RefreshWorkTime();
     }
 }
 private void btnWorkTimeEdit_Click(object sender, RoutedEventArgs e)
 {
     if (dataGridSelectedItemIndex != -1 && lbxWorkingTime.SelectedItem != null)
     {
         int            lbxWorkingTimeIndex = lbxWorkingTime.SelectedIndex;
         WorkTimeWindow workTimeWindow      = new WorkTimeWindow(tasks[dataGridSelectedItemIndex].workTime[lbxWorkingTimeIndex]);
         workTimeWindow.ShowDialog();
         if (workTimeWindow.ApplyChanges)
         {
             tasks[dataGridSelectedItemIndex].workTime[lbxWorkingTimeIndex] = workTimeWindow.prerioid;
         }
         IOScripts.SerializeTaskTemplate(tasks, tasksDataFile);
         RefreshWorkTime();
     }
 }