public bool SetValues(Dictionary <string, string> blocks) { if (!this.Connected) { throw new Exception("还未连接到OPC服务"); } FlashLamp(true); return(_client.SetValues(blocks)); }
static void Main(string[] args) { OPCServiceClient.OPCServiceClient client = new OPCServiceClient.OPCServiceClient("127.0.0.1", 9100); client.BadBlockDetected += Client_BadBlockDetected; if (client.Connect()) { client.SetValue("tag1", "1"); string tagValue1 = client.GetValue("tag1"); Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("tag2", "20"); dic.Add("tag3", "0"); client.SetValues(dic); dic = client.GetValues(new List <string>() { "tag2", "tag3" }); client.Disconnect(); } }