From: <br...@us...> - 2009-02-06 20:56:49
|
Revision: 494 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=494&view=rev Author: brus07 Date: 2009-02-06 20:56:45 +0000 (Fri, 06 Feb 2009) Log Message: ----------- Bug fix with Connected status. When try to send to Server when not Connected, show MessageBox. Modified Paths: -------------- ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGate.cs ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGatePluginUserControl.cs Modified: ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGate.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGate.cs 2009-02-06 19:41:24 UTC (rev 493) +++ ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGate.cs 2009-02-06 20:56:45 UTC (rev 494) @@ -111,7 +111,11 @@ if (client == null) return true; - + if (IsConnected() == false) + { + System.Windows.Forms.MessageBox.Show("Client is not Connected to Server", "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); + return false; + } return client.Send(message); } @@ -135,6 +139,17 @@ } public bool IsConnected() { + if (client.IsConnected() == true) + { + try + { + client.Send(new SystemMessage(".")); + } + catch (Exception) + { + return false; + } + } return client.IsConnected(); } } Modified: ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGatePluginUserControl.cs =================================================================== --- ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGatePluginUserControl.cs 2009-02-06 19:41:24 UTC (rev 493) +++ ACMServer/trunk/ACMServer/Plugins/TesterPlugins/SocketClientGatePlugin/SocketClientGatePluginUserControl.cs 2009-02-06 20:56:45 UTC (rev 494) @@ -23,6 +23,10 @@ SocketClientGate gate = SocketClientGate.GetInstance(); gate.onAddLogText += AddText; + gate.CreateClient(textBox2.Text, Int32.Parse(portTextBox.Text)); + + tim = new System.Threading.Timer(new TimerCallback(timer1_Tick)); + tim.Change(0, 1000); } LogDataGridView.LogDataGridView view = new LogDataGridView.LogDataGridView(); @@ -64,8 +68,7 @@ gate.CreateClient(textBox2.Text, Int32.Parse(portTextBox.Text)); gate.Connect(); - tim = new System.Threading.Timer(new TimerCallback(timer1_Tick)); - tim.Change(0, 100); + tim.Change(0, 1000); } private void button2_Click(object sender, EventArgs e) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |