Пример #1
0
 private void btnEditTask_Click(object sender, RoutedEventArgs e)
 {
     if (dgTasks.SelectedItem != null)
     {
         int selectedIndex = -2;
         try
         {
             int tmpSelectedIndexFromDG = dgTasks.SelectedIndex;
             selectedIndex = SearchIDFormDG(dgTasks.Columns[0].GetCellContent(dgTasks.Items[dgTasks.SelectedIndex]) as TextBlock);
             NewTaskForm newTaskFormWindow = new NewTaskForm(tasks[selectedIndex]);
             newTaskFormWindow.ShowDialog();
             if (newTaskFormWindow.ApplyChanges)
             {
                 tasks[selectedIndex] = newTaskFormWindow.simpleTask;
             }
             IOScripts.SerializeTaskTemplate(tasks, tasksDataFile);
             RefreshDataGrid();
             dgTasks.SelectedIndex = tmpSelectedIndexFromDG;
             //dgTasks_MouseDown(null, null);
             tbxComment.Text     = tasks[selectedIndex].comment;
             tbxLinkToJira.Text  = tasks[selectedIndex].linkToJira;
             tbxcatalogPath.Text = tasks[selectedIndex].catalogPath;
             RefreshWorkTime();
         }
         catch (Exception exc) {
             CustomMessageBox.Show(CustomMesageBoxTypes.Error, $"{exc.Message}\n\n{selectedIndex.ToString()}");
         }
     }
 }
Пример #2
0
 private void btnWorkTimeRemove_Click(object sender, RoutedEventArgs e)
 {
     if (dataGridSelectedItemIndex != -1 && lbxWorkingTime.SelectedItem != null)
     {
         tasks[dataGridSelectedItemIndex].workTime.RemoveAt(lbxWorkingTime.SelectedIndex);
         IOScripts.SerializeTaskTemplate(tasks, tasksDataFile);
         RefreshWorkTime();
     }
 }
Пример #3
0
 public MainWindow()
 {
     InitializeComponent();
     mainWindow.Title = WindowName;
     tasks            = IOScripts.DeserializeTaskTemplate(tasksDataFile);
     RefreshDataGrid();
     btnClearFiltr_Click(null, null);
     IOScripts.CheckExistsConfigFile(configFileName);
 }
Пример #4
0
 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();
     }
 }
Пример #5
0
 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();
     }
 }
Пример #6
0
        private void btnOpenCatalogPath_Click(object sender, RoutedEventArgs e)
        {
            if (Directory.Exists(tbxcatalogPath.Text))
            {
                ProcessStartInfo startInfo = new ProcessStartInfo
                {
                    Arguments = $"\"{tbxcatalogPath.Text}\"",
                    FileName  = IOScripts.SearchInFile("Default explorer", configFileName)
                };

                Process.Start(startInfo);
            }
            else
            {
                CustomMessageBox.Show(CustomMesageBoxTypes.Error, string.Format("{0} Directory does not exist!", tbxcatalogPath.Text));
            }
        }
Пример #7
0
        public static List <TaskTemplate> DeserializeTaskTemplate(string fileName = defaultTaskTemplateFileName)
        {
            List <TaskTemplate> tasks = new List <TaskTemplate>();

            try
            {
                var mySerializer = new XmlSerializer(typeof(List <TaskTemplate>));
                var myFileStream = new FileStream("TempName.xml", FileMode.Open);
                tasks = (List <TaskTemplate>)mySerializer.Deserialize(myFileStream);
                myFileStream.Close();
                return(tasks);
            }
            catch
            {
                MessageBox.Show($"Created xaml file: {fileName}");
                IOScripts.SerializeTaskTemplate(new List <TaskTemplate>(), fileName);
            }
            return(new List <TaskTemplate>());
        }
Пример #8
0
        private void btnAddNewTask_Click(object sender, RoutedEventArgs e)
        {
            NewTaskForm newTaskFormWindow = null;

            if (tasks.Count.Equals(0))
            {
                newTaskFormWindow = new NewTaskForm(0);
            }
            else
            {
                newTaskFormWindow = new NewTaskForm(dgTasks.Items.Count);
            }
            newTaskFormWindow.ShowDialog();
            if (newTaskFormWindow.ApplyChanges)
            {
                tasks.Add(newTaskFormWindow.simpleTask);
            }
            IOScripts.SerializeTaskTemplate(tasks, tasksDataFile);
            RefreshDataGrid();
        }