Merge branch 'pr706_target' into develop

# Conflicts:
#	mRemoteV1/Config/Settings/SettingsSaver.cs
#	mRemoteV1/Tools/ExternalTool.cs
#	mRemoteV1/UI/Window/ExternalToolsWindow.Designer.cs
#	mRemoteV1/UI/Window/ExternalToolsWindow.cs
#	mRemoteV1/UI/Window/ExternalToolsWindow.resx
This commit is contained in:
David Sparer
2017-11-11 13:36:19 -06:00
5 changed files with 185 additions and 49 deletions

View File

@@ -72,6 +72,12 @@ namespace mRemoteNG.Config.Settings
Arguments = xEl.Attributes["Arguments"].Value
};
// check before, since old save files won't have this set
if (xEl.HasAttribute("WorkingDir"))
extA.WorkingDir = xEl.Attributes["WorkingDir"].Value;
if (xEl.HasAttribute("RunElevated"))
extA.RunElevated = bool.Parse(xEl.Attributes["RunElevated"].Value);
if (xEl.HasAttribute("WaitForExit"))
{
extA.WaitForExit = bool.Parse(xEl.Attributes["WaitForExit"].Value);

View File

@@ -37,8 +37,10 @@ namespace mRemoteNG.Config.Settings
xmlTextWriter.WriteAttributeString("DisplayName", "", extA.DisplayName);
xmlTextWriter.WriteAttributeString("FileName", "", extA.FileName);
xmlTextWriter.WriteAttributeString("Arguments", "", extA.Arguments);
xmlTextWriter.WriteAttributeString("WorkingDir", "", extA.WorkingDir);
xmlTextWriter.WriteAttributeString("WaitForExit", "", Convert.ToString(extA.WaitForExit));
xmlTextWriter.WriteAttributeString("TryToIntegrate", "", Convert.ToString(extA.TryIntegrate));
xmlTextWriter.WriteAttributeString("RunElevated", "", Convert.ToString(extA.RunElevated));
xmlTextWriter.WriteAttributeString("ShowOnToolbar", "", Convert.ToString(extA.ShowOnToolbar));
xmlTextWriter.WriteEndElement();
}

View File

@@ -18,8 +18,10 @@ namespace mRemoteNG.Tools
public string FileName { get; set; }
public bool WaitForExit { get; set; }
public string Arguments { get; set; }
public string WorkingDir { get; set; }
public bool TryIntegrate { get; set; }
public bool ShowOnToolbar { get; set; } = true;
public bool RunElevated { get; set; }
public ConnectionInfo ConnectionInfo { get; set; }
public Icon Icon
@@ -34,11 +36,13 @@ namespace mRemoteNG.Tools
#endregion
public ExternalTool(string displayName = "", string fileName = "", string arguments = "")
public ExternalTool(string displayName = "", string fileName = "", string arguments = "", string workingDir = "", bool runElevated = false)
{
DisplayName = displayName;
FileName = fileName;
Arguments = arguments;
WorkingDir = workingDir;
RunElevated = runElevated;
}
public void Start(ConnectionInfo startConnectionInfo = null)
@@ -82,6 +86,8 @@ namespace mRemoteNG.Tools
process.StartInfo.UseShellExecute = true;
process.StartInfo.FileName = argParser.ParseArguments(FileName);
process.StartInfo.Arguments = argParser.ParseArguments(Arguments);
if (WorkingDir != "") process.StartInfo.WorkingDirectory = argParser.ParseArguments(WorkingDir);
if (RunElevated) process.StartInfo.Verb = "runas";
}
private void StartIntegrated()

View File

@@ -11,7 +11,8 @@ namespace mRemoteNG.UI.Window
internal BrightIdeasSoftware.OLVColumn ArgumentsColumnHeader;
internal BrightIdeasSoftware.OLVColumn WaitForExitColumnHeader;
internal BrightIdeasSoftware.OLVColumn TryToIntegrateColumnHeader;
internal System.Windows.Forms.GroupBox PropertiesGroupBox;
internal BrightIdeasSoftware.OLVColumn WorkingDirColumnHeader;
internal BrightIdeasSoftware.OLVColumn RunElevateHeader;
internal Controls.Base.NGTextBox DisplayNameTextBox;
internal BrightIdeasSoftware.OLVColumn ShowOnToolbarColumnHeader;
internal Controls.Base.NGLabel DisplayNameLabel;
@@ -30,29 +31,39 @@ namespace mRemoteNG.UI.Window
internal Controls.Base.NGCheckBox TryToIntegrateCheckBox;
internal Controls.Base.NGCheckBox ShowOnToolbarCheckBox;
internal Controls.Base.NGListView ToolsListObjView;
private void InitializeComponent()
internal Controls.Base.NGLabel WorkingDirLabel;
internal Controls.Base.NGTextBox WorkingDirTextBox;
internal Controls.Base.NGButton BrowseWorkingDir;
internal Controls.Base.NGCheckBox RunElevatedCheckBox;
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ExternalToolsWindow));
this.ToolsListObjView = new Controls.Base.NGListView();
this.ToolsListObjView = new mRemoteNG.UI.Controls.Base.NGListView();
this.DisplayNameColumnHeader = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.FilenameColumnHeader = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.ArgumentsColumnHeader = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.WorkingDirColumnHeader = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.WaitForExitColumnHeader = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.TryToIntegrateColumnHeader = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.RunElevateHeader = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.ShowOnToolbarColumnHeader = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.ToolsContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
this.NewToolMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.DeleteToolMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.LaunchToolMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ShowOnToolbarColumnHeader = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.PropertiesGroupBox = new mRemoteNG.UI.Controls.Base.NGGroupBox();
this.ShowOnToolbarCheckBox = new mRemoteNG.UI.Controls.Base.NGCheckBox();
this.RunElevatedCheckBox = new mRemoteNG.UI.Controls.Base.NGCheckBox();
this.BrowseWorkingDir = new mRemoteNG.UI.Controls.Base.NGButton();
this.WorkingDirLabel = new mRemoteNG.UI.Controls.Base.NGLabel();
this.WorkingDirTextBox = new mRemoteNG.UI.Controls.Base.NGTextBox();
this.TryToIntegrateCheckBox = new mRemoteNG.UI.Controls.Base.NGCheckBox();
this.OptionsLabel = new mRemoteNG.UI.Controls.Base.NGLabel();
this.WaitForExitCheckBox = new mRemoteNG.UI.Controls.Base.NGCheckBox();
this.BrowseButton = new Controls.Base.NGButton();
this.BrowseButton = new mRemoteNG.UI.Controls.Base.NGButton();
this.ArgumentsCheckBox = new mRemoteNG.UI.Controls.Base.NGTextBox();
this.FilenameTextBox = new mRemoteNG.UI.Controls.Base.NGTextBox();
this.DisplayNameTextBox = new mRemoteNG.UI.Controls.Base.NGTextBox();
@@ -77,6 +88,14 @@ namespace mRemoteNG.UI.Window
//
// ToolsListObjView
//
this.ToolsListObjView.AllColumns.Add(this.DisplayNameColumnHeader);
this.ToolsListObjView.AllColumns.Add(this.FilenameColumnHeader);
this.ToolsListObjView.AllColumns.Add(this.ArgumentsColumnHeader);
this.ToolsListObjView.AllColumns.Add(this.WorkingDirColumnHeader);
this.ToolsListObjView.AllColumns.Add(this.WaitForExitColumnHeader);
this.ToolsListObjView.AllColumns.Add(this.TryToIntegrateColumnHeader);
this.ToolsListObjView.AllColumns.Add(this.RunElevateHeader);
this.ToolsListObjView.AllColumns.Add(this.ShowOnToolbarColumnHeader);
this.ToolsListObjView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
@@ -86,18 +105,20 @@ namespace mRemoteNG.UI.Window
this.DisplayNameColumnHeader,
this.FilenameColumnHeader,
this.ArgumentsColumnHeader,
this.WorkingDirColumnHeader,
this.WaitForExitColumnHeader,
this.TryToIntegrateColumnHeader,
this.RunElevateHeader,
this.ShowOnToolbarColumnHeader});
this.ToolsListObjView.ContextMenuStrip = this.ToolsContextMenuStrip;
this.ToolsListObjView.Cursor = System.Windows.Forms.Cursors.Default;
this.ToolsListObjView.DecorateLines = true;
this.ToolsListObjView.FullRowSelect = true;
this.ToolsListObjView.GridLines = true;
this.ToolsListObjView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.ToolsListObjView.HideSelection = false;
this.ToolsListObjView.Location = new System.Drawing.Point(0, 0);
this.ToolsListObjView.Name = "ToolsListObjView";
this.ToolsListObjView.Size = new System.Drawing.Size(684, 157);
this.ToolsListObjView.Size = new System.Drawing.Size(827, 186);
this.ToolsListObjView.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.ToolsListObjView.TabIndex = 0;
this.ToolsListObjView.UseCompatibleStateImageBehavior = false;
@@ -108,39 +129,66 @@ namespace mRemoteNG.UI.Window
// DisplayNameColumnHeader
//
this.DisplayNameColumnHeader.AspectName = "DisplayName";
this.DisplayNameColumnHeader.AutoCompleteEditor = false;
this.DisplayNameColumnHeader.AutoCompleteEditorMode = System.Windows.Forms.AutoCompleteMode.None;
this.DisplayNameColumnHeader.Text = "Display Name";
this.DisplayNameColumnHeader.Width = 130;
this.DisplayNameColumnHeader.UseInitialLetterForGroup = true;
this.DisplayNameColumnHeader.Width = 100;
//
// FilenameColumnHeader
//
this.FilenameColumnHeader.AspectName = "FileName";
this.FilenameColumnHeader.AutoCompleteEditor = false;
this.FilenameColumnHeader.AutoCompleteEditorMode = System.Windows.Forms.AutoCompleteMode.None;
this.FilenameColumnHeader.Groupable = false;
this.FilenameColumnHeader.Text = "Filename";
this.FilenameColumnHeader.Width = 200;
this.FilenameColumnHeader.Width = 100;
//
// ArgumentsColumnHeader
//
this.ArgumentsColumnHeader.AspectName = "Arguments";
this.ArgumentsColumnHeader.FillsFreeSpace = true;
this.ArgumentsColumnHeader.AutoCompleteEditor = false;
this.ArgumentsColumnHeader.AutoCompleteEditorMode = System.Windows.Forms.AutoCompleteMode.None;
this.ArgumentsColumnHeader.Groupable = false;
this.ArgumentsColumnHeader.Text = "Arguments";
this.ArgumentsColumnHeader.Width = 160;
//
// WorkingDirColumnHeader
//
this.WorkingDirColumnHeader.AspectName = "WorkingDir";
this.WorkingDirColumnHeader.AutoCompleteEditor = false;
this.WorkingDirColumnHeader.AutoCompleteEditorMode = System.Windows.Forms.AutoCompleteMode.None;
this.WorkingDirColumnHeader.Groupable = false;
this.WorkingDirColumnHeader.Text = "Working Directory";
this.WorkingDirColumnHeader.Width = 160;
//
// WaitForExitColumnHeader
//
this.WaitForExitColumnHeader.AspectName = "WaitForExit";
this.WaitForExitColumnHeader.Groupable = false;
this.WaitForExitColumnHeader.Text = "Wait for exit";
this.WaitForExitColumnHeader.Width = 95;
this.WaitForExitColumnHeader.Width = 75;
//
// TryToIntegrateColumnHeader
//
this.TryToIntegrateColumnHeader.AspectName = "TryIntegrate";
this.TryToIntegrateColumnHeader.Groupable = false;
this.TryToIntegrateColumnHeader.Text = "Try To Integrate";
this.TryToIntegrateColumnHeader.Width = 95;
//
// TryToIntegrateColumnHeader
// RunElevateHeader
//
this.RunElevateHeader.AspectName = "RunElevated";
this.RunElevateHeader.Groupable = false;
this.RunElevateHeader.Text = "Run Elevated";
this.RunElevateHeader.Width = 95;
//
// ShowOnToolbarColumnHeader
//
this.ShowOnToolbarColumnHeader.AspectName = "ShowOnToolbar";
this.ShowOnToolbarColumnHeader.Groupable = false;
this.ShowOnToolbarColumnHeader.Text = "Show On Toolbar";
this.ShowOnToolbarColumnHeader.Width = 102;
this.ShowOnToolbarColumnHeader.Width = 100;
//
// ToolsContextMenuStrip
//
@@ -188,6 +236,10 @@ namespace mRemoteNG.UI.Window
this.PropertiesGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.PropertiesGroupBox.Controls.Add(this.ShowOnToolbarCheckBox);
this.PropertiesGroupBox.Controls.Add(this.RunElevatedCheckBox);
this.PropertiesGroupBox.Controls.Add(this.BrowseWorkingDir);
this.PropertiesGroupBox.Controls.Add(this.WorkingDirLabel);
this.PropertiesGroupBox.Controls.Add(this.WorkingDirTextBox);
this.PropertiesGroupBox.Controls.Add(this.TryToIntegrateCheckBox);
this.PropertiesGroupBox.Controls.Add(this.OptionsLabel);
this.PropertiesGroupBox.Controls.Add(this.WaitForExitCheckBox);
@@ -199,9 +251,9 @@ namespace mRemoteNG.UI.Window
this.PropertiesGroupBox.Controls.Add(this.FilenameLabel);
this.PropertiesGroupBox.Controls.Add(this.DisplayNameLabel);
this.PropertiesGroupBox.Enabled = false;
this.PropertiesGroupBox.Location = new System.Drawing.Point(0, 153);
this.PropertiesGroupBox.Location = new System.Drawing.Point(0, 192);
this.PropertiesGroupBox.Name = "PropertiesGroupBox";
this.PropertiesGroupBox.Size = new System.Drawing.Size(684, 145);
this.PropertiesGroupBox.Size = new System.Drawing.Size(827, 184);
this.PropertiesGroupBox.TabIndex = 1;
this.PropertiesGroupBox.TabStop = false;
this.PropertiesGroupBox.Text = "External Tool Properties";
@@ -210,7 +262,7 @@ namespace mRemoteNG.UI.Window
//
this.ShowOnToolbarCheckBox._mice = mRemoteNG.UI.Controls.Base.NGCheckBox.MouseState.HOVER;
this.ShowOnToolbarCheckBox.AutoSize = true;
this.ShowOnToolbarCheckBox.Location = new System.Drawing.Point(442, 106);
this.ShowOnToolbarCheckBox.Location = new System.Drawing.Point(306, 158);
this.ShowOnToolbarCheckBox.Name = "ShowOnToolbarCheckBox";
this.ShowOnToolbarCheckBox.Size = new System.Drawing.Size(113, 17);
this.ShowOnToolbarCheckBox.TabIndex = 10;
@@ -219,14 +271,58 @@ namespace mRemoteNG.UI.Window
this.ShowOnToolbarCheckBox.CheckedChanged += new System.EventHandler(this.ShowOnToolbarCheckBox_CheckedChanged);
this.ShowOnToolbarCheckBox.Click += new System.EventHandler(this.PropertyControl_ChangedOrLostFocus);
//
// RunElevatedCheckBox
//
this.RunElevatedCheckBox._mice = mRemoteNG.UI.Controls.Base.NGCheckBox.MouseState.HOVER;
this.RunElevatedCheckBox.AutoSize = true;
this.RunElevatedCheckBox.Location = new System.Drawing.Point(126, 158);
this.RunElevatedCheckBox.Name = "RunElevatedCheckBox";
this.RunElevatedCheckBox.Size = new System.Drawing.Size(93, 17);
this.RunElevatedCheckBox.TabIndex = 9;
this.RunElevatedCheckBox.Text = "Run Elevated";
this.RunElevatedCheckBox.UseVisualStyleBackColor = true;
this.RunElevatedCheckBox.Click += new System.EventHandler(this.PropertyControl_ChangedOrLostFocus);
//
// BrowseWorkingDir
//
this.BrowseWorkingDir._mice = mRemoteNG.UI.Controls.Base.NGButton.MouseState.HOVER;
this.BrowseWorkingDir.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.BrowseWorkingDir.Location = new System.Drawing.Point(723, 103);
this.BrowseWorkingDir.Name = "BrowseWorkingDir";
this.BrowseWorkingDir.Size = new System.Drawing.Size(95, 23);
this.BrowseWorkingDir.TabIndex = 6;
this.BrowseWorkingDir.Text = "Browse...";
this.BrowseWorkingDir.UseVisualStyleBackColor = true;
this.BrowseWorkingDir.Click += new System.EventHandler(this.BrowseWorkingDir_Click);
//
// WorkingDirLabel
//
this.WorkingDirLabel.AutoSize = true;
this.WorkingDirLabel.Location = new System.Drawing.Point(6, 108);
this.WorkingDirLabel.Name = "WorkingDirLabel";
this.WorkingDirLabel.Size = new System.Drawing.Size(104, 13);
this.WorkingDirLabel.TabIndex = 11;
this.WorkingDirLabel.Text = "Working Directory:";
this.WorkingDirLabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// WorkingDirTextBox
//
this.WorkingDirTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.WorkingDirTextBox.Location = new System.Drawing.Point(126, 104);
this.WorkingDirTextBox.Name = "WorkingDirTextBox";
this.WorkingDirTextBox.Size = new System.Drawing.Size(591, 22);
this.WorkingDirTextBox.TabIndex = 5;
this.WorkingDirTextBox.Leave += new System.EventHandler(this.PropertyControl_ChangedOrLostFocus);
//
// TryToIntegrateCheckBox
//
this.TryToIntegrateCheckBox._mice = mRemoteNG.UI.Controls.Base.NGCheckBox.MouseState.HOVER;
this.TryToIntegrateCheckBox.AutoSize = true;
this.TryToIntegrateCheckBox.Location = new System.Drawing.Point(280, 106);
this.TryToIntegrateCheckBox.Location = new System.Drawing.Point(306, 135);
this.TryToIntegrateCheckBox.Name = "TryToIntegrateCheckBox";
this.TryToIntegrateCheckBox.Size = new System.Drawing.Size(103, 17);
this.TryToIntegrateCheckBox.TabIndex = 9;
this.TryToIntegrateCheckBox.TabIndex = 8;
this.TryToIntegrateCheckBox.Text = "Try to integrate";
this.TryToIntegrateCheckBox.UseVisualStyleBackColor = true;
this.TryToIntegrateCheckBox.CheckedChanged += new System.EventHandler(this.TryToIntegrateCheckBox_CheckedChanged);
@@ -235,7 +331,7 @@ namespace mRemoteNG.UI.Window
// OptionsLabel
//
this.OptionsLabel.AutoSize = true;
this.OptionsLabel.Location = new System.Drawing.Point(51, 107);
this.OptionsLabel.Location = new System.Drawing.Point(6, 135);
this.OptionsLabel.Name = "OptionsLabel";
this.OptionsLabel.Size = new System.Drawing.Size(52, 13);
this.OptionsLabel.TabIndex = 7;
@@ -246,10 +342,10 @@ namespace mRemoteNG.UI.Window
//
this.WaitForExitCheckBox._mice = mRemoteNG.UI.Controls.Base.NGCheckBox.MouseState.HOVER;
this.WaitForExitCheckBox.AutoSize = true;
this.WaitForExitCheckBox.Location = new System.Drawing.Point(110, 106);
this.WaitForExitCheckBox.Location = new System.Drawing.Point(126, 135);
this.WaitForExitCheckBox.Name = "WaitForExitCheckBox";
this.WaitForExitCheckBox.Size = new System.Drawing.Size(89, 17);
this.WaitForExitCheckBox.TabIndex = 8;
this.WaitForExitCheckBox.TabIndex = 7;
this.WaitForExitCheckBox.Text = "Wait for exit";
this.WaitForExitCheckBox.UseVisualStyleBackColor = true;
this.WaitForExitCheckBox.Click += new System.EventHandler(this.PropertyControl_ChangedOrLostFocus);
@@ -257,11 +353,12 @@ namespace mRemoteNG.UI.Window
//
// BrowseButton
//
this.BrowseButton._mice = mRemoteNG.UI.Controls.Base.NGButton.MouseState.HOVER;
this.BrowseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.BrowseButton.Location = new System.Drawing.Point(580, 45);
this.BrowseButton.Location = new System.Drawing.Point(723, 46);
this.BrowseButton.Name = "BrowseButton";
this.BrowseButton.Size = new System.Drawing.Size(95, 23);
this.BrowseButton.TabIndex = 4;
this.BrowseButton.TabIndex = 3;
this.BrowseButton.Text = "Browse...";
this.BrowseButton.UseVisualStyleBackColor = true;
this.BrowseButton.Click += new System.EventHandler(this.BrowseButton_Click);
@@ -272,10 +369,10 @@ namespace mRemoteNG.UI.Window
this.ArgumentsCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ArgumentsCheckBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.ArgumentsCheckBox.Location = new System.Drawing.Point(110, 76);
this.ArgumentsCheckBox.Location = new System.Drawing.Point(126, 76);
this.ArgumentsCheckBox.Name = "ArgumentsCheckBox";
this.ArgumentsCheckBox.Size = new System.Drawing.Size(565, 22);
this.ArgumentsCheckBox.TabIndex = 6;
this.ArgumentsCheckBox.Size = new System.Drawing.Size(591, 22);
this.ArgumentsCheckBox.TabIndex = 4;
this.ArgumentsCheckBox.LostFocus += new System.EventHandler(this.PropertyControl_ChangedOrLostFocus);
//
// FilenameTextBox
@@ -283,10 +380,10 @@ namespace mRemoteNG.UI.Window
this.FilenameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.FilenameTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.FilenameTextBox.Location = new System.Drawing.Point(110, 47);
this.FilenameTextBox.Location = new System.Drawing.Point(126, 47);
this.FilenameTextBox.Name = "FilenameTextBox";
this.FilenameTextBox.Size = new System.Drawing.Size(464, 22);
this.FilenameTextBox.TabIndex = 3;
this.FilenameTextBox.Size = new System.Drawing.Size(591, 22);
this.FilenameTextBox.TabIndex = 2;
this.FilenameTextBox.LostFocus += new System.EventHandler(this.PropertyControl_ChangedOrLostFocus);
//
// DisplayNameTextBox
@@ -294,16 +391,16 @@ namespace mRemoteNG.UI.Window
this.DisplayNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.DisplayNameTextBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.DisplayNameTextBox.Location = new System.Drawing.Point(110, 19);
this.DisplayNameTextBox.Location = new System.Drawing.Point(126, 19);
this.DisplayNameTextBox.Name = "DisplayNameTextBox";
this.DisplayNameTextBox.Size = new System.Drawing.Size(565, 22);
this.DisplayNameTextBox.Size = new System.Drawing.Size(591, 22);
this.DisplayNameTextBox.TabIndex = 1;
this.DisplayNameTextBox.LostFocus += new System.EventHandler(this.PropertyControl_ChangedOrLostFocus);
//
// ArgumentsLabel
//
this.ArgumentsLabel.AutoSize = true;
this.ArgumentsLabel.Location = new System.Drawing.Point(33, 79);
this.ArgumentsLabel.Location = new System.Drawing.Point(6, 78);
this.ArgumentsLabel.Name = "ArgumentsLabel";
this.ArgumentsLabel.Size = new System.Drawing.Size(66, 13);
this.ArgumentsLabel.TabIndex = 5;
@@ -313,7 +410,7 @@ namespace mRemoteNG.UI.Window
// FilenameLabel
//
this.FilenameLabel.AutoSize = true;
this.FilenameLabel.Location = new System.Drawing.Point(44, 50);
this.FilenameLabel.Location = new System.Drawing.Point(6, 50);
this.FilenameLabel.Name = "FilenameLabel";
this.FilenameLabel.Size = new System.Drawing.Size(56, 13);
this.FilenameLabel.TabIndex = 2;
@@ -323,7 +420,7 @@ namespace mRemoteNG.UI.Window
// DisplayNameLabel
//
this.DisplayNameLabel.AutoSize = true;
this.DisplayNameLabel.Location = new System.Drawing.Point(21, 22);
this.DisplayNameLabel.Location = new System.Drawing.Point(6, 21);
this.DisplayNameLabel.Name = "DisplayNameLabel";
this.DisplayNameLabel.Size = new System.Drawing.Size(79, 13);
this.DisplayNameLabel.TabIndex = 0;
@@ -337,11 +434,11 @@ namespace mRemoteNG.UI.Window
//
this.ToolStripContainer.ContentPanel.Controls.Add(this.PropertiesGroupBox);
this.ToolStripContainer.ContentPanel.Controls.Add(this.ToolsListObjView);
this.ToolStripContainer.ContentPanel.Size = new System.Drawing.Size(684, 298);
this.ToolStripContainer.ContentPanel.Size = new System.Drawing.Size(827, 376);
this.ToolStripContainer.Dock = System.Windows.Forms.DockStyle.Fill;
this.ToolStripContainer.Location = new System.Drawing.Point(0, 0);
this.ToolStripContainer.Name = "ToolStripContainer";
this.ToolStripContainer.Size = new System.Drawing.Size(684, 323);
this.ToolStripContainer.Size = new System.Drawing.Size(827, 401);
this.ToolStripContainer.TabIndex = 0;
this.ToolStripContainer.Text = "ToolStripContainer";
//
@@ -402,7 +499,7 @@ namespace mRemoteNG.UI.Window
//
// ExternalToolsWindow
//
this.ClientSize = new System.Drawing.Size(684, 323);
this.ClientSize = new System.Drawing.Size(827, 401);
this.Controls.Add(this.ToolStripContainer);
this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
@@ -435,5 +532,6 @@ namespace mRemoteNG.UI.Window
#endregion
private System.ComponentModel.IContainer components;
internal Controls.Base.NGGroupBox PropertiesGroupBox;
}
}

View File

@@ -14,7 +14,7 @@ namespace mRemoteNG.UI.Window
{
private readonly ExternalAppsSaver _externalAppsSaver;
private ExternalTool _selectedTool;
private ThemeManager _themeManager;
private readonly ThemeManager _themeManager;
public ExternalToolsWindow()
{
@@ -26,8 +26,6 @@ namespace mRemoteNG.UI.Window
_externalAppsSaver = new ExternalAppsSaver();
}
#region Private Methods
#region Event Handlers
private void ExternalTools_Load(object sender, EventArgs e)
@@ -115,9 +113,11 @@ namespace mRemoteNG.UI.Window
DisplayNameTextBox.Text = _selectedTool.DisplayName;
FilenameTextBox.Text = _selectedTool.FileName;
ArgumentsCheckBox.Text = _selectedTool.Arguments;
WorkingDirTextBox.Text = _selectedTool.WorkingDir;
WaitForExitCheckBox.Checked = _selectedTool.WaitForExit;
TryToIntegrateCheckBox.Checked = _selectedTool.TryIntegrate;
ShowOnToolbarCheckBox.Checked = _selectedTool.ShowOnToolbar;
RunElevatedCheckBox.Checked = _selectedTool.RunElevated;
}
else
{
@@ -150,9 +150,11 @@ namespace mRemoteNG.UI.Window
_selectedTool.DisplayName = DisplayNameTextBox.Text;
_selectedTool.FileName = FilenameTextBox.Text;
_selectedTool.Arguments = ArgumentsCheckBox.Text;
_selectedTool.WorkingDir = WorkingDirTextBox.Text;
_selectedTool.WaitForExit = WaitForExitCheckBox.Checked;
_selectedTool.TryIntegrate = TryToIntegrateCheckBox.Checked;
_selectedTool.ShowOnToolbar = ShowOnToolbarCheckBox.Checked;
_selectedTool.RunElevated = RunElevatedCheckBox.Checked;
UpdateToolsListObjView();
}
@@ -172,15 +174,36 @@ namespace mRemoteNG.UI.Window
if (browseDialog.ShowDialog() == DialogResult.OK)
{
FilenameTextBox.Text = browseDialog.FileName;
}
PropertyControl_ChangedOrLostFocus(this, e);
}
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage("UI.Window.ExternalTools.BrowseButton_Click() failed.", ex);
}
}
}
private void BrowseWorkingDir_Click(object sender, EventArgs e)
{
try
{
using (var browseDialog = new FolderBrowserDialog())
{
if (browseDialog.ShowDialog() == DialogResult.OK)
{
WorkingDirTextBox.Text = browseDialog.SelectedPath;
PropertyControl_ChangedOrLostFocus(this, e);
}
}
}
catch (Exception ex)
{
Runtime.MessageCollector.AddExceptionMessage(message: "UI.Window.ExternalTools.BrowseButton_Click() failed.", ex: ex, logOnly: true);
}
}
private void TryToIntegrateCheckBox_CheckedChanged(object sender, EventArgs e)
{
@@ -249,7 +272,7 @@ namespace mRemoteNG.UI.Window
PropertiesGroupBox.BackColor = _themeManager.ActiveTheme.Theme.ColorPalette.CommandBarMenuDefault.Background;
PropertiesGroupBox.ForeColor = _themeManager.ActiveTheme.Theme.ColorPalette.CommandBarMenuDefault.Text;
//Toollist grouping
ToolsListObjView.AlwaysGroupByColumn = this.FilenameColumnHeader;
//ToolsListObjView.AlwaysGroupByColumn = FilenameColumnHeader;
}
private void UpdateToolsListObjView(ExternalTool selectTool = null)
@@ -272,10 +295,11 @@ namespace mRemoteNG.UI.Window
{
selectedTools.Add(selectTool);
}
ToolsListObjView.BeginUpdate();
ToolsListObjView.Items.Clear();
ToolsListObjView.SetObjects(Runtime.ExternalToolsService.ExternalTools);
ToolsListObjView.AutoResizeColumns();
ToolsListObjView.EndUpdate();
}
catch (Exception ex)
@@ -288,7 +312,7 @@ namespace mRemoteNG.UI.Window
{
try
{
foreach (Object listViewObject in ToolsListObjView.SelectedObjects)
foreach (var listViewObject in ToolsListObjView.SelectedObjects)
{
((ExternalTool)listViewObject).Start();
@@ -300,7 +324,7 @@ namespace mRemoteNG.UI.Window
}
}
#endregion
}
}
}