void IBFServerList.RemoveServer(uint ServerID) { if (storeDict.TryGetValue(ServerID, out var server)) { store.Remove(server); storeDict.Remove(ServerID); ServerChanged?.Invoke(this, server.ServerID, server, ServerChangeTypes.Remove); } }
void IBFServerList <T> .AddServer(T server) { if (!storeDict.ContainsKey(server.ServerID)) { store.Add(server); storeDict[server.ServerID] = server; ServerChanged?.Invoke(this, server.ServerID, server, ServerChangeTypes.Add); } }
public void SetRemoteState(RemoteClientWorldState worldState) { if (_worldState != null) { _worldState.Disconnected -= ProcessDisconnected; } _worldState = worldState; _worldState.Disconnected += ProcessDisconnected; ServerChanged?.Invoke(); }
private void ServerButton_Click(object sender, RoutedEventArgs e) { Server selectedServer = ButtonServers[(Button)sender]; ServerButtonClick?.Invoke(this, new ServerButtonClickArgs(selectedServer)); if (Inventory.CurrentServer != selectedServer) { Server previousServer = Inventory.CurrentServer; Inventory.SetCurrentServer(selectedServer); ServerChanged?.Invoke(this, new ServerChangedArgs(previousServer, selectedServer)); } }
void IBFServerList.UpdateServerPlayers(uint ServerID, byte[] info) { var serv = Find(ServerID); if (serv == null) { //server doesn't exist,create a new one serv = createServer(ServerID); AsEditable.AddServer(serv); } //server exists serv.Players.Parse(info); ServerChanged?.Invoke(this, ServerID, serv, ServerChangeTypes.Update); }
void IBFServerList.UpdateServerInfo(uint ServerID, byte[] info) { var serv = Find(ServerID); if (serv == null) { //server doesn't exist,create a new one var asInterface = (IBFServerList <T>) this; serv = createServer(ServerID); serv.Parse(info); AsEditable.AddServer(serv); } else { //server exists serv.Parse(info); ServerChanged?.Invoke(this, ServerID, serv, ServerChangeTypes.Update); } }
internal void OnServerChanged(bool weAreTheServer) { ServerChanged?.Invoke(this, new ServerChangedEventArgs(weAreTheServer)); }