private void ConnectionChangedHandler(CommunicationInterface commInterface, CommunicationInterface.ConnectionStatusType status, bool willReconnect) { lock (this) //lock to ensure we don't accidentally get other callbacks while handling this one { if (IsRunning) //always need to check this in case we are getting callbacks after we complete { OnConnectionChanged(commInterface, status, willReconnect); } } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { CommunicationInterface.ConnectionStatusType connectionStatus = (CommunicationInterface.ConnectionStatusType)value; bool unsetIfTrue = ((parameter != null) && (parameter is string) && ((string)parameter == "UnsetIfTrue")); bool disconnected = (connectionStatus == CommunicationInterface.ConnectionStatusType.Disconnected) || (connectionStatus == CommunicationInterface.ConnectionStatusType.CommunicationTerminated); if (disconnected) { if (unsetIfTrue) { return(DependencyProperty.UnsetValue); } } return(disconnected); }
protected virtual void OnConnectionChanged(CommunicationInterface commInteface, CommunicationInterface.ConnectionStatusType status, bool willReconnect) { if ((status == CommunicationInterface.ConnectionStatusType.CommunicationTerminated) || (status == CommunicationInterface.ConnectionStatusType.Disconnected)) { if (ShouldFailOnDisconnect()) { OperationCompleted(false); } } }
void ConnectionStatusChangedEvent(CommunicationInterface commInterface, CommunicationInterface.ConnectionStatusType status, bool willReconnect) { }