Пример #1
0
        private static void HandleInstanceStateEvent(object sender, PlcDeviceConnectionStateChangedEventArgs e)
        {
            // The passed sender does provide the instance affected by the event.
            PlcDeviceConnection connection = (PlcDeviceConnection)sender;

            Console.WriteLine("4. Way: State of connection to '{0}':", connection.Device.EndPoint);
            Console.WriteLine("-> Changed from {0} to {1}.", e.OldState, e.NewState);
        }
Пример #2
0
        private static void HandleStateChanged(object sender, PlcDeviceConnectionStateChangedEventArgs e)
        {
            // The StateChanged event occurs when ever the PlcDeviceConnection.State property gets
            // changed. This property does provide general low level driver independent state
            // information of a connection. This state information does indicate whether a
            // a connection is in a useful state and whether read/write operations can be
            // performed.
            PlcDeviceConnection connection = (PlcDeviceConnection)sender;

            Console.WriteLine();
            Console.WriteLine("Connection to '{0}'", connection.Device.EndPoint);
            Console.WriteLine("-> State.Changed from '{0}' to '{1}'.", e.OldState, e.NewState);
        }