Merge branch 'mcktr-mcktr/feature/4128-win-edit-button'

fixes #4128
This commit is contained in:
Noah Hilverling 2017-10-16 15:08:47 +02:00
commit 61e441be41
5 changed files with 685 additions and 639 deletions

View File

@ -81,6 +81,7 @@
this.txtError = new System.Windows.Forms.TextBox(); this.txtError = new System.Windows.Forms.TextBox();
this.lblError = new System.Windows.Forms.Label(); this.lblError = new System.Windows.Forms.Label();
this.picBanner = new System.Windows.Forms.PictureBox(); this.picBanner = new System.Windows.Forms.PictureBox();
this.btnEditEndpoint = new System.Windows.Forms.Button();
this.tabFinish.SuspendLayout(); this.tabFinish.SuspendLayout();
this.tabConfigure.SuspendLayout(); this.tabConfigure.SuspendLayout();
this.tabParameters.SuspendLayout(); this.tabParameters.SuspendLayout();
@ -345,6 +346,7 @@
// //
// groupBox1 // groupBox1
// //
this.groupBox1.Controls.Add(this.btnEditEndpoint);
this.groupBox1.Controls.Add(this.btnRemoveEndpoint); this.groupBox1.Controls.Add(this.btnRemoveEndpoint);
this.groupBox1.Controls.Add(this.btnAddEndpoint); this.groupBox1.Controls.Add(this.btnAddEndpoint);
this.groupBox1.Controls.Add(this.lvwEndpoints); this.groupBox1.Controls.Add(this.lvwEndpoints);
@ -360,7 +362,7 @@
// btnRemoveEndpoint // btnRemoveEndpoint
// //
this.btnRemoveEndpoint.Enabled = false; this.btnRemoveEndpoint.Enabled = false;
this.btnRemoveEndpoint.Location = new System.Drawing.Point(520, 112); this.btnRemoveEndpoint.Location = new System.Drawing.Point(520, 141);
this.btnRemoveEndpoint.Name = "btnRemoveEndpoint"; this.btnRemoveEndpoint.Name = "btnRemoveEndpoint";
this.btnRemoveEndpoint.Size = new System.Drawing.Size(75, 23); this.btnRemoveEndpoint.Size = new System.Drawing.Size(75, 23);
this.btnRemoveEndpoint.TabIndex = 6; this.btnRemoveEndpoint.TabIndex = 6;
@ -626,6 +628,17 @@
this.picBanner.TabIndex = 1; this.picBanner.TabIndex = 1;
this.picBanner.TabStop = false; this.picBanner.TabStop = false;
// //
// btnEditEndpoint
//
this.btnEditEndpoint.Enabled = false;
this.btnEditEndpoint.Location = new System.Drawing.Point(520, 112);
this.btnEditEndpoint.Name = "btnEditEndpoint";
this.btnEditEndpoint.Size = new System.Drawing.Size(75, 23);
this.btnEditEndpoint.TabIndex = 7;
this.btnEditEndpoint.Text = "Edit";
this.btnEditEndpoint.UseVisualStyleBackColor = true;
this.btnEditEndpoint.Click += new System.EventHandler(this.btnEditEndpoint_Click);
//
// SetupWizard // SetupWizard
// //
this.AcceptButton = this.btnNext; this.AcceptButton = this.btnNext;
@ -723,6 +736,7 @@
private System.Windows.Forms.CheckBox chkInstallNSCP; private System.Windows.Forms.CheckBox chkInstallNSCP;
private System.Windows.Forms.TextBox txtUser; private System.Windows.Forms.TextBox txtUser;
private System.Windows.Forms.CheckBox chkRunServiceAsThisUser; private System.Windows.Forms.CheckBox chkRunServiceAsThisUser;
private System.Windows.Forms.Button btnEditEndpoint;
} }
} }

View File

@ -478,6 +478,7 @@ namespace Icinga
private void lvwEndpoints_SelectedIndexChanged(object sender, EventArgs e) private void lvwEndpoints_SelectedIndexChanged(object sender, EventArgs e)
{ {
btnRemoveEndpoint.Enabled = lvwEndpoints.SelectedItems.Count > 0; btnRemoveEndpoint.Enabled = lvwEndpoints.SelectedItems.Count > 0;
btnEditEndpoint.Enabled = lvwEndpoints.SelectedItems.Count > 0;
} }
private void lvwX509Fields_SelectedIndexChanged(object sender, EventArgs e) private void lvwX509Fields_SelectedIndexChanged(object sender, EventArgs e)
@ -503,5 +504,36 @@ namespace Icinga
if (!txtUser.Enabled) if (!txtUser.Enabled)
txtUser.Text = Icinga2User; txtUser.Text = Icinga2User;
} }
private void btnEditEndpoint_Click(object sender, EventArgs e)
{
ListViewItem lvi = lvwEndpoints.SelectedItems[0];
EndpointInputBox eib = new EndpointInputBox();
eib.Text = "Edit Endpoint";
eib.txtInstanceName.Text = lvi.SubItems[0].Text;
if (lvi.SubItems.Count >= 2) {
eib.txtHost.Text = lvi.SubItems[1].Text;
eib.txtPort.Text = lvi.SubItems[2].Text;
eib.chkConnect.Checked = true;
}
if (eib.ShowDialog(this) == DialogResult.Cancel)
return;
lvwEndpoints.Items.Remove(lvi);
ListViewItem lvi2 = new ListViewItem();
lvi2.Text = eib.txtInstanceName.Text;
if (eib.chkConnect.Checked) {
lvi2.SubItems.Add(eib.txtHost.Text);
lvi2.SubItems.Add(eib.txtPort.Text);
}
lvwEndpoints.Items.Add(lvi2);
} }
} }
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 35 KiB