ConnectionStatusUpdate
Definition
ConnectionStatusUpdate can be used for subscribing to connection status update events.
Remember to unsubscribe if you are no longer using the subscription.
Syntax
ConnectionStatusUpdate
Examples
1 // Example of subscribing/unsubscribing to connection update events from an Add On. The concept can be carried over 2 // to any NinjaScript object you may be working on. 3 public class MyAddOnTab : NTTabPage 4 { 5 private Connection connection; 6 public MyAddOnTab() 7 { 8 // Subscribe to connection updates 9 Connection.ConnectionStatusUpdate += OnConnectionStatusUpdate; 10 } 11 12 // This method is fired on connection status update events 13 private void OnConnectionStatusUpdate(object sender, ConnectionStatusEventArgs e) 14 { 15 // For multi-threading reasons, work with a copy of the ConnectionStatusEventArgs to prevent situations 16 // where the ConnectionStatusEventArgs may already be ahead of us while in the middle processing it. 17 ConnectionStatusEventArgs eCopy = e; 18 19 // If the Kinetick EOD connection disconnects, do something 20 if (eCopy.Connection.Options.Name == "Kinetick - End Of Day (Free)") 21 { 22 if (eCopy.Status == ConnectionStatus.Disconnected) 23 // Do something 24 } 25 } 26 27 // Called by TabControl when tab is being removed or window is closed 28 public override void Cleanup() 29 { 30 // Make sure to unsubscribe to the connection status subscription 31 Connection.ConnectionStatusUpdate -= OnConnectionStatusUpdate; 32 } 33 34 // Other required NTTabPage members left out for demonstration purposes. Be sure to add them in your own code. 35 }

