private bool GetDataFromForm() { // Check some fields... if (textBoxLabel.Text == "") { MessageBox.Show("You need to specify a label for the button!"); return(false); } if (_icon != null && _icon.Length > 0) { if (textBoxIconLayer.Text == "") { MessageBox.Show("If you select an icon it is mandatory to specify the layer of the icon."); return(false); } } PicasaButton button = new PicasaButton(); button.ButtonID = _buttonID; button.Version = 1; button.Label = textBoxLabel.Text; button.Description = textBoxDescription.Text; button.ToolTipText = textBoxTooltip.Text; button.Icon = _icon; button.IconLayer = textBoxIconLayer.Text; if (radioButtonExe.Checked == true) { button.ExecutionType = PicasaButton.ExecType.Executable; button.ExeFileRegKey = textBoxExeFileRegKey.Text; button.ExeDirRegKey = textBoxExeDirRegKey.Text; button.ExeDir = textBoxExeDir.Text; button.ExeFileName = textBoxExeFileName.Text; } else { button.ExecutionType = PicasaButton.ExecType.Script; button.Script = _script; } button.ExecuteForeach = checkBoxExecuteForeach.Checked; button.ExportFirst = checkBoxExportFirst.Checked; PicasaButton = button; return(true); }
public CreatePicasaButtonForm(PicasaButton button, string appSettingsDir) { InitializeComponent(); _appSettingsDir = appSettingsDir; _buttonID = button.ButtonID; textBoxLabel.Text = button.Label; textBoxDescription.Text = button.Description; textBoxTooltip.Text = button.ToolTipText; // _icon = button.Icon.PsdData; // textBoxIconLayer.Text = button.Icon.PsdLayer; textBoxExeFileRegKey.Text = button.ExeFileRegKey; textBoxExeDirRegKey.Text = button.ExeDirRegKey; textBoxExeDir.Text = button.ExeDir; textBoxExeFileName.Text = button.ExeFileName; _script = button.Script; checkBoxExecuteForeach.Checked = button.ExecuteForeach; checkBoxExportFirst.Checked = button.ExportFirst; // Enable layer field if there is a button... if (_icon != null && _icon.Length > 0) { textBoxIconLayer.Enabled = true; buttonRemoveIcon.Enabled = true; } else { textBoxIconLayer.Enabled = false; buttonRemoveIcon.Enabled = false; } // Check exe radiobutton if there is an exe // Set them both first to true, otherwise the checkedChanged event handler doesn't do its job :-(. radioButtonExe.Checked = true; radioButtonScript.Checked = true; if (button.ExecutionType == PicasaButton.ExecType.Executable) { radioButtonExe.Checked = true; } else { radioButtonScript.Checked = true; } }
public CreatePicasaButtonForm(PicasaButton button, string appSettingsDir) { InitializeComponent(); _appSettingsDir = appSettingsDir; _buttonID = button.ButtonID; textBoxLabel.Text = button.Label; textBoxDescription.Text = button.Description; textBoxTooltip.Text = button.ToolTipText; // _icon = button.Icon.PsdData; // textBoxIconLayer.Text = button.Icon.PsdLayer; textBoxExeFileRegKey.Text = button.ExeFileRegKey; textBoxExeDirRegKey.Text = button.ExeDirRegKey; textBoxExeDir.Text = button.ExeDir; textBoxExeFileName.Text = button.ExeFileName; _script = button.Script; checkBoxExecuteForeach.Checked = button.ExecuteForeach; checkBoxExportFirst.Checked = button.ExportFirst; // Enable layer field if there is a button... if (_icon != null && _icon.Length > 0) { textBoxIconLayer.Enabled = true; buttonRemoveIcon.Enabled = true; } else { textBoxIconLayer.Enabled = false; buttonRemoveIcon.Enabled = false; } // Check exe radiobutton if there is an exe // Set them both first to true, otherwise the checkedChanged event handler doesn't do its job :-(. radioButtonExe.Checked = true; radioButtonScript.Checked = true; if (button.ExecutionType == PicasaButton.ExecType.Executable) radioButtonExe.Checked = true; else radioButtonScript.Checked = true; }
private void buttonEditPicasaButton_Click(object sender, EventArgs e) { if (listBoxPicasaButtons.SelectedIndex == -1 || listBoxPicasaButtons.SelectedIndex >= _settings.picasaButtons.ButtonList.Count) { MessageBox.Show("Please choose a picasa button from the list first"); return; } PicasaButton curButton = _settings.picasaButtons.ButtonList[listBoxPicasaButtons.SelectedIndex]; CreatePicasaButtonForm createPicasaButtonForm = new CreatePicasaButtonForm(curButton, _appSettingsDir); createPicasaButtonForm.ShowDialog(); if (createPicasaButtonForm.DialogResult == DialogResult.OK) { _settings.picasaButtons.ButtonList[listBoxPicasaButtons.SelectedIndex] = createPicasaButtonForm.PicasaButton; this.ReFillPicasaButtonList(); } }
private bool GetDataFromForm() { // Check some fields... if (textBoxLabel.Text == "") { MessageBox.Show("You need to specify a label for the button!"); return false; } if (_icon != null && _icon.Length > 0) { if (textBoxIconLayer.Text == "") { MessageBox.Show("If you select an icon it is mandatory to specify the layer of the icon."); return false; } } PicasaButton button = new PicasaButton(); button.ButtonID = _buttonID; button.Version = 1; button.Label = textBoxLabel.Text; button.Description = textBoxDescription.Text; button.ToolTipText = textBoxTooltip.Text; button.Icon = _icon; button.IconLayer = textBoxIconLayer.Text; if (radioButtonExe.Checked == true) { button.ExecutionType = PicasaButton.ExecType.Executable; button.ExeFileRegKey = textBoxExeFileRegKey.Text; button.ExeDirRegKey = textBoxExeDirRegKey.Text; button.ExeDir = textBoxExeDir.Text; button.ExeFileName = textBoxExeFileName.Text; } else { button.ExecutionType = PicasaButton.ExecType.Script; button.Script = _script; } button.ExecuteForeach = checkBoxExecuteForeach.Checked; button.ExportFirst = checkBoxExportFirst.Checked; PicasaButton = button; return true; }