private void btn_match_Click(object sender, EventArgs e) { timer.Elapsed += dataRefresh; timer.Interval = 1000; timer.Stop(); Global.OPCUA.Clear(); cb_Irai.Items.Clear(); //for (int x = 0; x < list_Nodes.CheckedItems.Count; x++) //{ // string text = list_Nodes.CheckedItems[x].ToString(); // int index = text.IndexOf(','); // string tagName = text.Substring(1, index - 1); // Global.SensorData.Add(new SensorData { Name = tagName, Index = x, NodeId = text.Substring(index + 2, (text.Length - index - 3)) }); // cb_Irai.Items.Add(Global.SensorData[x], false); //} int x = 0; foreach (var item in list_Nodes.CheckedItems) { Class.Records_OPCUA data = (Class.Records_OPCUA)item; data.Index = x; Global.OPCUA.Add(data); cb_Irai.Items.Add(Global.OPCUA[x], false); x++; } Global.OpcConnector.Subscribe(Global.OPCUA); timer.Start(); }
public OPCUA_page() { InitializeComponent(); LoadRecord(); //var iraiData = FakeServer.GetIraiList(); //checkedListBox1.Items.AddRange(iraiData.ToArray()); ConfigManager.SetConfigPath(@"C:\Users\Jinvi\source\repos\DAC_Demoa\DAC_Demoa\bin\Debug\Resource\AAS.config"); var asset = MongoHelper.Asset.GetAllCollectionAssets(); checkedListBox1.Items.AddRange(asset.ToArray()); checkedListBox1.DisplayMember = "Irai"; Dictionary <string, string> nodes = Global.OpcConnector.ScanForNodes(); foreach (var item in nodes) { var sensorData = new Class.Records_OPCUA(item.Key, item.Value, "", 0, ""); var globalData = Global.OPCUA.Find(x => x.Name == sensorData.Name && x.NodeId == sensorData.NodeId); if (globalData == null) { list_Nodes.Items.Add(sensorData); } } }