static public void InitIOs() { InputDrivers = new InputDrivers(); foreach (KeyValuePair <string, InputData> item in IODoc.m_InputDictionary) { InputDriver Driver = new InputDriver(); InputDrivers.drivers.Add(item.Value.strIOName, Driver); } foreach (KeyValuePair <string, InputDriver> item in InputDrivers.drivers) { item.Value.Init(IODoc.m_InputDictionary[item.Key]); } OutputDrivers = new OutputDrivers(); foreach (KeyValuePair <string, OutputData> item in IODoc.m_OutputDictionary) { OutputDriver Driver = new OutputDriver(); OutputDrivers.drivers.Add(item.Value.strIOName, Driver); } foreach (KeyValuePair <string, OutputDriver> item in OutputDrivers.drivers) { item.Value.Init(IODoc.m_OutputDictionary[item.Key]); } System.Threading.Thread thread = new System.Threading.Thread(ThreadScanIOs); thread.IsBackground = true; thread.Start(); }
static public OutputDriver OUTPUT(string strOutputName) { try { return(OutputDrivers.drivers[strOutputName]); } catch { Action action = () => { MainModule.FormMain.m_formAlarm.InsertAlarmMessage("不存在名字为:" + strOutputName + "的输出"); }; MainModule.FormMain.Invoke(action); OutputDriver driver = new OutputDriver(); OutputDrivers.drivers.Add(strOutputName, driver); return(OutputDrivers.drivers[strOutputName]); } }