示例#1
0
        protected PowerMonitor(TCPListenerServer sever)
        {
            tcpListenerServer     = sever;
            comport.DataReceived += port_DataReceived;

            tmQueryStatus.Interval = 19500;
            tmQueryStatus.Elapsed += TmQueryStatus_Elapsed;
        }
示例#2
0
 public static PowerMonitor GetInstance(TCPListenerServer sever)
 {
     if (pM == null)
     {
         pM = new PowerMonitor(sever);
     }
     return(pM);
 }
示例#3
0
        void InitTCPServer()
        {
            tcpListenerServer = new TCPListenerServer();
            tcpListenerServer.NotifyDataEvent += TcpListenerServer_NotifyDataEvent;

            IPdata            = new Dictionary <string, string>();
            ledDataCollection = new List <string>();

            powermonitor = PowerMonitor.GetInstance(tcpListenerServer);
        }
示例#4
0
        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();
        }