Example #1
0
        private void SystemIOControlManager_AutoUpdateEventHander(object sender, EventArgs e)
        {
            if (update)
            {
                uint input  = Common.DI.Status;
                uint output = Common.DO.Status;
                int  n      = 0;
                if (inputValue != input)
                {
                    UInt32 v = inputValue ^ input;
                    for (int i = 0; i < ioCount; i++)
                    {
                        n = Common.DI.IOList[i];
                        if (v.Bit(n))
                        {
                            bool flag = input.Bit(n);
                            ipBtList[n].BackColor = flag ? enBkColor : diBkColor;
                            ipBtList[n].ForeColor = flag ? enForeColor : diForeColor;
                        }
                    }
                    inputValue = input;
                }
                if (outputValue != output)
                {
                    UInt32 v = outputValue ^ output;

                    for (int i = 0; i < ioCount; i++)
                    {
                        n = Common.DO.IOList[i];
                        if (v.Bit(n))
                        {
                            bool flag = output.Bit(n);
                            opBtList[n].BackColor = flag ? enBkColor : diBkColor;
                            opBtList[n].ForeColor = flag ? enForeColor : diForeColor;
                        }
                    }
                    outputValue = output;
                }
            }
        }