private void HandleTryInitializeChat(Messages.TryInitializeChat x) { Dictionary <string, IActorRef> participantList = new Dictionary <string, IActorRef>(); if (userAddresses.Keys.Contains(x.To)) { participantList.Add(x.To, userAddresses[x.To]); } if (userAddresses.Keys.Contains(x.From)) { participantList.Add(x.To, userAddresses[x.From]); } if (participantList.Count > 1) { var chatServerActor = Context.ActorOf(Props.Create(() => new ChatServerActor())); var addToChat = new ChatApp.Actors.Messages.AddToChat(participantList); chatServerActor.Tell(addToChat); Sender.Tell(new Messages.StartChat(chatServerActor)); } }
private void HandleTryInitializeChat(Messages.TryInitializeChat tryInitiailizeChatMsg) { _chatCoordinatorActor.Ask <Messages.StartChat>(new Messages.TryInitializeChat(tryInitiailizeChatMsg.From, tryInitiailizeChatMsg.To)) .PipeTo <Messages.StartChat>(Self); }