Пример #1
0
 public void WsConnect()
 {
     if (!IsConnected)
     {
         WebSocketHelper1 = new WebSocketHelper(Ws_URL, (BwsTransportType)(TransportCode))
         {
             DoLog         = false,
             OnStateChange = WsOnStateChange,
             OnMessage     = WsOnMessage,
             OnError       = WsOnError
         };
         IsConnected = !IsConnected;
     }
     else
     {
         WebSocketHelper1.Close();
         IsConnected = !IsConnected;
     }
 }
Пример #2
0
        public void WsConnect()
        {
            if (Ws_Button == "connect")
            {
                WebSocketHelper1 = new WebSocketHelper(Ws_URL, (BwsTransportType)(TransportCode))
                {
                    DoLog         = false,
                    OnStateChange = WsOnStateChange,
                    OnMessage     = WsOnMessage,
                    OnError       = WsOnError
                };

                IsDisabled = false;
                log        = new List <BwsMessage>();
                Ws_Button  = "disconnect";
            }
            else
            {
                WebSocketHelper1.Close();
                IsDisabled = true;
                Ws_Button  = "connect";
                log        = new List <BwsMessage>();
            }
        }