Jibbr.ViewModels.AccountViewModel.StartNewChatSession C# (CSharp) Method

StartNewChatSession() public method

Open up a new chat session with the target
public StartNewChatSession ( JIDViewModel target ) : void
target JIDViewModel
return void
        public void StartNewChatSession(JIDViewModel target)
        {
            if (connectionState != XmppConnectionState.SessionStarted)
                return;

            lock (chatSessionsMutext)
            {
                //Do we already have a chat session open with this target?
                ChatSessionViewModel chatSession = chatSessions.SingleOrDefault(x => x.Target == target);
                if (chatSession == null)
                {
                    //Create and add.
                    chatSession = new ChatSessionViewModel(this, target);
                    chatSessions.Add(chatSession);
                }

                //Always notify
                NotifyChatSessionInitiatedByUser(chatSession);
            }
        }