we can now go back from the repo type selector page

This commit is contained in:
David Sparer
2017-02-10 14:15:14 -07:00
parent 67e0e34f40
commit 93d085e23e
4 changed files with 74 additions and 41 deletions

View File

@@ -32,11 +32,14 @@ namespace mRemoteNG.UI.Forms.CredentialManagerPages
private void buttonAdd_Click(object sender, EventArgs e)
{
var repoSelector = new CredentialRepositorySelectionPage(new ISelectionTarget<ICredentialRepositoryConfig>[]
{
new XmlCredentialRepositorySelector(),
new KeePassRepositorySelector()
}) {Dock = DockStyle.Fill};
var repoSelector = new CredentialRepositorySelectionPage(
new ISelectionTarget<ICredentialRepositoryConfig>[]
{
new XmlCredentialRepositorySelector(),
new KeePassRepositorySelector()
},
this
) {Dock = DockStyle.Fill};
var parent = Parent;
parent.Controls.Clear();
parent.Controls.Add(repoSelector);

View File

@@ -34,19 +34,19 @@
this.textBoxFilePath = new System.Windows.Forms.TextBox();
this.selectFilePathDialog = new System.Windows.Forms.SaveFileDialog();
this.label1 = new System.Windows.Forms.Label();
this.txtboxPassword = new mRemoteNG.UI.Controls.SecureTextBox();
this.txtboxPasswordVerify = new mRemoteNG.UI.Controls.SecureTextBox();
this.labelVerifyPassword = new System.Windows.Forms.Label();
this.buttonConfirm = new System.Windows.Forms.Button();
this.txtboxId = new System.Windows.Forms.TextBox();
this.labelId = new System.Windows.Forms.Label();
this.buttonBack = new System.Windows.Forms.Button();
this.txtboxPasswordVerify = new mRemoteNG.UI.Controls.SecureTextBox();
this.txtboxPassword = new mRemoteNG.UI.Controls.SecureTextBox();
this.SuspendLayout();
//
// labelPageTitle
//
this.labelPageTitle.AutoSize = true;
this.labelPageTitle.Location = new System.Drawing.Point(4, 4);
this.labelPageTitle.Location = new System.Drawing.Point(29, 6);
this.labelPageTitle.Name = "labelPageTitle";
this.labelPageTitle.Size = new System.Drawing.Size(132, 13);
this.labelPageTitle.TabIndex = 0;
@@ -55,7 +55,7 @@
// buttonBrowseFiles
//
this.buttonBrowseFiles.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonBrowseFiles.Location = new System.Drawing.Point(222, 121);
this.buttonBrowseFiles.Location = new System.Drawing.Point(276, 128);
this.buttonBrowseFiles.Name = "buttonBrowseFiles";
this.buttonBrowseFiles.Size = new System.Drawing.Size(75, 23);
this.buttonBrowseFiles.TabIndex = 1;
@@ -66,7 +66,7 @@
// labelFilePath
//
this.labelFilePath.AutoSize = true;
this.labelFilePath.Location = new System.Drawing.Point(4, 84);
this.labelFilePath.Location = new System.Drawing.Point(29, 86);
this.labelFilePath.Name = "labelFilePath";
this.labelFilePath.Size = new System.Drawing.Size(48, 13);
this.labelFilePath.TabIndex = 2;
@@ -76,42 +76,24 @@
//
this.textBoxFilePath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBoxFilePath.Location = new System.Drawing.Point(7, 100);
this.textBoxFilePath.Location = new System.Drawing.Point(32, 102);
this.textBoxFilePath.Name = "textBoxFilePath";
this.textBoxFilePath.Size = new System.Drawing.Size(290, 20);
this.textBoxFilePath.Size = new System.Drawing.Size(319, 20);
this.textBoxFilePath.TabIndex = 3;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(4, 147);
this.label1.Location = new System.Drawing.Point(29, 154);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(123, 13);
this.label1.TabIndex = 5;
this.label1.Text = "Set encryption password";
//
// txtboxPassword
//
this.txtboxPassword.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtboxPassword.Location = new System.Drawing.Point(7, 163);
this.txtboxPassword.Name = "txtboxPassword";
this.txtboxPassword.Size = new System.Drawing.Size(290, 20);
this.txtboxPassword.TabIndex = 6;
//
// txtboxPasswordVerify
//
this.txtboxPasswordVerify.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtboxPasswordVerify.Location = new System.Drawing.Point(7, 202);
this.txtboxPasswordVerify.Name = "txtboxPasswordVerify";
this.txtboxPasswordVerify.Size = new System.Drawing.Size(290, 20);
this.txtboxPasswordVerify.TabIndex = 7;
//
// labelVerifyPassword
//
this.labelVerifyPassword.AutoSize = true;
this.labelVerifyPassword.Location = new System.Drawing.Point(4, 186);
this.labelVerifyPassword.Location = new System.Drawing.Point(29, 193);
this.labelVerifyPassword.Name = "labelVerifyPassword";
this.labelVerifyPassword.Size = new System.Drawing.Size(81, 13);
this.labelVerifyPassword.TabIndex = 8;
@@ -120,7 +102,7 @@
// buttonConfirm
//
this.buttonConfirm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonConfirm.Location = new System.Drawing.Point(141, 234);
this.buttonConfirm.Location = new System.Drawing.Point(276, 248);
this.buttonConfirm.Name = "buttonConfirm";
this.buttonConfirm.Size = new System.Drawing.Size(75, 23);
this.buttonConfirm.TabIndex = 9;
@@ -130,17 +112,17 @@
//
// txtboxId
//
this.txtboxId.Location = new System.Drawing.Point(7, 49);
this.txtboxId.Location = new System.Drawing.Point(32, 51);
this.txtboxId.Name = "txtboxId";
this.txtboxId.ReadOnly = true;
this.txtboxId.Size = new System.Drawing.Size(212, 20);
this.txtboxId.Size = new System.Drawing.Size(238, 20);
this.txtboxId.TabIndex = 10;
this.txtboxId.TabStop = false;
//
// labelId
//
this.labelId.AutoSize = true;
this.labelId.Location = new System.Drawing.Point(4, 33);
this.labelId.Location = new System.Drawing.Point(29, 35);
this.labelId.Name = "labelId";
this.labelId.Size = new System.Drawing.Size(18, 13);
this.labelId.TabIndex = 11;
@@ -149,7 +131,7 @@
// buttonBack
//
this.buttonBack.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonBack.Location = new System.Drawing.Point(222, 234);
this.buttonBack.Location = new System.Drawing.Point(195, 248);
this.buttonBack.Name = "buttonBack";
this.buttonBack.Size = new System.Drawing.Size(75, 23);
this.buttonBack.TabIndex = 12;
@@ -157,6 +139,24 @@
this.buttonBack.UseVisualStyleBackColor = true;
this.buttonBack.Click += new System.EventHandler(this.buttonBack_Click);
//
// txtboxPasswordVerify
//
this.txtboxPasswordVerify.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtboxPasswordVerify.Location = new System.Drawing.Point(32, 209);
this.txtboxPasswordVerify.Name = "txtboxPasswordVerify";
this.txtboxPasswordVerify.Size = new System.Drawing.Size(263, 20);
this.txtboxPasswordVerify.TabIndex = 7;
//
// txtboxPassword
//
this.txtboxPassword.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtboxPassword.Location = new System.Drawing.Point(32, 170);
this.txtboxPassword.Name = "txtboxPassword";
this.txtboxPassword.Size = new System.Drawing.Size(263, 20);
this.txtboxPassword.TabIndex = 6;
//
// XmlCredentialRepositoryEditorPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -175,7 +175,7 @@
this.Controls.Add(this.labelPageTitle);
this.MinimumSize = new System.Drawing.Size(300, 260);
this.Name = "XmlCredentialRepositoryEditorPage";
this.Size = new System.Drawing.Size(300, 260);
this.Size = new System.Drawing.Size(354, 274);
this.ResumeLayout(false);
this.PerformLayout();

View File

@@ -33,6 +33,7 @@
this.objectListView = new BrightIdeasSoftware.ObjectListView();
this.olvColumnName = ((BrightIdeasSoftware.OLVColumn)(new BrightIdeasSoftware.OLVColumn()));
this.imageListLarge = new System.Windows.Forms.ImageList(this.components);
this.buttonBack = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.objectListView)).BeginInit();
this.SuspendLayout();
//
@@ -40,9 +41,9 @@
//
this.buttonContinue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonContinue.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.buttonContinue.Location = new System.Drawing.Point(320, 303);
this.buttonContinue.Location = new System.Drawing.Point(344, 312);
this.buttonContinue.Name = "buttonContinue";
this.buttonContinue.Size = new System.Drawing.Size(99, 32);
this.buttonContinue.Size = new System.Drawing.Size(75, 23);
this.buttonContinue.TabIndex = 4;
this.buttonContinue.Text = "Continue";
this.buttonContinue.UseVisualStyleBackColor = true;
@@ -95,10 +96,23 @@
this.imageListLarge.ImageSize = new System.Drawing.Size(32, 32);
this.imageListLarge.TransparentColor = System.Drawing.Color.Transparent;
//
// buttonBack
//
this.buttonBack.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonBack.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.buttonBack.Location = new System.Drawing.Point(263, 312);
this.buttonBack.Name = "buttonBack";
this.buttonBack.Size = new System.Drawing.Size(75, 23);
this.buttonBack.TabIndex = 6;
this.buttonBack.Text = "Back";
this.buttonBack.UseVisualStyleBackColor = true;
this.buttonBack.Click += new System.EventHandler(this.buttonBack_Click);
//
// CredentialRepositorySelectionPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.buttonBack);
this.Controls.Add(this.objectListView);
this.Controls.Add(this.buttonContinue);
this.Name = "CredentialRepositorySelectionPage";
@@ -114,5 +128,6 @@
private BrightIdeasSoftware.ObjectListView objectListView;
private BrightIdeasSoftware.OLVColumn olvColumnName;
private System.Windows.Forms.ImageList imageListLarge;
private System.Windows.Forms.Button buttonBack;
}
}

View File

@@ -10,11 +10,19 @@ namespace mRemoteNG.UI.Forms.CredentialManagerPages
{
public partial class CredentialRepositorySelectionPage : UserControl, ICredentialManagerPage
{
private Control _previousPage;
public string PageName { get; } = "add repo";
public Image PageIcon { get; }
public CredentialRepositorySelectionPage(IEnumerable<ISelectionTarget<ICredentialRepositoryConfig>> selectionTargets)
public CredentialRepositorySelectionPage(IEnumerable<ISelectionTarget<ICredentialRepositoryConfig>> selectionTargets, Control previousPage)
{
if (selectionTargets == null)
throw new ArgumentNullException(nameof(selectionTargets));
if (previousPage == null)
throw new ArgumentNullException(nameof(previousPage));
_previousPage = previousPage;
InitializeComponent();
SetupListView(selectionTargets);
}
@@ -45,5 +53,12 @@ namespace mRemoteNG.UI.Forms.CredentialManagerPages
parent.Controls.Clear();
parent.Controls.Add(editorPage);
}
private void buttonBack_Click(object sender, EventArgs e)
{
var parent = Parent;
parent.Controls.Clear();
parent.Controls.Add(_previousPage);
}
}
}