private void OnConnectionEvent(object sender, ConnectionEventArgs e) { if (e.NewState == ConnectionEventArgs.EState.CONNECTED) { m_timerReconnect.IsEnabled = false; if (IsNeverConnected) { IsNeverConnected = false; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("IsNeverConnected")); } Log.i(TAG, "Connected to " + CurrentServer.ServerName + " (" + CurrentServer.ServerIP.ToString() + ")", true); } else if (e.NewState == ConnectionEventArgs.EState.DISCONNECTED) { if (m_timerReconnect.IsEnabled) { m_timeNextReconnectTry.StartCountDown(m_timeNextReconnectTry.CountdownInterval); Log.s(TAG, "Failed to reconnect to " + LastConnectedServer.ServerName + " (Next try in " + (int)Math.Ceiling(m_timeNextReconnectTry.RemainingMillisecondsToCountdown / 1000f) + "s)"); } else { if (!e.UserRequested && !e.PesistentError && Properties.Settings.Default.Reconnect && CurrentServer.WasAttached) { StartReconnecting(CurrentServer); } } if (e.RemoteMinVersionError) { SoftwareUpdateRequired?.Invoke(this, new EventArgs()); } } NotifyChange(new String[] { "IsConnecting", "IsConnectingOrDiscovering", "ConnectedToServer" }); }
private void OnDiscoveryFinished(object sender, DiscoveryFinishedEventArgs e) { if (e.RemoteMinProtocolTooHigh) { SoftwareUpdateRequired?.Invoke(this, new EventArgs()); } NotifyChange(new String[] { "IsDiscovering", "IsConnectingOrDiscovering" }); }