Exemple #1
0
        private void OpenButton_OnClick(object sender, RoutedEventArgs e)
        {
            var openDialog = new OpenFileDialog {Filter = "YAML Files (*.yml)|*.yml"};
            var result = openDialog.ShowDialog();

            if (result == true)
            {
                ClearEverything();
                _openJob = Job.Open(openDialog.FileName);
                _jobPath = openDialog.FileName;
            }
            else
                return;

            SqlOnlyCheckBox.IsChecked = _openJob.SqlOnly;
            OffshoreCheckBox.IsChecked = _openJob.IsOffshore;
            JobNumberTextBox.Text = _openJob.JobNumber == 0 ? string.Empty : _openJob.JobNumber.ToString();
            JobRevisionTextBox.Text = _openJob.JobRevision == 0 ? string.Empty : _openJob.JobRevision.ToString();
            AppBuildTextBox.Text = _openJob.AppBuild == 0 ? string.Empty : _openJob.AppBuild.ToString();
            CvsBranchTextBox.Text = _openJob.CvsBranch;
            HasDependCheckBox.IsChecked = _openJob.HasDepend;
            DependNoteTextBox.Text = _openJob.DependNote;
            // Ensure the filelist isn't null
            _openJob.FilesList = _openJob.FilesList ?? new List<string>();
            foreach (var item in _openJob.FilesList)
                FilesChangedListBox.Items.Add(item);
            CommentTextBox.Text = _openJob.Comment;
        }
Exemple #2
0
        private void SaveButton_OnClick(object sender, RoutedEventArgs e)
        {
            _openJob = new Job();

            if (!CheckFields())
            {
                MessageBox.Show("Something is missing. Enter as much detail as possible.", "Can't save!",
                    MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            // Update the job object
            _openJob.SqlOnly = SqlOnlyCheckBox.IsChecked ?? false;
            _openJob.IsOffshore = OffshoreCheckBox.IsChecked ?? false;
            _openJob.JobNumber = int.Parse(JobNumberTextBox.Text);
            _openJob.Comment = CommentTextBox.Text;
            _openJob.HasDepend = HasDependCheckBox.IsChecked ?? false;
            _openJob.DependNote = DependNoteTextBox.Text;

            // Things that are for non-SQL only jobs go in here
            if (_openJob.SqlOnly)
            {
                _openJob.JobRevision = 0;
                _openJob.AppBuild = 0;
                _openJob.CvsBranch = string.Empty;
                _openJob.FilesList = null;
            }
            else
            {
                _openJob.JobRevision = int.Parse(JobRevisionTextBox.Text);
                _openJob.AppBuild = int.Parse(AppBuildTextBox.Text);
                _openJob.CvsBranch = CvsBranchTextBox.Text;
                _openJob.FilesList = new List<string>();
                foreach (string item in FilesChangedListBox.Items)
                    _openJob.FilesList.Add(item);
            }

            if (!string.IsNullOrEmpty(_jobPath))
            {
                _openJob.Save(_jobPath);
                return;
            }

            var saveDialog = new SaveFileDialog
            {
                FileName = _openJob.JobNumber.ToString(),
                DefaultExt = ".yml",
                Filter = "YAML Files (*.yml)|*.yml"
            };
            var result = saveDialog.ShowDialog();

            if (result == true)
            {
                _openJob.Save(saveDialog.FileName);
                _jobPath = saveDialog.FileName;
            }
        }
Exemple #3
0
 private void ClearEverything()
 {
     _jobPath = string.Empty;
     _openJob = null;
     SqlOnlyCheckBox.IsChecked = false;
     JobNumberTextBox.Clear();
     JobRevisionTextBox.Clear();
     AppBuildTextBox.Clear();
     CvsBranchTextBox.Clear();
     HasDependCheckBox.IsChecked = false;
     DependNoteTextBox.Clear();
     FilesChangedListBox.Items.Clear();
     CommentTextBox.Clear();
 }
Exemple #4
0
 private void MainWindow_Loaded(object sender, RoutedEventArgs e) =>
     _openJob = null;