Example #1
0
        /// <summary>
        /// Handles the <see cref="OpcMonitoredItem.EventReceived"/> event using node events.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The event data.</param>
        private static void HandleDataEvents(object sender, OpcEventReceivedEventArgs e)
        {
            // In general event handling can be implemented here, too. The approach of this sample
            // takes use of the nodes collection to summarize the received information to process
            // it all in one run to simplify the handling of the console out- and input.
            var nodeId = e.Event.SourceNodeId.ToString(OpcNodeIdFormat.Foundation);

            if (nodeId != null && nodes.Contains(nodeId))
            {
                nodes[nodeId].Event = e.Event;
            }
        }
Example #2
0
 /// <summary>
 /// Handles the <see cref="OpcMonitoredItem.EventReceived"/> event using global events.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The event data.</param>
 private static void HandleGlobalEvents(object sender, OpcEventReceivedEventArgs e)
 {
     Console.Title = e.Event.Message;
 }
Example #3
0
 private static void HandleJobsEvent(object sender, OpcEventReceivedEventArgs e)
 {
     Console.WriteLine("SERVER: {0} - {1}", e.Event.SourceName, e.Event.Message);
 }