Esempio n. 1
0
 /// <summary>
 /// 根据TCP连接状态修改各控件状态
 /// </summary>
 /// <param name="state"></param>
 public void GetState(StateInfoEventArgs stateArgs)
 {
     try
     {
         this.button_Connect.Enabled = stateArgs.State != SocketHelper.SocketState.Connected;
         this.tcpClient.IsStart      = SocketHelper.SocketState.Connected == stateArgs.State;
         if (stateArgs.State == SocketHelper.SocketState.Connected)
         {
             LblTcpState.Text      = "已连接服务器";
             LblTcpState.ForeColor = Color.FromArgb(0, 192, 0);
             tcpClient.SendData(string.Format("&{0}&", clientModel.ToString()));
             if (this.checkBox_AutoCollect.Checked)
             {
                 this.StartSlashEndCollect(true);
             }
         }
         else
         {
             LblTcpState.Text      = stateArgs.StateInfo;
             LblTcpState.ForeColor = Color.Red;
         }
     }
     catch (Exception ex) { YsuSoftHelper.Helper.logHelper.WriteErrLog("GetState", ex); }
 }
Esempio n. 2
0
 private void StateCalculator_StateInfoChanged(object sender, StateInfoEventArgs e)
 {
     // stateInfoEvent.Set();
 }
Esempio n. 3
0
 void OnFinancialInfoChanged(object sender, StateInfoEventArgs e)
 {
     this.Update(e.Information);
 }
Esempio n. 4
0
 /// <summary>
 /// TCP状态改变事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TcpClient_OnStateInfo(object sender, StateInfoEventArgs e)
 {
     try { this.Invoke(new MethodInvoker(() => { this.GetState(e); })); }
     catch (Exception ex) { YsuSoftHelper.Helper.logHelper.WriteErrLog("iTcpClient1_OnStateInfo", ex); }
 }
Esempio n. 5
0
 void StateInfoChanged(object sender, StateInfoEventArgs e)
 {
     Console.WriteLine("Generation = {0}; Margin = {1}; Trades = {2}", e.Information.Generation, e.Information.Margin, e.Information.TradeRecords.Length);
 }