protected override void OnReceive(object message) { switch (message) { case Say s: Publish(s); break; case JoinRoom j: _users[Sender] = j.UserName; Context.Watch(Sender); Publish(new SystemMsg($"{j.UserName} has joined {_roomName}")); break; case LeaveRoom l: Context.Unwatch(Sender); var user = _users[Sender]; Publish(new SystemMsg($"{user} has left {_roomName}")); _users.Remove(Sender); var left = new LeftRoom(_roomName); _receptionist.Tell(left); Sender.Tell(left); break; case Terminated t: // client abruptly terminated _users.Remove(t.ActorRef); _receptionist.Tell(new LeftRoom(_roomName)); break; default: Unhandled(message); break; } }
public void OnLeftRoom() { if (LeftRoom != null) { LeftRoom.Invoke(this); } }
public void Handle(LeftRoom message) { var leftRoom = message.Room; var link = this.chatGroup.Links.OfType <RoomLink>().FirstOrDefault(r => r.RoomName == leftRoom.Name); this.chatGroup.Links.Remove(link); var navigationLink = this.chatGroup.Links.FirstOrDefault(); this.ContentSource = navigationLink.Source; }
public override void PushB() { int pullAmount = MaxEnergy - Energy; int actualPull = 0; Room pullFromRoom = LeftRoom; if (pullFromRoom == null) { pullFromRoom = RightRoom; } actualPull = LeftRoom.TryPullEnergy(pullAmount); Energy += actualPull; }
public void OnClientLeftRoom(Room _room) { LeftRoom?.Invoke(_room); }
public void OnLeftRoom(object sender, PersonModel person, RoomModel room) { LeftRoom?.Invoke(sender, new RoomAttendanceEventArgs(person, room)); }
internal void OnLeftRoom() { LeftRoom?.Invoke(); }