protected PowerMonitor(TCPListenerServer sever) { tcpListenerServer = sever; comport.DataReceived += port_DataReceived; tmQueryStatus.Interval = 19500; tmQueryStatus.Elapsed += TmQueryStatus_Elapsed; }
public static PowerMonitor GetInstance(TCPListenerServer sever) { if (pM == null) { pM = new PowerMonitor(sever); } return(pM); }
void InitTCPServer() { tcpListenerServer = new TCPListenerServer(); tcpListenerServer.NotifyDataEvent += TcpListenerServer_NotifyDataEvent; IPdata = new Dictionary <string, string>(); ledDataCollection = new List <string>(); powermonitor = PowerMonitor.GetInstance(tcpListenerServer); }
protected override void OnStop() { LogHelper.WriteWithMethod($"State:OnStop"); try { tcpListenerServer.NotifyDataEvent -= TcpListenerServer_NotifyDataEvent;; tcpListenerServer.Dispose(); tcpListenerServer = null; ledCom.CleanFormatedContentText(); ledCom.UnInitializeSCL(); ledCom = null; } catch (Exception ex) { LogHelper.WriteException(ex); } base.OnStop(); }