private void StartReconnecting(BbRemoteServerHistory server) { if (m_timerReconnect.IsEnabled) { return; } Log.i(TAG, "Trying to reconnect to " + server.ServerName, true); LastConnectedServer = new BbRemoteServerHistory(server); m_timeNextReconnectTry.StartCountDown(20000); m_timerReconnect.Tick += OnReconnectTimer_Tick; m_timerReconnect.IsEnabled = true; }
public BbRemoteServerHistory(BbRemoteServerHistory src) { ServerIP = src.ServerIP; Port = src.Port; ConnectedTime = src.ConnectedTime; DisconnectedTime = src.DisconnectedTime; ProtocolIncompatible = src.ProtocolIncompatible; m_nSessionID = src.m_nSessionID; ServerName = src.ServerName; ServerGUID = src.ServerGUID; ServerMinProtocolVersion = src.ServerMinProtocolVersion; SupportsScreenCapture = src.SupportsScreenCapture; IsProVersion = src.IsProVersion; }
private async Task <bool> ConnectToServerAsync(IPAddress address, UInt16 nPort, int nServerGUID, BbRemoteServerHistory reconnect) { if (CurrentServer != null) { if (CurrentServer.Attached && CurrentServer.ServerGUID == nServerGUID && CurrentServer.ServerIP.Equals(address) && CurrentServer.Port == nPort) { return(true); } await CurrentServer.CloseAsync(); } if (reconnect == null) { Log.i(TAG, "Trying to connect to " + address.ToString() + ":" + nPort, true); } CurrentServer = reconnect != null ? new BbRemoteServer(reconnect): new BbRemoteServer(address, nPort, nServerGUID); CurrentServer.ConnectionChanged += OnConnectionEvent; CurrentServer.ConnectionChanged += m_mainWin.AppIconManager.onConnectionEvent; CurrentServer.ConnectionChanged += ReceiveFilesManager.OnConnectionEvent; CurrentServer.ConnectionChanged += SendFilesManager.onConnectionEvent; CurrentServer.ConnectionChanged += ScreenCapture.OnConnectionEvent; CurrentServer.ConnectionChanged += m_mainWin.OnConnectionEvent; CurrentServer.ReceivedInputFeedback += m_mainWin.OnInputFeedbackEvent; CurrentServer.ReceivedIcon += m_mainWin.AppIconManager.onReceivedIcon; CurrentServer.BatteryStatusChanged += m_mainWin.OnBatteryStatusChanged; CurrentServer.ReceivedFile += ReceiveFilesManager.OnReceivedFileEvent; CurrentServer.ReceivedSharedText += m_mainWin.OnSharedText; CurrentServer.ReceivedSendFileCommand += SendFilesManager.onSendFileEvent; Task <bool> connectTask = CurrentServer.ConnectAsync(); NotifyChange(new String[] { "IsConnecting", "IsConnectingOrDiscovering" }); bool bResult = await connectTask; if (!bResult) { NotifyChange(new String[] { "IsConnecting", "IsConnectingOrDiscovering" }); if (reconnect == null) { Log.i(TAG, "Failed to connect to " + address.ToString() + ":" + nPort, true); } } return(bResult); }
public BbRemoteServer(BbRemoteServerHistory src) : base(src) { }