private static void checkOpenConnect() { KeyBoardCtrl keyCtrl = new KeyBoardCtrl(); if (keyCtrl.CheckConfig(config.https, config.StoreCode)) { if (getConfigOpenSocket()) { aTimePing.Enabled = false; aTimePing = null; } } }
private void OnTimedEvent(Object source, System.Timers.ElapsedEventArgs e) { try { if (this.webSocket != null) { this.webSocket = null; } KeyBoardCtrl sCtrl = new KeyBoardCtrl(); if (sCtrl.CheckConfig(config.https, config.StoreCode)) { Console.WriteLine("================ OnTimedEvent Thanh Cong ==========="); Init_WebSocket(config); aTimer.Enabled = false; } } catch { Console.WriteLine("================ OnTimedEvent ERROR SOCKET ==========="); } }
private static bool getConfigOpenSocket() { KeyBoardCtrl keyCtrl = new KeyBoardCtrl(); Priority priority = null; try { var dataConfig = keyCtrl.GetConfig(config.https, config.StoreCode); if (dataConfig != null) { if (dataConfig.priority_fix != null) { priority = dataConfig.priority_fix; } else { priority = dataConfig.priority; } } else { return(false); } } catch { foreach (var add in config.KeyBoardCounters) { EventProgram evDis = new EventProgram(ActionTicket.DISCONNECT, add.AddressKeyboard, null); serialCtrl.SendKeyBoard(evDis); } SetTimerPing(); return(false); } InitSocket(config, priority); return(true); }