Exemple #1
0
        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();
        }
Exemple #2
0
 private void buttonAdd_Click(object sender, EventArgs e)
 {
     if (textBoxInputName.Text == "")
     {
         return;
     }
     try
     {
         if (IOManage.IODoc.m_InputDictionary.ContainsKey(textBoxInputName.Text.Trim()))
         {
             MessageBox.Show("已存在同名输入点位!");
             return;
         }
         InputData data = new InputData();
         data.strIOName     = textBoxInputName.Text;
         data.InputCardName = HardwareManage.hardwardDictionary.FirstOrDefault().Key.ToString();
         data.iInputNo      = 0;
         IOManage.IODoc.m_InputDictionary.Add(textBoxInputName.Text, data);
         IOManage.IODoc.m_InputDataList.Add(data);
         InputDriver driver = new InputDriver();
         driver.Init(data);
         IOManage.InputDrivers.drivers.Add(data.strIOName, driver);
         DrawInput();
     }
     catch (Exception ex)
     {
     }
 }
Exemple #3
0
 static public InputDriver INPUT(string strInputName)
 {
     try
     {
         return(InputDrivers.drivers[strInputName]);
     }
     catch
     {
         Action action = () =>
         {
             MainModule.FormMain.m_formAlarm.InsertAlarmMessage("不存在名字为:" + strInputName + "的输入");
         };
         MainModule.FormMain.Invoke(action);
         InputDriver driver = new InputDriver();
         InputDrivers.drivers.Add(strInputName, driver);
         return(InputDrivers.drivers[strInputName]);
     }
 }