Changeset 752 for trunk/sources/HeuristicLab.Hive.Client.Console
- Timestamp:
- 11/13/08 17:06:15 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.Hive.Client.Console
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Client.Console/HiveClientConsole.Designer.cs
r717 r752 55 55 this.tbUuid = new System.Windows.Forms.TextBox(); 56 56 this.lblUuid = new System.Windows.Forms.Label(); 57 this.rtbInfoClient = new System.Windows.Forms.RichTextBox();58 57 this.gbManager = new System.Windows.Forms.GroupBox(); 59 58 this.lblPort = new System.Windows.Forms.Label(); 60 59 this.lblIp = new System.Windows.Forms.Label(); 61 60 this.tbPort = new System.Windows.Forms.TextBox(); 62 this.tbIp = new IPAddressTextBox();63 61 this.tabPage2 = new System.Windows.Forms.TabPage(); 62 this.lbEventLog = new System.Windows.Forms.ListBox(); 63 this.tbIp = new HeuristicLab.Hive.Client.Console.IPAddressTextBox(); 64 64 this.msClientConsole.SuspendLayout(); 65 65 this.tcClientConsole.SuspendLayout(); … … 107 107 // tpConnection 108 108 // 109 this.tpConnection.Controls.Add(this.lbEventLog); 109 110 this.tpConnection.Controls.Add(this.btnDisconnect); 110 111 this.tpConnection.Controls.Add(this.btnConnect); 111 112 this.tpConnection.Controls.Add(this.gbUser); 112 this.tpConnection.Controls.Add(this.rtbInfoClient);113 113 this.tpConnection.Controls.Add(this.gbManager); 114 114 this.tpConnection.Location = new System.Drawing.Point(4, 22); … … 168 168 this.lblUuid.TabIndex = 0; 169 169 this.lblUuid.Text = "UUID"; 170 //171 // rtbInfoClient172 //173 this.rtbInfoClient.Location = new System.Drawing.Point(18, 218);174 this.rtbInfoClient.Name = "rtbInfoClient";175 this.rtbInfoClient.Size = new System.Drawing.Size(387, 229);176 this.rtbInfoClient.TabIndex = 1;177 this.rtbInfoClient.Text = "";178 170 // 179 171 // gbManager … … 215 207 this.tbPort.TabIndex = 1; 216 208 // 217 // tbIp218 //219 this.tbIp.Location = new System.Drawing.Point(57, 19);220 this.tbIp.Name = "tbIp";221 this.tbIp.Size = new System.Drawing.Size(211, 20);222 this.tbIp.TabIndex = 0;223 //224 209 // tabPage2 225 210 // … … 231 216 this.tabPage2.Text = "tabPage2"; 232 217 this.tabPage2.UseVisualStyleBackColor = true; 218 // 219 // listBox1 220 // 221 this.lbEventLog.FormattingEnabled = true; 222 this.lbEventLog.Location = new System.Drawing.Point(23, 226); 223 this.lbEventLog.Name = "listBox1"; 224 this.lbEventLog.Size = new System.Drawing.Size(382, 212); 225 this.lbEventLog.TabIndex = 5; 226 // 227 // tbIp 228 // 229 this.tbIp.Location = new System.Drawing.Point(57, 19); 230 this.tbIp.Name = "tbIp"; 231 this.tbIp.Size = new System.Drawing.Size(211, 20); 232 this.tbIp.TabIndex = 0; 233 233 // 234 234 // HiveClientConsole … … 250 250 this.gbManager.ResumeLayout(false); 251 251 this.gbManager.PerformLayout(); 252 //((System.ComponentModel.ISupportInitialize)(this.performanceCounter1)).EndInit(); 252 253 this.ResumeLayout(false); 253 254 this.PerformLayout(); … … 262 263 private System.Windows.Forms.TabPage tpConnection; 263 264 private System.Windows.Forms.TabPage tabPage2; 264 private System.Windows.Forms.RichTextBox rtbInfoClient;265 265 private System.Windows.Forms.GroupBox gbManager; 266 266 private System.Windows.Forms.TextBox tbPort; 267 private IPAddressTextBox tbIp;267 private HeuristicLab.Hive.Client.Console.IPAddressTextBox tbIp; 268 268 private System.Windows.Forms.Label lblIp; 269 269 private System.Windows.Forms.GroupBox gbUser; … … 274 274 private System.Windows.Forms.TextBox tbUuid; 275 275 private System.Windows.Forms.ToolStripMenuItem tsmiExit; 276 private System.Windows.Forms.ListBox lbEventLog; 276 277 } 277 278 } -
trunk/sources/HeuristicLab.Hive.Client.Console/HiveClientConsole.cs
r717 r752 28 28 using System.Text; 29 29 using System.Windows.Forms; 30 using System.Diagnostics; 31 using System.Threading; 30 32 31 33 namespace HeuristicLab.Hive.Client.Console { 34 35 delegate void UpdateTextDelegate(EventLog ev); 36 32 37 public partial class HiveClientConsole : Form { 38 39 int numEntries = 0; 40 33 41 public HiveClientConsole() { 34 42 InitializeComponent(); 43 tbIp.Text = "010.020.053.006"; 44 EventLog ev = new EventLog("Hive Client"); 45 ev.Source = "Hive Client"; 46 string str = ev.Entries[ev.Entries.Count - 1].Message; 47 foreach (System.Diagnostics.EventLogEntry entry in ev.Entries) { 48 lbEventLog.Items.Add(entry.TimeWritten + " -> " + entry.Message); 49 } 50 lbEventLog.SelectedIndex = lbEventLog.Items.Count - 1; 51 numEntries = ev.Entries.Count; 52 ev.EntryWritten += new EntryWrittenEventHandler(OnEntryWritten); 53 ev.EnableRaisingEvents = true; 54 } 55 56 private void UpdateText(EventLog ev) { 57 if (this.lbEventLog.InvokeRequired) { 58 this.lbEventLog.Invoke(new 59 UpdateTextDelegate(UpdateText), new object[] { ev }); 60 } else { 61 string str = ev.Entries[numEntries].TimeWritten + " -> " + ev.Entries[numEntries].Message; 62 numEntries++; 63 lbEventLog.Items.Add(str); 64 lbEventLog.SelectedIndex = lbEventLog.Items.Count - 1; 65 66 } 35 67 } 36 68 … … 45 77 tbPort.Enabled = false; 46 78 tbUuid.Enabled = false; 47 rtbInfoClient.Text += tbIp.Text;79 lbEventLog.Items.Add(tbIp.Text); 48 80 } 49 81 … … 55 87 tbUuid.Enabled = true; 56 88 } 89 90 public void OnEntryWritten(object source, EntryWrittenEventArgs e) { 91 UpdateText((EventLog)source); 92 } 57 93 } 58 94 } -
trunk/sources/HeuristicLab.Hive.Client.Console/HiveClientConsole.resx
r717 r752 121 121 <value>17, 17</value> 122 122 </metadata> 123 <metadata name="performanceCounter1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 124 <value>150, 17</value> 125 </metadata> 123 126 </root> -
trunk/sources/HeuristicLab.Hive.Client.Console/IPAdressTextBox.cs
r717 r752 46 46 private System.ComponentModel.Container components = null; 47 47 48 private IPNotation ipNotation = IPNotation.IPv4Decimal;49 private IPNotation newIPNotation = IPNotation.IPv4Decimal;50 private bool bOverwrite = true;51 private bool bPreventLeave = true;48 private IPNotation m_ipNotation = IPNotation.IPv4Decimal; 49 private IPNotation m_newIPNotation = IPNotation.IPv4Decimal; 50 private bool m_bOverwrite = true; 51 private bool m_bPreventLeave = true; 52 52 private System.Windows.Forms.ErrorProvider error; 53 private Regex regexValidNumbers = new Regex("[0-9]");54 private ArrayList arlDelimeter = new ArrayList(new char[] { '.' });53 private Regex m_regexValidNumbers = new Regex("[0-9]"); 54 private ArrayList m_arlDelimeter = new ArrayList(new char[] { '.' }); 55 55 56 56 … … 218 218 set { 219 219 try { 220 if (IPAddressTextBox.ValidateIP(value, this. newIPNotation, this.arlDelimeter))221 base.Text = IPAddressTextBox.MakeValidSpaces(value, this. newIPNotation, this.arlDelimeter);220 if (IPAddressTextBox.ValidateIP(value, this.m_newIPNotation, this.m_arlDelimeter)) 221 base.Text = IPAddressTextBox.MakeValidSpaces(value, this.m_newIPNotation, this.m_arlDelimeter); 222 222 } 223 223 catch { … … 237 237 public bool OverWriteMode { 238 238 get { 239 return this. bOverwrite;239 return this.m_bOverwrite; 240 240 } 241 241 set { 242 if (value != this. bOverwrite) {243 this. bOverwrite = value;242 if (value != this.m_bOverwrite) { 243 this.m_bOverwrite = value; 244 244 this.OnOverWriteChanged(value); 245 245 } … … 257 257 public bool PreventLeaveAtError { 258 258 get { 259 return this. bPreventLeave;259 return this.m_bPreventLeave; 260 260 } 261 261 set { 262 if (value != this. bPreventLeave) {263 this. bPreventLeave = value;262 if (value != this.m_bPreventLeave) { 263 this.m_bPreventLeave = value; 264 264 this.OnPreventLeaveChanged(value); 265 265 } … … 277 277 public IPNotation Notation { 278 278 get { 279 return this. ipNotation;279 return this.m_ipNotation; 280 280 } 281 281 set { 282 if (value != this. ipNotation) {282 if (value != this.m_ipNotation) { 283 283 try { 284 this. newIPNotation = value;285 this.ChangeNotation(this. ipNotation, this.newIPNotation);286 this. ipNotation = this.newIPNotation;287 this.OnNotationChanged(this. newIPNotation);284 this.m_newIPNotation = value; 285 this.ChangeNotation(this.m_ipNotation, this.m_newIPNotation); 286 this.m_ipNotation = this.m_newIPNotation; 287 this.OnNotationChanged(this.m_newIPNotation); 288 288 } 289 289 catch (Exception LastError) { … … 346 346 private void ChangeNotation(IPNotation arg_oldValue, IPNotation arg_newValue) { 347 347 string sTo = ""; 348 ArrayList arlFrom = new ArrayList(this.Text.Replace(" ", "").Split((char[])this. arlDelimeter.ToArray(typeof(char))));348 ArrayList arlFrom = new ArrayList(this.Text.Replace(" ", "").Split((char[])this.m_arlDelimeter.ToArray(typeof(char)))); 349 349 350 350 switch (arg_newValue) { 351 351 case IPNotation.IPv4Decimal: 352 this. regexValidNumbers = new Regex("[0-9]");353 this. arlDelimeter = new ArrayList(new char[] { '.' });352 this.m_regexValidNumbers = new Regex("[0-9]"); 353 this.m_arlDelimeter = new ArrayList(new char[] { '.' }); 354 354 break; 355 355 case IPNotation.IPv4DecimalCIDR: 356 this. regexValidNumbers = new Regex("[0-9]");357 this. arlDelimeter = new ArrayList(new char[] { '.', '/' });356 this.m_regexValidNumbers = new Regex("[0-9]"); 357 this.m_arlDelimeter = new ArrayList(new char[] { '.', '/' }); 358 358 break; 359 359 case IPNotation.IPv4Binary: 360 this. regexValidNumbers = new Regex("[01]");361 this. arlDelimeter = new ArrayList(new char[] { '.' });360 this.m_regexValidNumbers = new Regex("[01]"); 361 this.m_arlDelimeter = new ArrayList(new char[] { '.' }); 362 362 break; 363 363 case IPNotation.IPv4BinaryCIDR: 364 this. regexValidNumbers = new Regex("[01]");365 this. arlDelimeter = new ArrayList(new char[] { '.', '/' });364 this.m_regexValidNumbers = new Regex("[01]"); 365 this.m_arlDelimeter = new ArrayList(new char[] { '.', '/' }); 366 366 break; 367 367 default: … … 502 502 } 503 503 break; 504 504 default: 505 break; 505 506 } 506 507 … … 544 545 if ((char.IsLetterOrDigit(Convert.ToChar(e.KeyValue)) || e.KeyCode == Keys.NumPad0)//Numpad0=96 --> ` 545 546 && iPos < this.TextLength) { 546 if (this. arlDelimeter.Contains(cText[iPos]))547 if (this.m_arlDelimeter.Contains(cText[iPos])) 547 548 iPos += 1; 548 549 this.SelectionStart = iPos; … … 573 574 if ((char.IsLetterOrDigit(Convert.ToChar(e.KeyValue)) || e.KeyCode == Keys.NumPad0)//Numpad0=96 --> ` 574 575 && iPos < this.TextLength) { 575 if (this. arlDelimeter.Contains(cText[iPos]))576 if (this.m_arlDelimeter.Contains(cText[iPos])) 576 577 iPos += 1; 577 578 … … 590 591 //valid input charachters 591 592 if (char.IsControl(e.KeyChar) || 592 regexValidNumbers.IsMatch(e.KeyChar.ToString())) {593 m_regexValidNumbers.IsMatch(e.KeyChar.ToString())) { 593 594 e.Handled = false; 594 595 } else { … … 637 638 protected override void OnValidating(CancelEventArgs e) { 638 639 //e.Cancel = true;//suppress cancel-signal = not validated 639 e.Cancel = (!this.ValidateIP() && this. bPreventLeave);640 e.Cancel = (!this.ValidateIP() && this.m_bPreventLeave); 640 641 base.OnValidating(e); 641 642 } … … 729 730 public string GetPureIPAddress() { 730 731 string s = ""; 731 ArrayList arlIP = new ArrayList(this.Text.Replace(" ", "").Split((char[])this. arlDelimeter.ToArray(typeof(char))));732 ArrayList arlIP = new ArrayList(this.Text.Replace(" ", "").Split((char[])this.m_arlDelimeter.ToArray(typeof(char)))); 732 733 for (int i = 0; i < arlIP.Count; i++) { 733 734 while (arlIP[i].ToString().StartsWith("0")) 734 735 arlIP[i] = arlIP[i].ToString().Substring(1); 735 736 } 736 s = IPAddressTextBox.MakeIP((string[])arlIP.ToArray(typeof(string)), this. ipNotation);737 s = IPAddressTextBox.MakeIP((string[])arlIP.ToArray(typeof(string)), this.m_ipNotation); 737 738 return s; 738 739 } … … 923 924 /// <returns>true/false valid/not</returns> 924 925 private bool ValidateIP() { 925 if (IPAddressTextBox.ValidateIP(this.Text, this. newIPNotation, this.arlDelimeter))926 if (IPAddressTextBox.ValidateIP(this.Text, this.m_newIPNotation, this.m_arlDelimeter)) 926 927 return true; 927 928 else
Note: See TracChangeset
for help on using the changeset viewer.