ConnectionStatusEventArgs

View as Markdown

Definition

ConnectionStatusEventArgs contains Connection-related information to be passed as an argument to the OnConnectionStatusUpdate() event.

For a complete, working example of this class in use, download framework example located on our Developing AddOns Overview.

The properties listed below are accessible from an instance of ConnectionStatusEventArgs:

PropertyDescription
ConnectionThe Connection object for which OnConnectionStatusUpdate() was called
ErrorAn ErrorCode thrown by the Connection object in question
NativeErrorA string representing an error thrown by the connectivity provider
PreviousStatusA ConnectionStatus object representing the status of the connection before this call to OnConnectionStatusUpdate()
StatusA ConnectionStatus object representing the new status of the connection
PreviousPriceStatusA ConnectionStatus object representing the status of the connection’s price feed before this call to OnConnectionStatusUpdate()
PriceStatusA ConnectionStatus object representing the new status of the connection’s price feed

Examples

1// This method is fired on connection status events
2private void OnConnectionStatusUpdate(object sender, ConnectionStatusEventArgs e)
3{
4 // For multi-threading reasons, work with a copy of the ConnectionStatusEventArgs to prevent situations in which the EventArgs may already be ahead of us while in the middle processing it.
5 // This accomplishes the same goal as locking a collection to prevent in-flight changes from affecting outcomes
6 ConnectionStatusEventArgs eCopy = e;
7
8 /* Dispatcher.InvokeAsync() is needed for multi-threading considerations. When processing events outside of the UI thread, and we want to
9 influence the UI .InvokeAsync() allows us to do so. It can also help prevent the UI thread from locking up on long operations. */
10 Dispatcher.InvokeAsync(() =>
11 {
12 outputBox.AppendText(string.Format("{1} Status: {2}",
13 Environment.NewLine,
14 eCopy.Connection.Options.Name,
15 eCopy.Status));
16 });
17}