/// <summary>
 /// Save a modified or new processing command.  A new processing command is recognized by a Guid.Empty ID.
 /// </summary>
 /// <param name="processingCommand">The processing command to save.</param>
 public async Task SaveProcessingCommand(ProcessingCommand processingCommand)
 {
     var request = NewRequest(HttpMethod.Post, "SaveProcessingCommand");
     request.AddBody(processingCommand);
     await ExecuteAsync(request).ConfigureAwait(false);
 }
 public override void OnCancel()
 {
     _displayedCommand = null;
     _commandsBindingSource.RemoveSort();
     base.OnCancel();
 }
 private void _createNewButton_Click(object sender, EventArgs e)
 {
     ProcessingCommand command = new ProcessingCommand();
     command.Name = "-Unnamed-";
     command.Arguments = "%%FILE%%";
     command.RunMode = ProcessingRunMode.Post;
     _commandsBindingSource.Add(command);
     _commandsDataGridView.CurrentCell = _commandsDataGridView.Rows[_commandsDataGridView.Rows.Count - 1].Cells[0];
 }
 private void UpdateSelectedCommand()
 {
     ProcessingCommand selectedCommand = GetSelectedCommand();
     _deleteButton.Enabled = (selectedCommand != null);
     _nameTextBox.Enabled = (selectedCommand != null);
     _commandTextBox.Enabled = (selectedCommand != null);
     _browseButton.Enabled = (selectedCommand != null);
     _argumentsTextBox.Enabled = (selectedCommand != null);
     _isDefaultTelevisionCheckBox.Enabled = (selectedCommand != null);
     _isDefaultRadioCheckBox.Enabled = (selectedCommand != null);
     _runModeComboBox.Enabled = (selectedCommand != null);
     _runAtTimePicker.Enabled = (selectedCommand != null);
     if (selectedCommand == null)
     {
         _nameTextBox.Text = String.Empty;
         _commandTextBox.Text = String.Empty;
         _argumentsTextBox.Text = String.Empty;
         _isDefaultTelevisionCheckBox.Checked = false;
         _isDefaultRadioCheckBox.Checked = false;
         _runModeComboBox.SelectedIndex = -1;
         _runAtTimePicker.Value = DateTime.Today;
     }
     else
     {
         _nameTextBox.Text = selectedCommand.Name;
         _commandTextBox.Text = selectedCommand.CommandPath;
         _argumentsTextBox.Text = selectedCommand.Arguments;
         _isDefaultTelevisionCheckBox.Checked = selectedCommand.IsDefaultTelevision;
         _isDefaultRadioCheckBox.Checked = selectedCommand.IsDefaultRadio;
         _runModeComboBox.SelectedIndex = (int)selectedCommand.RunMode;
         if (selectedCommand.RunMode == ProcessingRunMode.AtTime)
         {
             DateTime atTime = DateTime.Today;
             if (selectedCommand.RunAtHours.HasValue
                 && selectedCommand.RunAtMinutes.HasValue)
             {
                 atTime = atTime.Add(new TimeSpan(selectedCommand.RunAtHours.Value, selectedCommand.RunAtMinutes.Value, 0));
             }
             _runAtTimePicker.Value = atTime;
         }
         else
         {
             _runAtTimePicker.Value = DateTime.Today;
             _runAtTimePicker.Enabled = false;
         }
     }
     _displayedCommand = selectedCommand;
 }