コード例 #1
0
        public void Initialize(PLCInfo plc)
        {
            foreach (var light in plc.lights)
            {
                LED led = new LED();
                led.Name     = light.Key;
                led.ReadOnly = light.Value.ReadOnly;
                led.State    = light.Value.Checked;
                if (light.Value.Checked)
                {
                    led.BackColor = Color.Gold;
                }
                else
                {
                    led.BackColor = Color.Transparent;
                }
                led.Size     = new System.Drawing.Size(light.Value.Width, light.Value.Height);
                led.Location = light.Value.Position;

                if (led.Name[0] == 'I')
                {
                    led.Click += LightsClick;
                    InputControls.Add(light.Key, led);
                }
                else if (led.Name[0] == 'Q')
                {
                    OutputControls.Add(light.Key, led);
                }
                else
                {
                    StatusControls.Add(light.Key, led);
                }
            }
        }
コード例 #2
0
ファイル: PLC.cs プロジェクト: zhangzheng1205/PLC_Sim
 public PLC(string filePath)
 {
     Info = new PLCInfo(filePath);
     _IOModule.Initialize(Info);
     InputModule  = ComponentsForModule.InputControls;
     OutputModule = ComponentsForModule.OutputControls;
     CpuModule    = ComponentsForModule.StatusControls;
     CPU.Memory.Data.Init(InputModule, OutputModule);
 }
コード例 #3
0
 public PLCDetailDeviceSettings(PLCInfo plcInfo)
 {
     PLCDeviceType = plcInfo.PLCDeviceType;
     HasControlRelayResultStatus = plcInfo.HasControlRelayResultStatus;
     HeaderName          = plcInfo.PLCHeaderName;
     DeviceNumber        = plcInfo.DeviceNumber;
     DigitalSwitchNumber = plcInfo.DigitalSwitchNumber;
     RelayNumber         = plcInfo.RelayNumber;
 }
コード例 #4
0
ファイル: PLCDeviceInfo.cs プロジェクト: bardway/mingriland
 public PLCDeviceInfo(PLCInfo plcInfo, string portName)
 {
     PLCDeviceType = plcInfo.PLCDeviceType;
     HasControlRelayResultStatus = plcInfo.HasControlRelayResultStatus;
     HeaderName          = plcInfo.PLCHeaderName;
     DeviceNumber        = plcInfo.DeviceNumber;
     DigitalSwitchNumber = plcInfo.DigitalSwitchNumber;
     RelayNumber         = plcInfo.RelayNumber;
     UpdatePortName(portName);
     InitEditCommand();
     InitOpenLogFileCommand();
     InitChangedDeviceNumberCommand();
     InitQuerySwitchStatusCommand();
     InitQueryRelayStatusCommand();
 }
コード例 #5
0
 public void AddDetailDevice(PLCInfo plcInfo)
 {
     PLCDetailDevicesSettings.Add(new PLCDetailDeviceSettings(plcInfo));
 }