private void AssociateAndSetParticipants(AssociateWithViewModel msg) { _viewModel = msg.ViewModel; foreach (var client in _conversationMetadata.Clients) { //Just being overly caution about race conditions string tempName = _participants?.FirstOrDefault(p => p.ClientId == client)?.Username; var status = _participants?.FirstOrDefault(ci => ci.ClientId == client)?.Status; _viewModel.AddParticipant(new ConversationParticipantViewModel() { Id = client, Status = status ?? ClientStatus.Available, Username = tempName ?? "Unknown" }); } }
private void OpenOrFocusWindow(ConversationMessages.ConversationStarted msg) { if (!_conversations.ContainsKey(msg.ConversationId)) { IActorRef conversationActor = Context.ActorOf(Props.Create(() => new ConversationViewModelActor(msg)), msg.ConversationId.ToString()); var newConversation = new ConversationViewModel(conversationActor, msg.ConversationId) { DisplayName = $"#{_conversations.Count+1}" }; _viewModel.AddConversation(newConversation); _conversations.Add(msg.ConversationId, conversationActor); } _viewModel.FocusConversation(msg.ConversationId); Context.ActorSelection(ClientActorPaths.NotifierActor.Path).Tell(new NotificationActor.NotifyUser()); }
public AssociateWithViewModel(ConversationViewModel viewModel) { ViewModel = viewModel; }