private static void MultiplyByCommand(
     OpcMethodContext context,
     IList <object> inputArguments,
     IList <object> outputArguments)
 {
     // result = a * b
     outputArguments[0] = (int)inputArguments[0] * (int)inputArguments[1];
 }
 private static int AddByDelegate(
     OpcMethodContext context,
     int a,
     int b)
 {
     // result = a + b
     return(a + b);
 }
Exemplo n.º 3
0
        private static void StartMachine(OpcMethodContext context)
        {
            lock (syncRoot) {
                if (machineThread == null)
                {
                    machineControl = new CancellationTokenSource();

                    machineThread = new Thread(RunMachine);
                    machineThread.Start(context);
                }
            }
        }
Exemplo n.º 4
0
        private static void StopMachine(OpcMethodContext context)
        {
            lock (syncRoot) {
                if (machineThread != null)
                {
                    machineControl.Cancel();
                    machineThread.Join();

                    machineControl.Dispose();
                    machineControl = null;

                    machineThread = null;
                }
            }
        }
 public static void ProcessWithContext(OpcMethodContext context)
 {
     Console.WriteLine("Just called from session '{0}'!", context.SessionId);
 }
Exemplo n.º 6
0
 public void Execute(OpcMethodContext context, IList <object> inputArguments, IList <object> outputArguments)
 {
     // result = a * b
     outputArguments[0] = (int)inputArguments[0] * (int)inputArguments[1];
 }