private void AddServerToDropDown(ServerData serverData) { var oldCount = _popupServerNames.Count; _popupServerNames.Add(serverData.IpAddress); if (oldCount == 0) { _currentServerIndex = 0; _serverList.SelectServerFromList(_serverList.AvailableServers[_currentServerIndex]); ConnectToServer(); } }
private void RemoveInactiveServers() { ServerData removedServer = null; for (int i = AvailableServers.Count - 1; i >= 0; i--) { if (_timeProvider.RealtimeSinceStartup - AvailableServers[i].LastConnectionTime > SERVER_INACTIVE_TOLERANCE) { removedServer = AvailableServers[i].ServerData; if (removedServer == SelectedServer.ServerData) { RemoveSelectedServer(removedServer); } AvailableServers.RemoveAt(i); i--; } } if (removedServer != null) { ServerRemoved(removedServer); ServerListChanged(); } }
private void RemoveServerFromDropDown(ServerData serverData) { _popupServerNames.Remove(serverData.IpAddress); }
private void DisconnectFromSelectedServer(ServerData serverData) { ConnectionClient.Disconnect(); }