Пример #1
0
 private void Client_OnStateInfo(string msg, SuperFramework.SuperSocket.TCP.TCPSyncSocketEnum.SocketState state)
 {
     try
     {
         ShowMsg(msg);
         if (state == SuperFramework.SuperSocket.TCP.TCPSyncSocketEnum.SocketState.Connected)
         {
             isSendData = true;
             (new Thread(new ThreadStart(GetData))
             {
                 IsBackground = true
             }).Start();
             ServerRunStatus?.Invoke(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), (MsgType)Enum.Parse(typeof(MsgType), "0"), state);
             //checkNet.Start();
         }
         else if (state == SuperFramework.SuperSocket.TCP.TCPSyncSocketEnum.SocketState.Disconnect)
         {
             //checkNet.Stop();
             isSendData = false;
             ServerRunStatus?.Invoke(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), (MsgType)Enum.Parse(typeof(MsgType), "5"), state);
         }
         else if (state == SuperFramework.SuperSocket.TCP.TCPSyncSocketEnum.SocketState.Reconnection)
         {
             //checkNet.Stop();
             isSendData = false;
             ServerRunStatus?.Invoke(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), (MsgType)Enum.Parse(typeof(MsgType), "5"), state);
         }
     }
     catch (Exception) { }
 }
Пример #2
0
 private void Client_OnStateInfo(string msg, SuperFramework.SuperSocket.TCP.TCPSyncSocketEnum.SocketState state)
 {
     try
     {
         ShowMsg(msg);
         if (state == SuperFramework.SuperSocket.TCP.TCPSyncSocketEnum.SocketState.Connected)
         {
             isSendData = true;
             if (connectStatusSend)
             {
                 H3CConnection?.Invoke(powerIp, DateTime.Now, (H3CMsgType)Enum.Parse(typeof(H3CMsgType), "0"));
                 (new Thread(new ThreadStart(HandleData))
                 {
                     IsBackground = true
                 }).Start();
                 connectStatusSend    = isSendNetState = false;
                 disconnectStatusSend = reconnectionStatusSend = true;
             }
             checkNet.Start();
         }
         else if (state == SuperFramework.SuperSocket.TCP.TCPSyncSocketEnum.SocketState.Disconnect)
         {
             if (disconnectStatusSend)
             {
                 H3CConnection?.Invoke(powerIp, DateTime.Now, (H3CMsgType)Enum.Parse(typeof(H3CMsgType), "6"));
                 connectStatusSend    = reconnectionStatusSend = true;
                 disconnectStatusSend = isSendNetState = false;
                 handleDataCount      = 0;
             }
             checkNet.Stop();
             isSendData = false;
         }
         else if (state == SuperFramework.SuperSocket.TCP.TCPSyncSocketEnum.SocketState.Reconnection)
         {
             if (reconnectionStatusSend)
             {
                 H3CConnection?.Invoke(powerIp, DateTime.Now, (H3CMsgType)Enum.Parse(typeof(H3CMsgType), "5"));
                 reconnectionStatusSend = isSendNetState = false;
                 connectStatusSend      = disconnectStatusSend = true;
                 handleDataCount        = 0;
             }
             checkNet.Stop();
             isSendData = false;
         }
     }
     catch (Exception) { }
 }
 private void Client_OnStateInfo(string msg, SuperFramework.SuperSocket.TCP.TCPSyncSocketEnum.SocketState state)
 {
     try
     {
         ShowMsg(msg);
         if (state == SuperFramework.SuperSocket.TCP.TCPSyncSocketEnum.SocketState.Connected)
         {
             checkNet.Start();
             isSendData = true;
             if (connectStatusSend)
             {
                 (new Thread(new ThreadStart(GetData))
                 {
                     IsBackground = true
                 }).Start();
                 DSSystemConnection?.Invoke(DateTime.Now, deviceIp, (DSConnectionState)Enum.Parse(typeof(DSConnectionState), "0"));
                 connectStatusSend    = false;
                 disconnectStatusSend = reconnectionStatusSend = true;
             }
         }
         else if (state == SuperFramework.SuperSocket.TCP.TCPSyncSocketEnum.SocketState.Disconnect)
         {
             checkNet.Stop();
             isSendData = false;
             if (disconnectStatusSend)
             {
                 DSSystemConnection?.Invoke(DateTime.Now, deviceIp, (DSConnectionState)Enum.Parse(typeof(DSConnectionState), "1"));
                 connectStatusSend    = reconnectionStatusSend = true;
                 disconnectStatusSend = false;
             }
         }
         else if (state == SuperFramework.SuperSocket.TCP.TCPSyncSocketEnum.SocketState.Reconnection)
         {
             checkNet.Stop();
             isSendData = false;
             if (reconnectionStatusSend)
             {
                 DSSystemConnection?.Invoke(DateTime.Now, deviceIp, (DSConnectionState)Enum.Parse(typeof(DSConnectionState), "2"));
                 reconnectionStatusSend = false;
                 connectStatusSend      = disconnectStatusSend = true;
             }
         }
     }
     catch (Exception) { }
 }
 //int count = 0;
 private void Client_OnStateInfo(string msg, SuperFramework.SuperSocket.TCP.TCPSyncSocketEnum.SocketState state)
 {
     try
     {
         ShowMsg(msg);
         if (state == SuperFramework.SuperSocket.TCP.TCPSyncSocketEnum.SocketState.Connected)
         {
             if (connectStatusSend)
             {
                 XFPowerGridConnection?.Invoke(powerIp, DateTime.Now, (XFPowerState)Enum.Parse(typeof(XFPowerState), "0"));
                 connectStatusSend    = isSendNetState = false;
                 disconnectStatusSend = reconnectionStatusSend = true;
             }
             checkNet.Start();
         }
         else if (state == SuperFramework.SuperSocket.TCP.TCPSyncSocketEnum.SocketState.Disconnect)
         {
             checkNet.Stop();
             if (disconnectStatusSend)
             {
                 XFPowerGridConnection?.Invoke(powerIp, DateTime.Now, (XFPowerState)Enum.Parse(typeof(XFPowerState), "6"));
                 connectStatusSend    = reconnectionStatusSend = true;
                 disconnectStatusSend = isSendNetState = false;
             }
         }
         else if (state == SuperFramework.SuperSocket.TCP.TCPSyncSocketEnum.SocketState.Reconnection)
         {
             checkNet.Stop();
             if (reconnectionStatusSend)
             {
                 XFPowerGridConnection?.Invoke(powerIp, DateTime.Now, (XFPowerState)Enum.Parse(typeof(XFPowerState), "5"));
                 reconnectionStatusSend = isSendNetState = false;
                 connectStatusSend      = disconnectStatusSend = true;
             }
         }
     }
     catch (Exception) { }
 }
Пример #5
0
 private void Client_OnStateInfo(string msg, SuperFramework.SuperSocket.TCP.TCPSyncSocketEnum.SocketState state)
 {
     StateInfo?.Invoke(msg, state);
 }