Exemple #1
0
        //Тик таймера
        private void Timer_Tick(object sender, EventArgs e)
        {
            #region ЧТЕНИЕ КОМАНД ИЗ СИМУЛЯТОРА

            bool BitState = SIMULATOR.ReadOutputBit(Byte_CNT, Bit_CNT);

            #endregion

            #region УПРАВЛЕНИЕ ЦВЕТОМ СТРЕЛКИ

            if (BitState == true)
            {
                State = true;

                //Зеленый
                Stroke       = new SolidColorBrush(Color.FromArgb(0xFF, 0x0, 0x80, 0x0));
                Fill         = new SolidColorBrush(Color.FromArgb(0xFF, 0x0, 0x80, 0x0));
                Fill.Opacity = 0.2;
            }
            else
            {
                State = false;

                //Красный
                Stroke       = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0x0, 0x0));
                Fill         = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0x0, 0x0));
                Fill.Opacity = 0.2;
            }

            #endregion
        }
Exemple #2
0
        private void ButtonPropertyChanged(Object sender, EventArgs e)
        {
            xButton button = (xButton)sender;
            bool    value  = button.IsPressed;

            //Запись значения в симулятор
            SIMULATOR.WriteInputBit(this.Byte_CNT, Bit_CNT, value);
        }
Exemple #3
0
        //ТАЙМЕР
        private void Timer_Tick(object sender, EventArgs e)
        {
            #region ЧТЕНИЕ КОМАНД ИЗ СИМУЛЯТОРА

            UP_CMD = SIMULATOR.ReadOutputBit(DRIVE_UP.Byte, DRIVE_UP.Bit);

            //Чтение комманды для опускания двери
            DOWN_CMD = SIMULATOR.ReadOutputBit(DRIVE_DOWN.Byte, DRIVE_DOWN.Bit);

            #endregion

            #region УПРАВЛЕНИЕ ВЕРХНИМ И НИЖНЕМ ИНДИКАТОРАМИ

            LS_DOWN.State = !(Rect.Height < 99.0);
            LS_UP.State   = !(Rect.Height > 26.0);

            #endregion
        }
 //Запись в симулятор
 void WritePLCSim(bool value)
 {
     //Записываем позиции в симулятор
     SIMULATOR.WriteInputBit(Byte_CNT, Bit_CNT, value);
 }