using System; using System.Collections.Generic; namespace OpcUAServerSample { using IToolS.Components.Communication; using IToolS.Components.IOServers; static class Program { static void Main() { IToolS.Components.ComponentBase.RaiseEventsOnMainThread = false; Group group = new Group() { GroupName = "group1" }; Variable variable1 = new Variable() { VariableName = "variable1", Area = "HR", Address = "0" }; Variable variable2 = new Variable() { VariableName = "variable2", Area = "HR", Address = "1" }; variable1.Changed += variableChanged; variable2.Changed += variableChanged; IOServer ioserver1 = new IOServer() { Name = "Simulation" }; IOServer ioserver2 = new IOServer() { Name = "OpcUAServer" }; Client client = new Client() { ClientName = "client1", Group = group, IOServer = ioserver1 }; group.Add(variable1); group.Add(variable2); group.IOServer = ioserver2; client.Start(); group.StartIOServer(); Console.WriteLine("Press ENTER to exit"); Console.ReadLine(); client.Stop(); client.StopIOServer(); group.StopIOServer(); } private static void variableChanged(object sender, IToolS.Data.ChangedEventArgs e) { Variable variable = (Variable)sender; Console.WriteLine("{0} value: {1}", variable.VariableName, e.NewValue); } } }