Example #1
0
 private void SaveBtn_Click(object sender, RoutedEventArgs e)
 {
     if (int.TryParse(DaysInSprintTB.Text, out int days) && days > 0 && double.TryParse(PreferTaskDurationTB.Text, out double ptd))
     {
         AppSettings.Settings.Default.RedmineHost     = HostTB.Text;
         AppSettings.Settings.Default.RedmineApiKey   = ApiKeyTB.Text;
         AppSettings.Settings.Default.RedmineLogin    = RedmineLoginTB.Text;
         AppSettings.Settings.Default.RedminePassword = RedminePasswordTB.Text;
         AppSettings.Settings.Default.DaysInSprint    = days;
         if (ApiRB.IsChecked.HasValue && ApiRB.IsChecked.Value)
         {
             AppSettings.Settings.Default.RedmineConnectionType = "API";
         }
         else
         {
             AppSettings.Settings.Default.RedmineConnectionType = "LOGIN";
         }
         if (ManualRB.IsChecked.HasValue && ManualRB.IsChecked.Value)
         {
             AppSettings.Settings.Default.PreferTaskDurationSource = "MANUAL";
         }
         else
         {
             AppSettings.Settings.Default.PreferTaskDurationSource = "MEAN";
         }
         AppSettings.Settings.Default.PreferTaskDuration = ptd;
         AppSettings.Settings.Default.Save();
         Close();
     }
     else
     {
         MessageWorker.ShowError("Неверно утсновлен параметр \"Кол-во дней в спринте\"");
     }
 }
 void LoadRedmineProjects()
 {
     try
     {
         Projects = redmineWorker.LoadProjects();
         ProjectsListBox.ItemsSource = Projects;
     }
     catch (Exception ex)
     {
         MessageWorker.ShowError("Загрузка проектов из Redmine не удалась. Проверьте настройки подключения. Ошибка: " + ex.Message);
     }
 }
        public bool SaveFile()
        {
            bool result = saveFileDialog.ShowDialog() == DialogResult.OK ? true : false;

            if (result)
            {
                if (saveFileDialog.FileName != null && saveFileDialog.FileName != string.Empty)
                {
                    ReportFilePath = saveFileDialog.FileName;
                }
                else
                {
                    MessageWorker.ShowError("Ошибка при сохранении файла.");
                }
            }
            return(result);
        }
        public bool OpenFile()
        {
            bool result = openFileDialog.ShowDialog() == DialogResult.OK ? true : false;

            if (result)
            {
                if (openFileDialog.FileName != null && openFileDialog.FileName != string.Empty)
                {
                    FilePath = openFileDialog.FileName;
                }
                else
                {
                    MessageWorker.ShowError("Ошибка при открытии файла.");
                }
            }
            return(result);
        }