Add help to link creation, as the UI was hard to figure out what to do next.

This commit is contained in:
Tim Young 2023-08-18 10:57:01 -07:00
parent dca858ff46
commit 5b20dd671c
2 changed files with 58 additions and 8 deletions

View File

@ -37,6 +37,7 @@
this.cbLinkType = new System.Windows.Forms.ComboBox();
this.pbSource = new System.Windows.Forms.PictureBox();
this.pbDest = new System.Windows.Forms.PictureBox();
this.lblInstructions = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pbSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pbDest)).BeginInit();
this.SuspendLayout();
@ -46,7 +47,7 @@
this.lbSrcHost.FormattingEnabled = true;
this.lbSrcHost.ItemHeight = 29;
this.lbSrcHost.Location = new System.Drawing.Point(20, 185);
this.lbSrcHost.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.lbSrcHost.Margin = new System.Windows.Forms.Padding(5);
this.lbSrcHost.Name = "lbSrcHost";
this.lbSrcHost.Size = new System.Drawing.Size(177, 149);
this.lbSrcHost.TabIndex = 0;
@ -57,7 +58,7 @@
this.lbSrcNic.FormattingEnabled = true;
this.lbSrcNic.ItemHeight = 29;
this.lbSrcNic.Location = new System.Drawing.Point(210, 185);
this.lbSrcNic.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.lbSrcNic.Margin = new System.Windows.Forms.Padding(5);
this.lbSrcNic.Name = "lbSrcNic";
this.lbSrcNic.Size = new System.Drawing.Size(153, 149);
this.lbSrcNic.TabIndex = 1;
@ -68,7 +69,7 @@
this.lbDstNic.FormattingEnabled = true;
this.lbDstNic.ItemHeight = 29;
this.lbDstNic.Location = new System.Drawing.Point(702, 185);
this.lbDstNic.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.lbDstNic.Margin = new System.Windows.Forms.Padding(5);
this.lbDstNic.Name = "lbDstNic";
this.lbDstNic.Size = new System.Drawing.Size(153, 149);
this.lbDstNic.TabIndex = 3;
@ -79,7 +80,7 @@
this.lbDstHost.FormattingEnabled = true;
this.lbDstHost.ItemHeight = 29;
this.lbDstHost.Location = new System.Drawing.Point(512, 185);
this.lbDstHost.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.lbDstHost.Margin = new System.Windows.Forms.Padding(5);
this.lbDstHost.Name = "lbDstHost";
this.lbDstHost.Size = new System.Drawing.Size(177, 149);
this.lbDstHost.TabIndex = 2;
@ -88,7 +89,7 @@
// btnLink
//
this.btnLink.Location = new System.Drawing.Point(372, 185);
this.btnLink.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.btnLink.Margin = new System.Windows.Forms.Padding(5);
this.btnLink.Name = "btnLink";
this.btnLink.Size = new System.Drawing.Size(131, 42);
this.btnLink.TabIndex = 4;
@ -99,7 +100,7 @@
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(372, 237);
this.btnCancel.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.btnCancel.Margin = new System.Windows.Forms.Padding(5);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(131, 42);
this.btnCancel.TabIndex = 5;
@ -111,7 +112,7 @@
//
this.cbLinkType.FormattingEnabled = true;
this.cbLinkType.Location = new System.Drawing.Point(372, 290);
this.cbLinkType.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.cbLinkType.Margin = new System.Windows.Forms.Padding(5);
this.cbLinkType.Name = "cbLinkType";
this.cbLinkType.Size = new System.Drawing.Size(128, 37);
this.cbLinkType.TabIndex = 6;
@ -134,11 +135,21 @@
this.pbDest.TabIndex = 8;
this.pbDest.TabStop = false;
//
// lblInstructions
//
this.lblInstructions.AutoSize = true;
this.lblInstructions.Location = new System.Drawing.Point(15, 351);
this.lblInstructions.Name = "lblInstructions";
this.lblInstructions.Size = new System.Drawing.Size(79, 29);
this.lblInstructions.TabIndex = 9;
this.lblInstructions.Text = "label1";
//
// LinkEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(14F, 29F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(866, 389);
this.Controls.Add(this.lblInstructions);
this.Controls.Add(this.pbDest);
this.Controls.Add(this.pbSource);
this.Controls.Add(this.cbLinkType);
@ -150,13 +161,14 @@
this.Controls.Add(this.lbSrcHost);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Icon = global::EduNetworkBuilder.Properties.Resources.NBIco;
this.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.Margin = new System.Windows.Forms.Padding(5);
this.Name = "LinkEditor";
this.Text = "LinkEditor";
this.Shown += new System.EventHandler(this.LinkEditor_Shown);
((System.ComponentModel.ISupportInitialize)(this.pbSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pbDest)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
@ -171,5 +183,6 @@
private System.Windows.Forms.ComboBox cbLinkType;
private System.Windows.Forms.PictureBox pbSource;
private System.Windows.Forms.PictureBox pbDest;
private System.Windows.Forms.Label lblInstructions;
}
}

View File

@ -232,6 +232,43 @@ namespace EduNetworkBuilder
cbLinkType.SelectedItem = theLinkType;
else
cbLinkType.SelectedIndex = 0;
//Update the instructions.
lblInstructions.Text = ""; //empty them out if we do not need instructions
lbSrcHost.ResetForeColor() ;
lbSrcNic.ResetForeColor();
lbDstHost.ResetForeColor();
lbDstNic.ResetForeColor();
btnLink.ForeColor = Color.Black;
if (lbSrcHost.SelectedItem == null)
{
lblInstructions.Text = "Choose the source device.";
lbSrcHost.ForeColor = Color.Red;
}
else if (lbSrcNic.SelectedItem == null)
{
lblInstructions.Text = "Choose the NIC / Port on the source device.";
lbSrcNic.ForeColor = Color.Red;
}
else if (lbDstHost.SelectedItem == null)
{
lblInstructions.Text = "Choose the destination device.";
lbDstHost.ForeColor = Color.Red;
}
else if (lbDstNic.SelectedItem == null)
{
lblInstructions.Text = "Choose the NIC / Port on the destination device.";
lbDstNic.ForeColor = Color.Red;
}
else
{
//We have a valid link. We are ready to press the link.
lblInstructions.Text = "This is a valid link. Press LINK to continue";
btnLink.ForeColor = Color.Red;
}
processing = false;
}