private void toolsListBox_SelectedIndexChanged(object sender, System.EventArgs e) { if (toolsListBox.SelectedItem != null) { ToolDescr td = (ToolDescr)toolsListBox.SelectedItem; if (td.executablePath == null) { this.browserCheckBox.Checked = true; this.argsLabel.Text = "URL:"; this.exeLabel.Visible = false; this.executableTextBox.Visible = false; this.browseButton.Visible = false; this.executableTextBox.Text = ""; } else { this.browserCheckBox.Checked = false; this.argsLabel.Text = "Arguments:"; this.exeLabel.Visible = true; this.executableTextBox.Visible = true; this.browseButton.Visible = true; this.executableTextBox.Text = "" + td.executablePath; } this.displayNameTextBox.Text = td.displayName; this.argumentsTextBox.Text = td.arguments; setValidationText(td); } }
private void browserCheckBox_CheckedChanged(object sender, System.EventArgs e) { ToolDescr td = (ToolDescr)toolsListBox.SelectedItem; if (browserCheckBox.Checked) { this.argsLabel.Text = "URL:"; this.exeLabel.Visible = false; this.executableTextBox.Visible = false; this.browseButton.Visible = false; if (td.executablePath != null) { td.executablePath = null; this.executableTextBox.Text = ""; Project.tools.isDirty = true; } } else { this.argsLabel.Text = "Arguments:"; this.exeLabel.Visible = true; this.executableTextBox.Visible = true; this.browseButton.Visible = true; if (td.executablePath == null) { td.executablePath = Project.driveSystem + "Program Files"; this.executableTextBox.Text = td.executablePath; Project.tools.isDirty = true; } } }
private void browseButton_Click(object sender, System.EventArgs e) { System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog(); if (File.Exists(this.executableTextBox.Text)) { openFileDialog.FileName = this.executableTextBox.Text; } else { openFileDialog.InitialDirectory = this.executableTextBox.Text; } openFileDialog.DefaultExt = ".exe"; openFileDialog.AddExtension = false; // "Text files (*.txt)|*.txt|All files (*.*)|*.*" openFileDialog.Filter = "executable files (*.exe)|*.exe|All files (*.*)|*.*"; DialogResult result = openFileDialog.ShowDialog(); if (result == DialogResult.OK) { FileInfo fi = new FileInfo(openFileDialog.FileName); this.executableTextBox.Text = Project.GetLongPathName(fi.FullName); ToolDescr td = (ToolDescr)toolsListBox.SelectedItem; if (fi.FullName != td.executablePath) { td.executablePath = fi.FullName; Project.tools.isDirty = true; } } }
private void removeToolButton_Click(object sender, System.EventArgs e) { ToolDescr td = (ToolDescr)toolsListBox.SelectedItem; Project.tools.tools.Remove(td); Project.tools.isDirty = true; refreshToolsListBox(null); }
private void refreshToolsListBox(ToolDescr td) { toolsListBox.DataSource = null; toolsListBox.DataSource = Project.tools.tools; if (td != null) { toolsListBox.SelectedItem = td; } }
private void argumentsTextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e) { ToolDescr td = (ToolDescr)toolsListBox.SelectedItem; string newArgs = argumentsTextBox.Text.Trim(); if (!newArgs.Equals(td.arguments)) { td.arguments = newArgs; Project.tools.isDirty = true; } }
private void executableTextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e) { ToolDescr td = (ToolDescr)toolsListBox.SelectedItem; string newExe = executableTextBox.Text.Trim(); if (!newExe.Equals(td.executablePath)) { td.executablePath = newExe; Project.tools.isDirty = true; } }
private void addToolButton_Click(object sender, System.EventArgs e) { ToolDescr td = new ToolDescr(); td.displayName = "New Tool"; td.executablePath = Project.driveSystem + "Program Files"; td.arguments = "longitude=%lon% latitude=%lat%"; Project.tools.tools.Add(td); Project.tools.isDirty = true; refreshToolsListBox(td); }
private void collectDisplayName() { ToolDescr td = (ToolDescr)toolsListBox.SelectedItem; string newName = displayNameTextBox.Text.Trim(); if (!newName.Equals(td.displayName)) { td.displayName = newName; refreshToolsListBox(td); Project.tools.isDirty = true; } }
private void runButton_Click(object sender, System.EventArgs e) { ToolDescr td = (ToolDescr)toolsListBox.SelectedItem; try { td.run(PictureManager.This.CameraManager.Location.Lat, PictureManager.This.CameraManager.Location.Lng, null, null); } catch { LibSys.StatusBar.Trace("* Error: tool not valid: " + td); } }
private void downButton_Click(object sender, System.EventArgs e) { ToolDescr td = (ToolDescr)toolsListBox.SelectedItem; int index = toolsListBox.SelectedIndex; if (index < Project.tools.tools.Count - 1) { Project.tools.tools.RemoveAt(index); Project.tools.tools.Insert(index + 1, td); Project.tools.isDirty = true; refreshToolsListBox(td); } }
private void argumentsTextBox_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { ToolDescr td = (ToolDescr)toolsListBox.SelectedItem; if (td != null) { string newArgs = argumentsTextBox.Text.Trim(); if (!newArgs.Equals(td.arguments)) { td.arguments = newArgs; Project.tools.isDirty = true; setValidationText(td); } } }
private void setValidationText(ToolDescr td) { this.validationLabel.Text = td.substituteArgs(PictureManager.This.CameraManager.Location.Lat, PictureManager.This.CameraManager.Location.Lng, null, null).Replace("&", "&&"); }