From: <br...@us...> - 2008-07-30 20:45:45
|
Revision: 303 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=303&view=rev Author: brus07 Date: 2008-07-30 20:45:49 +0000 (Wed, 30 Jul 2008) Log Message: ----------- In WebGatePlugin can change checking interval. Show log in textBox in WebGatePlugin. Modified Paths: -------------- ACMServer/trunk/ACMServer/Library/Connector/WebConnector.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGate.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs Modified: ACMServer/trunk/ACMServer/Library/Connector/WebConnector.cs =================================================================== --- ACMServer/trunk/ACMServer/Library/Connector/WebConnector.cs 2008-07-25 13:20:56 UTC (rev 302) +++ ACMServer/trunk/ACMServer/Library/Connector/WebConnector.cs 2008-07-30 20:45:49 UTC (rev 303) @@ -58,5 +58,11 @@ { getter.Send(message); } + + protected void SetTimerInterval(int valueOfSeconds) + { + lock (timer) + timer.Interval = valueOfSeconds * 1000; + } } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGate.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGate.cs 2008-07-25 13:20:56 UTC (rev 302) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGate.cs 2008-07-30 20:45:49 UTC (rev 303) @@ -18,5 +18,13 @@ { return instance; } + + public int CheckingIntervarInSeconds + { + set + { + this.SetTimerInterval(value); + } + } } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs 2008-07-25 13:20:56 UTC (rev 302) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePlugin.cs 2008-07-30 20:45:49 UTC (rev 303) @@ -18,7 +18,18 @@ public override void Send(string message) { + string text = " Send: " + message.Length + " bytes" + Environment.NewLine; + ((WebGatePluginUserControl)base.Control).AddText(text); + webGate.Send(message); } + + protected override void DataArrived(string message) + { + string text = "Arrived: " + message.Length + " bytes" + Environment.NewLine; + ((WebGatePluginUserControl)base.Control).AddText(text); + + base.DataArrived(message); + } } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs 2008-07-25 13:20:56 UTC (rev 302) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.Designer.cs 2008-07-30 20:45:49 UTC (rev 303) @@ -31,6 +31,10 @@ this.textBox2 = new System.Windows.Forms.TextBox(); this.setAddressButton = new System.Windows.Forms.Button(); this.addressComboBox = new System.Windows.Forms.ComboBox(); + this.CheckingIntervalNumericUpDown = new System.Windows.Forms.NumericUpDown(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.CheckingIntervalNumericUpDown)).BeginInit(); this.SuspendLayout(); // // textBox2 @@ -38,10 +42,10 @@ this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.textBox2.Location = new System.Drawing.Point(3, 32); + this.textBox2.Location = new System.Drawing.Point(3, 58); this.textBox2.Multiline = true; this.textBox2.Name = "textBox2"; - this.textBox2.Size = new System.Drawing.Size(263, 193); + this.textBox2.Size = new System.Drawing.Size(263, 167); this.textBox2.TabIndex = 2; // // setAddressButton @@ -69,16 +73,61 @@ this.addressComboBox.TabIndex = 4; this.addressComboBox.Text = "http://127.0.0.1/d"; // + // CheckingIntervalNumericUpDown + // + this.CheckingIntervalNumericUpDown.Location = new System.Drawing.Point(90, 32); + this.CheckingIntervalNumericUpDown.Maximum = new decimal(new int[] { + 1000, + 0, + 0, + 0}); + this.CheckingIntervalNumericUpDown.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.CheckingIntervalNumericUpDown.Name = "CheckingIntervalNumericUpDown"; + this.CheckingIntervalNumericUpDown.Size = new System.Drawing.Size(53, 20); + this.CheckingIntervalNumericUpDown.TabIndex = 5; + this.CheckingIntervalNumericUpDown.Value = new decimal(new int[] { + 10, + 0, + 0, + 0}); + this.CheckingIntervalNumericUpDown.ValueChanged += new System.EventHandler(this.CheckingIntervalNumericUpDown_ValueChanged); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(3, 35); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(81, 13); + this.label1.TabIndex = 6; + this.label1.Text = "Checking every"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(149, 34); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(50, 13); + this.label2.TabIndex = 7; + this.label2.Text = "seconds."; + // // WebGatePluginUserControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.CheckingIntervalNumericUpDown); this.Controls.Add(this.addressComboBox); this.Controls.Add(this.setAddressButton); this.Controls.Add(this.textBox2); this.Name = "WebGatePluginUserControl"; this.Size = new System.Drawing.Size(269, 228); this.Load += new System.EventHandler(this.WebGatePluginUserControl_Load); + ((System.ComponentModel.ISupportInitialize)(this.CheckingIntervalNumericUpDown)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -89,5 +138,8 @@ private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.Button setAddressButton; private System.Windows.Forms.ComboBox addressComboBox; + private System.Windows.Forms.NumericUpDown CheckingIntervalNumericUpDown; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; } } Modified: ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs 2008-07-25 13:20:56 UTC (rev 302) +++ ACMServer/trunk/ACMServer/Plugins/MediatorPlugins/WebGatePlugin/WebGatePluginUserControl.cs 2008-07-30 20:45:49 UTC (rev 303) @@ -28,5 +28,31 @@ WebGate gate = WebGate.GetInstance(); addressComboBox.Text = gate.Address; } + + private void CheckingIntervalNumericUpDown_ValueChanged(object sender, EventArgs e) + { + WebGate gate = WebGate.GetInstance(); + gate.CheckingIntervarInSeconds = (int)((NumericUpDown)sender).Value; + } + + delegate void AddTextCallback(string text); + public void AddText(string text) + { + if (this.textBox2.InvokeRequired) + { + AddTextCallback d = new AddTextCallback(AddText); + this.Invoke(d, new object[] { text }); + } + else + { + string timeStr = DateTime.Now.ToLongTimeString() + "." + DateTime.Now.Millisecond.ToString(); + textBox2.Text += timeStr + " " + text + " "; + //if (autoScrollCheckBox.Checked) + { + textBox2.Select(textBox2.Text.Length, 0); + textBox2.ScrollToCaret(); + } + } + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |