Compare commits
3 Commits
5fc1e19f71
...
5b20dd671c
Author | SHA1 | Date | |
---|---|---|---|
5b20dd671c | |||
dca858ff46 | |||
2f4cf36011 |
89
EduNetworkBuilder/LinkEditor.Designer.cs
generated
89
EduNetworkBuilder/LinkEditor.Designer.cs
generated
@ -35,53 +35,63 @@
|
||||
this.btnLink = new System.Windows.Forms.Button();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
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();
|
||||
//
|
||||
// lbSrcHost
|
||||
//
|
||||
this.lbSrcHost.FormattingEnabled = true;
|
||||
this.lbSrcHost.ItemHeight = 16;
|
||||
this.lbSrcHost.Location = new System.Drawing.Point(9, 18);
|
||||
this.lbSrcHost.ItemHeight = 29;
|
||||
this.lbSrcHost.Location = new System.Drawing.Point(20, 185);
|
||||
this.lbSrcHost.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.lbSrcHost.Name = "lbSrcHost";
|
||||
this.lbSrcHost.Size = new System.Drawing.Size(103, 84);
|
||||
this.lbSrcHost.Size = new System.Drawing.Size(177, 149);
|
||||
this.lbSrcHost.TabIndex = 0;
|
||||
this.lbSrcHost.SelectedIndexChanged += new System.EventHandler(this.lbSrcHost_SelectedIndexChanged);
|
||||
//
|
||||
// lbSrcNic
|
||||
//
|
||||
this.lbSrcNic.FormattingEnabled = true;
|
||||
this.lbSrcNic.ItemHeight = 16;
|
||||
this.lbSrcNic.Location = new System.Drawing.Point(118, 18);
|
||||
this.lbSrcNic.ItemHeight = 29;
|
||||
this.lbSrcNic.Location = new System.Drawing.Point(210, 185);
|
||||
this.lbSrcNic.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.lbSrcNic.Name = "lbSrcNic";
|
||||
this.lbSrcNic.Size = new System.Drawing.Size(89, 84);
|
||||
this.lbSrcNic.Size = new System.Drawing.Size(153, 149);
|
||||
this.lbSrcNic.TabIndex = 1;
|
||||
this.lbSrcNic.SelectedIndexChanged += new System.EventHandler(this.lbSrcNic_SelectedIndexChanged);
|
||||
//
|
||||
// lbDstNic
|
||||
//
|
||||
this.lbDstNic.FormattingEnabled = true;
|
||||
this.lbDstNic.ItemHeight = 16;
|
||||
this.lbDstNic.Location = new System.Drawing.Point(399, 18);
|
||||
this.lbDstNic.ItemHeight = 29;
|
||||
this.lbDstNic.Location = new System.Drawing.Point(702, 185);
|
||||
this.lbDstNic.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.lbDstNic.Name = "lbDstNic";
|
||||
this.lbDstNic.Size = new System.Drawing.Size(89, 84);
|
||||
this.lbDstNic.Size = new System.Drawing.Size(153, 149);
|
||||
this.lbDstNic.TabIndex = 3;
|
||||
this.lbDstNic.SelectedIndexChanged += new System.EventHandler(this.lbDstNic_SelectedIndexChanged);
|
||||
//
|
||||
// lbDstHost
|
||||
//
|
||||
this.lbDstHost.FormattingEnabled = true;
|
||||
this.lbDstHost.ItemHeight = 16;
|
||||
this.lbDstHost.Location = new System.Drawing.Point(290, 18);
|
||||
this.lbDstHost.ItemHeight = 29;
|
||||
this.lbDstHost.Location = new System.Drawing.Point(512, 185);
|
||||
this.lbDstHost.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.lbDstHost.Name = "lbDstHost";
|
||||
this.lbDstHost.Size = new System.Drawing.Size(103, 84);
|
||||
this.lbDstHost.Size = new System.Drawing.Size(177, 149);
|
||||
this.lbDstHost.TabIndex = 2;
|
||||
this.lbDstHost.SelectedIndexChanged += new System.EventHandler(this.lbDstHost_SelectedIndexChanged);
|
||||
//
|
||||
// btnLink
|
||||
//
|
||||
this.btnLink.Location = new System.Drawing.Point(210, 18);
|
||||
this.btnLink.Location = new System.Drawing.Point(372, 185);
|
||||
this.btnLink.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.btnLink.Name = "btnLink";
|
||||
this.btnLink.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnLink.Size = new System.Drawing.Size(131, 42);
|
||||
this.btnLink.TabIndex = 4;
|
||||
this.btnLink.Text = "Link";
|
||||
this.btnLink.UseVisualStyleBackColor = true;
|
||||
@ -89,9 +99,10 @@
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.Location = new System.Drawing.Point(210, 47);
|
||||
this.btnCancel.Location = new System.Drawing.Point(372, 237);
|
||||
this.btnCancel.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnCancel.Size = new System.Drawing.Size(131, 42);
|
||||
this.btnCancel.TabIndex = 5;
|
||||
this.btnCancel.Text = "Cancel";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
@ -100,16 +111,47 @@
|
||||
// cbLinkType
|
||||
//
|
||||
this.cbLinkType.FormattingEnabled = true;
|
||||
this.cbLinkType.Location = new System.Drawing.Point(210, 76);
|
||||
this.cbLinkType.Location = new System.Drawing.Point(372, 290);
|
||||
this.cbLinkType.Margin = new System.Windows.Forms.Padding(5);
|
||||
this.cbLinkType.Name = "cbLinkType";
|
||||
this.cbLinkType.Size = new System.Drawing.Size(75, 24);
|
||||
this.cbLinkType.Size = new System.Drawing.Size(128, 37);
|
||||
this.cbLinkType.TabIndex = 6;
|
||||
//
|
||||
// pbSource
|
||||
//
|
||||
this.pbSource.Location = new System.Drawing.Point(120, 28);
|
||||
this.pbSource.Name = "pbSource";
|
||||
this.pbSource.Size = new System.Drawing.Size(167, 149);
|
||||
this.pbSource.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||
this.pbSource.TabIndex = 7;
|
||||
this.pbSource.TabStop = false;
|
||||
//
|
||||
// pbDest
|
||||
//
|
||||
this.pbDest.Location = new System.Drawing.Point(607, 28);
|
||||
this.pbDest.Name = "pbDest";
|
||||
this.pbDest.Size = new System.Drawing.Size(167, 149);
|
||||
this.pbDest.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||
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(8F, 16F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(14F, 29F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(495, 117);
|
||||
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);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.btnLink);
|
||||
@ -119,10 +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);
|
||||
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();
|
||||
|
||||
}
|
||||
|
||||
@ -135,5 +181,8 @@
|
||||
private System.Windows.Forms.Button btnLink;
|
||||
private System.Windows.Forms.Button btnCancel;
|
||||
private System.Windows.Forms.ComboBox cbLinkType;
|
||||
private System.Windows.Forms.PictureBox pbSource;
|
||||
private System.Windows.Forms.PictureBox pbDest;
|
||||
private System.Windows.Forms.Label lblInstructions;
|
||||
}
|
||||
}
|
@ -45,6 +45,7 @@ namespace EduNetworkBuilder
|
||||
lbSrcHost.SelectedIndex = tindex;
|
||||
UpdateDeviceList();
|
||||
}
|
||||
pbSource.Image = new Bitmap(Source.GetImage());
|
||||
}
|
||||
if (Dest != null)
|
||||
{
|
||||
@ -54,6 +55,7 @@ namespace EduNetworkBuilder
|
||||
lbDstHost.SelectedIndex = tindex;
|
||||
UpdateDeviceList();
|
||||
}
|
||||
pbDest.Image = new Bitmap(Dest.GetImage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,11 +88,12 @@ namespace EduNetworkBuilder
|
||||
if (lbDstHost.SelectedItem != null)
|
||||
DstHost = lbDstHost.SelectedItem.ToString();
|
||||
string SrcNic = "";
|
||||
NetworkDevice Src = null;
|
||||
if (lbSrcNic.SelectedItem != null)
|
||||
{
|
||||
Src = myNet.DeviceFromName(lbSrcHost.SelectedItem.ToString());
|
||||
SrcNic = lbSrcNic.SelectedItem.ToString();
|
||||
int sNicIndex = lbSrcNic.SelectedIndex;
|
||||
NetworkDevice Src = myNet.DeviceFromName(lbSrcHost.SelectedItem.ToString());
|
||||
NetworkCard sNic = null;
|
||||
if(Src != null) sNic = Src.NicFromName(lbSrcNic.SelectedItem.ToString());
|
||||
if(sNic != null) srcNicType = sNic.GetNicType;
|
||||
@ -176,6 +179,33 @@ namespace EduNetworkBuilder
|
||||
lbDstNic.SelectedIndex = tint;
|
||||
}
|
||||
|
||||
if (lbSrcHost.SelectedItem != null)
|
||||
{
|
||||
Src = myNet.DeviceFromName(lbSrcHost.SelectedItem.ToString());
|
||||
pbSource.Image = Src.GetImage();
|
||||
pbSource.Invalidate();
|
||||
}
|
||||
else
|
||||
{
|
||||
pbSource.Image = null;
|
||||
pbSource.Invalidate();
|
||||
}
|
||||
|
||||
if (lbDstHost.SelectedItem != null)
|
||||
{
|
||||
NetworkDevice Dest = myNet.DeviceFromName(lbDstHost.SelectedItem.ToString());
|
||||
if (Dest != null)
|
||||
{
|
||||
pbDest.Image = Dest.GetImage();
|
||||
pbDest.Invalidate();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pbDest.Image = null;
|
||||
pbDest.Invalidate();
|
||||
}
|
||||
|
||||
if (lbDstNic.SelectedIndex > -1 && lbSrcNic.SelectedIndex > -1)
|
||||
{
|
||||
btnLink.Enabled = true;
|
||||
@ -202,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;
|
||||
}
|
||||
|
||||
|
@ -755,6 +755,15 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a copy of the image for this device
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Image GetImage()
|
||||
{
|
||||
return new Bitmap(MyImage);
|
||||
}
|
||||
|
||||
//This function heavily borrowed from: http://stackoverflow.com/questions/1563038/fast-work-with-bitmaps-in-c-sharp
|
||||
public Image ColoredImage(Image BaseImage)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user