public void DisconnectUserFromMap(UserConnection userConnection) { if (_collections.TryGetValue(userConnection.GetMapId(), out MapDataHolder collection)) { collection.disconnectUser.Add(userConnection.GetUser()); userConnection.Send(_byteMessageFactory.DisconnectUserFromMap(userConnection.GetMapId())); } else { throw ExceptionFactory.SoftException(ExceptionEnum.MapNotFound, "Map not found"); } }
public void AddUserOnMap(UserConnection userConnection, int mapId) { if (_collections.TryGetValue(mapId, out MapDataHolder collection)) { collection.users.Add(userConnection.GetUser()); userConnection.SetMapId(mapId); userConnection.Send(_byteMessageFactory.AddedUser()); } else { throw ExceptionFactory.SoftException(ExceptionEnum.MapNotFound, "Map not found"); } }
public async void GetUser() { try { //because my User doesnt implement INotifyChange class the binding doesnt update CurrentUser = await UserConnection.GetUser(); FirstNameTB.Text = CurrentUser.FirstName; LastNameTB.Text = CurrentUser.LastName; UsernameTB.Text = CurrentUser.Username; ApplicationRuntimeData.CurrentUser = CurrentUser; } catch (Exception e) { MessageBox.Show("Couldn't gather updated account data\n" + e.Message); } Loader.Visibility = Visibility.Hidden; }