From 8a5f0f248ea1236ec1866d3d5ec939ba93134592 Mon Sep 17 00:00:00 2001 From: Faryan Rezagholi Date: Sat, 4 Sep 2021 00:52:04 +0200 Subject: [PATCH] open credential manager from connection tree window --- .../UI/Window/ConnectionTreeWindow.Designer.cs | 11 +++++++++++ mRemoteNG/UI/Window/ConnectionTreeWindow.cs | 13 +++++++++++++ 2 files changed, 24 insertions(+) diff --git a/mRemoteNG/UI/Window/ConnectionTreeWindow.Designer.cs b/mRemoteNG/UI/Window/ConnectionTreeWindow.Designer.cs index b293ffb23..ae79f18b4 100644 --- a/mRemoteNG/UI/Window/ConnectionTreeWindow.Designer.cs +++ b/mRemoteNG/UI/Window/ConnectionTreeWindow.Designer.cs @@ -29,6 +29,7 @@ namespace mRemoteNG.UI.Window this.mMenViewCollapseAllFolders = new System.Windows.Forms.ToolStripMenuItem(); this.mMenSort = new System.Windows.Forms.ToolStripMenuItem(); this.mMenFavorites = new System.Windows.Forms.ToolStripMenuItem(); + this.mMenCredentials = new System.Windows.Forms.ToolStripMenuItem(); this.vsToolStripExtender = new WeifenLuo.WinFormsUI.Docking.VisualStudioToolStripExtender(this.components); this.pbSearch = new MrngPictureBox(this.components); this.txtSearch = new mRemoteNG.UI.Controls.MrngSearchBox(); @@ -82,6 +83,7 @@ namespace mRemoteNG.UI.Window this.mMenViewExpandAllFolders, this.mMenViewCollapseAllFolders, this.mMenSort, + this.mMenCredentials, this.mMenFavorites}); this.msMain.Location = new System.Drawing.Point(0, 0); this.msMain.Name = "msMain"; @@ -139,6 +141,14 @@ namespace mRemoteNG.UI.Window this.mMenFavorites.Size = new System.Drawing.Size(28, 20); this.mMenFavorites.Text = "Favorites"; // + // mMenCredentials + // + this.mMenCredentials.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.mMenCredentials.Image = global::mRemoteNG.Properties.Resources.Key_16x; + this.mMenCredentials.Name = "mMenCredentials"; + this.mMenCredentials.Size = new System.Drawing.Size(28, 20); + this.mMenCredentials.Text = "Credentials"; + // // vsToolStripExtender // this.vsToolStripExtender.DefaultRenderer = null; @@ -219,5 +229,6 @@ namespace mRemoteNG.UI.Window internal Controls.MrngSearchBox txtSearch; public System.Windows.Forms.TableLayoutPanel searchBoxLayoutPanel; internal System.Windows.Forms.ToolStripMenuItem mMenFavorites; + internal System.Windows.Forms.ToolStripMenuItem mMenCredentials; } } diff --git a/mRemoteNG/UI/Window/ConnectionTreeWindow.cs b/mRemoteNG/UI/Window/ConnectionTreeWindow.cs index ae59435ae..c62dde374 100644 --- a/mRemoteNG/UI/Window/ConnectionTreeWindow.cs +++ b/mRemoteNG/UI/Window/ConnectionTreeWindow.cs @@ -8,12 +8,15 @@ using mRemoteNG.App; using mRemoteNG.Config.Connections; using mRemoteNG.Connection; using mRemoteNG.Container; +using mRemoteNG.Credential; using mRemoteNG.Properties; using mRemoteNG.Themes; using mRemoteNG.Tree; using mRemoteNG.Tree.ClickHandlers; using mRemoteNG.Tree.Root; using mRemoteNG.UI.Controls.ConnectionTree; +using mRemoteNG.UI.Forms; +using mRemoteNG.UI.Forms.CredentialManager; using mRemoteNG.UI.TaskDialog; using WeifenLuo.WinFormsUI.Docking; @@ -31,6 +34,10 @@ namespace mRemoteNG.UI.Window public ConnectionTree ConnectionTree { get; set; } + public CredentialService CredentialService { get; set; } = Runtime.CredentialService; + + public UnlockerFormFactory UnlockerFormFactory { get; set; } = new UnlockerFormFactory(); + public ConnectionTreeWindow() : this(new DockContent()) { } @@ -91,6 +98,7 @@ namespace mRemoteNG.UI.Window mMenViewCollapseAllFolders.ToolTipText = Language.CollapseAllFolders; mMenSort.ToolTipText = Language.Sort; mMenFavorites.ToolTipText = Language.Favorites; + mMenCredentials.ToolTipText = Language.Credentials; txtSearch.Text = Language.SearchPrompt; } @@ -231,6 +239,11 @@ namespace mRemoteNG.UI.Window mMenFavorites.DropDownItems.AddRange(favoritesList.ToArray()); mMenFavorites.ShowDropDown(); }; + mMenCredentials.Click += (sender, args) => + { + var credentialManagerForm = new CredentialManagerForm(CredentialService, UnlockerFormFactory); + credentialManagerForm.ShowDialog(); + }; } private void FavoriteMenuItem_MouseUp(object sender, MouseEventArgs e)