Ejemplo n.º 1
0
        public ClientListener(CalorimeterClient client) : base(false)
        {
            this.client       = client;
            Acknowledge       = false;
            NotifyTermination = null;
            NonAcknowledge    = null;

            int fLength = client.Ini.GetInteger("Device", "FValueLength");
            int nLength = client.Ini.GetInteger("Device", "NValueLength");

            FValues = new float[fLength];
            NValues = new UInt16[nLength];

            packet     = new ClientReceivePacket(fLength * 4 + nLength * 2 + 17);
            clientArgs = new ClientReceiveArgs();

            logger        = new UlLogger();
            logger.Active = true;
            logger.Path   = client.Ini.GetString("Listener", "LogPath");
            logger.FName  = client.Ini.GetString("Listener", "LogFileName");
            logger.AddHead("CLIENT->SERVER");
            logger.AddHead("CLIENT<-SERVER");
            logger.AddHead("NOTE");
            logger.AddHead("EXCEPTION");

            Logging = GetLogging();
        }
Ejemplo n.º 2
0
        private void DoRefreshConnectionState(object sender, EventArgs e)
        {
            if (Resource.State == EClientState.Closing)
            {
                return;
            }

            if (this.InvokeRequired == true)
            {
                EventHandler func = new EventHandler(DoRefreshConnectionState);
                this.BeginInvoke(func, new object[] { sender, e });
            }
            else
            {
                bool active;
                ClientReceiveArgs args = e as ClientReceiveArgs;

                active = (powerMeterLedLabel.BackColor == SystemColors.Control) ? false : true;
                if (active != args.PowerMeter)
                {
                    powerMeterLedLabel.BackColor = (active == true) ? Color.Khaki : SystemColors.Control;
                }

                active = (recorderLedLabel.BackColor == SystemColors.Control) ? false : true;
                if (active != args.Recorder)
                {
                    recorderLedLabel.BackColor = (active == true) ? Color.Khaki : SystemColors.Control;
                }

                active = (controllerLedLabel.BackColor == SystemColors.Control) ? false : true;
                if (active != args.Controller)
                {
                    controllerLedLabel.BackColor = (active == true) ? Color.Khaki : SystemColors.Control;
                }

                active = (plcLedLabel.BackColor == SystemColors.Control) ? false : true;
                if (active != args.Plc)
                {
                    plcLedLabel.BackColor = (active == true) ? Color.Khaki : SystemColors.Control;
                }
            }
        }