From: <br...@us...> - 2008-06-16 07:20:20
|
Revision: 257 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=257&view=rev Author: brus07 Date: 2008-06-16 00:20:09 -0700 (Mon, 16 Jun 2008) Log Message: ----------- Show TextBoxLog with timer, because edit one in other thread Modified Paths: -------------- ACMServer/trunk/ACMServer/Tester/Form1.Designer.cs ACMServer/trunk/ACMServer/Tester/Form1.cs ACMServer/trunk/ACMServer/Tester/Form1.resx Modified: ACMServer/trunk/ACMServer/Tester/Form1.Designer.cs =================================================================== --- ACMServer/trunk/ACMServer/Tester/Form1.Designer.cs 2008-06-15 18:39:11 UTC (rev 256) +++ ACMServer/trunk/ACMServer/Tester/Form1.Designer.cs 2008-06-16 07:20:09 UTC (rev 257) @@ -38,6 +38,7 @@ this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.timer1 = new System.Windows.Forms.Timer(this.components); + this.timerUpdateTextLog = new System.Windows.Forms.Timer(this.components); this.statusStrip1.SuspendLayout(); this.SuspendLayout(); // @@ -122,6 +123,12 @@ this.timer1.Enabled = true; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // + // timerUpdateTextLog + // + this.timerUpdateTextLog.Enabled = true; + this.timerUpdateTextLog.Interval = 400; + this.timerUpdateTextLog.Tick += new System.EventHandler(this.timerUpdateTextLog_Tick); + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -156,6 +163,7 @@ private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.Timer timer1; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1; + private System.Windows.Forms.Timer timerUpdateTextLog; } } Modified: ACMServer/trunk/ACMServer/Tester/Form1.cs =================================================================== --- ACMServer/trunk/ACMServer/Tester/Form1.cs 2008-06-15 18:39:11 UTC (rev 256) +++ ACMServer/trunk/ACMServer/Tester/Form1.cs 2008-06-16 07:20:09 UTC (rev 257) @@ -14,6 +14,7 @@ public partial class Form1 : Form { SocketClient socket; + string fullLog = ""; public Form1() { InitializeComponent(); @@ -53,7 +54,13 @@ private void DataArrived(string message) { string result = ""; - textBox1.Text += "\r\n" + message; + + //textBox1.Text += "\r\n" + message; + lock (fullLog) + { + fullLog += "\r\n"; + fullLog += message; + } try { @@ -66,7 +73,13 @@ log.Loging("Form1::DataArrived: Error: " + ex.StackTrace, Log.Priority.ERR); return; } - textBox1.Text += "\r\n\t-> " + result; + + //textBox1.Text += "\r\n\t-> " + result; + lock (fullLog) + { + fullLog += "\r\n\t->"; + fullLog += result; + } socket.Send(result.ToString() + "$" + message); } @@ -99,5 +112,23 @@ textBox1.Select(textBox1.Text.Length, 0); textBox1.ScrollToCaret(); } + + private void UpdateTextLog() + { + lock (fullLog) + { + //textBox3.SelectedText = fullLog; + textBox1.Text += fullLog; + textBox1.Select(textBox1.Text.Length, 0); + textBox1.ScrollToCaret(); + fullLog = ""; + } + } + + private void timerUpdateTextLog_Tick(object sender, EventArgs e) + { + UpdateTextLog(); + } + } } \ No newline at end of file Modified: ACMServer/trunk/ACMServer/Tester/Form1.resx =================================================================== --- ACMServer/trunk/ACMServer/Tester/Form1.resx 2008-06-15 18:39:11 UTC (rev 256) +++ ACMServer/trunk/ACMServer/Tester/Form1.resx 2008-06-16 07:20:09 UTC (rev 257) @@ -123,4 +123,7 @@ <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>127, 17</value> </metadata> + <metadata name="timerUpdateTextLog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>210, 17</value> + </metadata> </root> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |