From 4b0236cbd68688fc7229fc1e4b5fda2f3c72b45b Mon Sep 17 00:00:00 2001 From: BlubbFish Date: Fri, 11 Jun 2010 22:20:15 +0000 Subject: [PATCH] Fixing bugs --- NetMonitorClient/EditNetworks.Designer.cs | 132 +++++++++++----------- NetMonitorClient/EditNetworks.cs | 29 ++++- 2 files changed, 93 insertions(+), 68 deletions(-) diff --git a/NetMonitorClient/EditNetworks.Designer.cs b/NetMonitorClient/EditNetworks.Designer.cs index 1e2d9ff..884142a 100644 --- a/NetMonitorClient/EditNetworks.Designer.cs +++ b/NetMonitorClient/EditNetworks.Designer.cs @@ -52,13 +52,17 @@ this.RadioIpAuto = new System.Windows.Forms.RadioButton(); this.RadioAllManu = new System.Windows.Forms.RadioButton(); this.RadioAllAuto = new System.Windows.Forms.RadioButton(); - this.label6 = new System.Windows.Forms.Label(); - this.label7 = new System.Windows.Forms.Label(); - this.label8 = new System.Windows.Forms.Label(); - this.label9 = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.tabPage2.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.groupBox4.SuspendLayout(); this.SuspendLayout(); // // BoxGateway @@ -205,18 +209,10 @@ // // tabPage2 // - this.tabPage2.Controls.Add(this.RadioWinsManu); - this.tabPage2.Controls.Add(this.RadioWinsAuto); - this.tabPage2.Controls.Add(this.RadioDnsManu); - this.tabPage2.Controls.Add(this.RadioDnsAuto); - this.tabPage2.Controls.Add(this.RadioIpManu); - this.tabPage2.Controls.Add(this.RadioIpAuto); - this.tabPage2.Controls.Add(this.RadioAllManu); - this.tabPage2.Controls.Add(this.RadioAllAuto); - this.tabPage2.Controls.Add(this.label6); - this.tabPage2.Controls.Add(this.label7); - this.tabPage2.Controls.Add(this.label8); - this.tabPage2.Controls.Add(this.label9); + this.tabPage2.Controls.Add(this.groupBox4); + this.tabPage2.Controls.Add(this.groupBox3); + this.tabPage2.Controls.Add(this.groupBox2); + this.tabPage2.Controls.Add(this.groupBox1); this.tabPage2.Location = new System.Drawing.Point(4, 22); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3); @@ -228,11 +224,10 @@ // RadioWinsManu // this.RadioWinsManu.AutoSize = true; - this.RadioWinsManu.Location = new System.Drawing.Point(63, 136); + this.RadioWinsManu.Location = new System.Drawing.Point(60, 16); this.RadioWinsManu.Name = "RadioWinsManu"; this.RadioWinsManu.Size = new System.Drawing.Size(62, 17); this.RadioWinsManu.TabIndex = 21; - this.RadioWinsManu.TabStop = true; this.RadioWinsManu.Tag = "0"; this.RadioWinsManu.Text = "Manuell"; this.RadioWinsManu.UseVisualStyleBackColor = true; @@ -240,11 +235,10 @@ // RadioWinsAuto // this.RadioWinsAuto.AutoSize = true; - this.RadioWinsAuto.Location = new System.Drawing.Point(9, 136); + this.RadioWinsAuto.Location = new System.Drawing.Point(6, 16); this.RadioWinsAuto.Name = "RadioWinsAuto"; this.RadioWinsAuto.Size = new System.Drawing.Size(47, 17); this.RadioWinsAuto.TabIndex = 20; - this.RadioWinsAuto.TabStop = true; this.RadioWinsAuto.Tag = "1"; this.RadioWinsAuto.Text = "Auto"; this.RadioWinsAuto.UseVisualStyleBackColor = true; @@ -252,11 +246,10 @@ // RadioDnsManu // this.RadioDnsManu.AutoSize = true; - this.RadioDnsManu.Location = new System.Drawing.Point(63, 97); + this.RadioDnsManu.Location = new System.Drawing.Point(59, 16); this.RadioDnsManu.Name = "RadioDnsManu"; this.RadioDnsManu.Size = new System.Drawing.Size(62, 17); this.RadioDnsManu.TabIndex = 19; - this.RadioDnsManu.TabStop = true; this.RadioDnsManu.Tag = "0"; this.RadioDnsManu.Text = "Manuell"; this.RadioDnsManu.UseVisualStyleBackColor = true; @@ -264,11 +257,10 @@ // RadioDnsAuto // this.RadioDnsAuto.AutoSize = true; - this.RadioDnsAuto.Location = new System.Drawing.Point(9, 97); + this.RadioDnsAuto.Location = new System.Drawing.Point(5, 16); this.RadioDnsAuto.Name = "RadioDnsAuto"; this.RadioDnsAuto.Size = new System.Drawing.Size(47, 17); this.RadioDnsAuto.TabIndex = 18; - this.RadioDnsAuto.TabStop = true; this.RadioDnsAuto.Tag = "1"; this.RadioDnsAuto.Text = "Auto"; this.RadioDnsAuto.UseVisualStyleBackColor = true; @@ -276,11 +268,10 @@ // RadioIpManu // this.RadioIpManu.AutoSize = true; - this.RadioIpManu.Location = new System.Drawing.Point(63, 61); + this.RadioIpManu.Location = new System.Drawing.Point(59, 16); this.RadioIpManu.Name = "RadioIpManu"; this.RadioIpManu.Size = new System.Drawing.Size(62, 17); this.RadioIpManu.TabIndex = 17; - this.RadioIpManu.TabStop = true; this.RadioIpManu.Tag = "0"; this.RadioIpManu.Text = "Manuell"; this.RadioIpManu.UseVisualStyleBackColor = true; @@ -288,11 +279,10 @@ // RadioIpAuto // this.RadioIpAuto.AutoSize = true; - this.RadioIpAuto.Location = new System.Drawing.Point(9, 61); + this.RadioIpAuto.Location = new System.Drawing.Point(5, 16); this.RadioIpAuto.Name = "RadioIpAuto"; this.RadioIpAuto.Size = new System.Drawing.Size(47, 17); this.RadioIpAuto.TabIndex = 16; - this.RadioIpAuto.TabStop = true; this.RadioIpAuto.Tag = "1"; this.RadioIpAuto.Text = "Auto"; this.RadioIpAuto.UseVisualStyleBackColor = true; @@ -300,11 +290,10 @@ // RadioAllManu // this.RadioAllManu.AutoSize = true; - this.RadioAllManu.Location = new System.Drawing.Point(63, 20); + this.RadioAllManu.Location = new System.Drawing.Point(61, 16); this.RadioAllManu.Name = "RadioAllManu"; this.RadioAllManu.Size = new System.Drawing.Size(62, 17); this.RadioAllManu.TabIndex = 15; - this.RadioAllManu.TabStop = true; this.RadioAllManu.Tag = "0"; this.RadioAllManu.Text = "Manuell"; this.RadioAllManu.UseVisualStyleBackColor = true; @@ -312,7 +301,7 @@ // RadioAllAuto // this.RadioAllAuto.AutoSize = true; - this.RadioAllAuto.Location = new System.Drawing.Point(9, 20); + this.RadioAllAuto.Location = new System.Drawing.Point(6, 16); this.RadioAllAuto.Name = "RadioAllAuto"; this.RadioAllAuto.Size = new System.Drawing.Size(47, 17); this.RadioAllAuto.TabIndex = 14; @@ -320,41 +309,49 @@ this.RadioAllAuto.Text = "Auto"; this.RadioAllAuto.UseVisualStyleBackColor = true; // - // label6 + // groupBox1 // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(6, 3); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(29, 13); - this.label6.TabIndex = 10; - this.label6.Text = "Alles"; + this.groupBox1.Controls.Add(this.RadioAllAuto); + this.groupBox1.Controls.Add(this.RadioAllManu); + this.groupBox1.Location = new System.Drawing.Point(6, 3); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(192, 39); + this.groupBox1.TabIndex = 22; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Alles"; // - // label7 + // groupBox2 // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(6, 81); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(30, 13); - this.label7.TabIndex = 12; - this.label7.Text = "DNS"; + this.groupBox2.Controls.Add(this.RadioIpAuto); + this.groupBox2.Controls.Add(this.RadioIpManu); + this.groupBox2.Location = new System.Drawing.Point(7, 48); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(192, 39); + this.groupBox2.TabIndex = 23; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "IP Adresse"; // - // label8 + // groupBox3 // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(6, 120); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(31, 13); - this.label8.TabIndex = 13; - this.label8.Text = "Wins"; + this.groupBox3.Controls.Add(this.RadioDnsAuto); + this.groupBox3.Controls.Add(this.RadioDnsManu); + this.groupBox3.Location = new System.Drawing.Point(7, 93); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(192, 39); + this.groupBox3.TabIndex = 24; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Dns"; // - // label9 + // groupBox4 // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(6, 42); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(58, 13); - this.label9.TabIndex = 11; - this.label9.Text = "IP Adresse"; + this.groupBox4.Controls.Add(this.RadioWinsAuto); + this.groupBox4.Controls.Add(this.RadioWinsManu); + this.groupBox4.Location = new System.Drawing.Point(7, 138); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(192, 39); + this.groupBox4.TabIndex = 25; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "Wins"; // // EditNetworks // @@ -374,7 +371,14 @@ this.tabPage1.ResumeLayout(false); this.tabPage1.PerformLayout(); this.tabPage2.ResumeLayout(false); - this.tabPage2.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); + this.groupBox4.ResumeLayout(false); + this.groupBox4.PerformLayout(); this.ResumeLayout(false); } @@ -403,12 +407,12 @@ private System.Windows.Forms.RadioButton RadioIpAuto; private System.Windows.Forms.RadioButton RadioAllManu; private System.Windows.Forms.RadioButton RadioAllAuto; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.Label label9; private System.Windows.Forms.TextBox BoxName; private System.Windows.Forms.Label label10; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.GroupBox groupBox1; } } \ No newline at end of file diff --git a/NetMonitorClient/EditNetworks.cs b/NetMonitorClient/EditNetworks.cs index 594be9f..8af9533 100644 --- a/NetMonitorClient/EditNetworks.cs +++ b/NetMonitorClient/EditNetworks.cs @@ -89,32 +89,44 @@ namespace NetMonitorClient } else { + this.setAllMode(AMMode.Manu); if (ip == "auto") setIpMode(AMMode.Auto); else { setIpMode(AMMode.Manu); - this.BoxIpAdresse.Text = ip; + this.BoxIpAdresse.Text = ConvIp(ip); this.BoxSubnet.Text = ConvSubnet(subnet); - this.BoxGateway.Text = gateway; + this.BoxGateway.Text = ConvIp(gateway); } if (dns == "auto") setDnsMode(AMMode.Auto); else { setDnsMode(AMMode.Manu); - this.BoxDns.Text = dns; + this.BoxDns.Text = ConvIp(dns); } if (wins == "auto") setWinsMode(AMMode.Auto); else { setWinsMode(AMMode.Manu); - this.BoxWins.Text = wins; + this.BoxWins.Text = ConvIp(wins); } } } + private string ConvIp(string ip) + { + String[] ips = ip.Split('.'); + String[] ret = new String[ips.Length]; + for (int i = 0; i < ips.Length;i++) + { + ips[i] = int.Parse(ips[i]).ToString("D3"); + } + return string.Join(".", ips); + } + private string ConvSubnet(string subnet) { String[] ips = subnet.Split('.'); @@ -136,12 +148,16 @@ namespace NetMonitorClient { if (mode == AMMode.Auto) { + this.RadioAllAuto.Checked = true; + this.RadioAllManu.Checked = false; setIpMode(AMMode.Disable); setDnsMode(AMMode.Disable); setWinsMode(AMMode.Disable); } if (mode == AMMode.Manu) { + this.RadioAllManu.Checked = true; + this.RadioAllAuto.Checked = false; setIpMode(AMMode.Manu); setDnsMode(AMMode.Manu); setWinsMode(AMMode.Manu); @@ -206,6 +222,8 @@ namespace NetMonitorClient this.BoxIpAdresse.Text = ""; this.BoxSubnet.Enabled = false; this.BoxSubnet.Text = ""; + this.BoxGateway.Enabled = false; + this.BoxGateway.Text = ""; } if (mode == AMMode.Disable) { @@ -215,6 +233,8 @@ namespace NetMonitorClient this.BoxIpAdresse.Text = ""; this.BoxSubnet.Enabled = false; this.BoxSubnet.Text = ""; + this.BoxGateway.Enabled = false; + this.BoxGateway.Text = ""; } if (mode == AMMode.Manu) { @@ -222,6 +242,7 @@ namespace NetMonitorClient this.RadioIpManu.Checked = true; this.BoxIpAdresse.Enabled = true; this.BoxSubnet.Enabled = true; + this.BoxGateway.Enabled = true; } } }