コード例 #1
0
ファイル: MainViewModel.cs プロジェクト: QuintenJohnson/WTalk
        void _client_ConversationHistoryLoaded(object sender, List <Conversation> e)
        {
            // associate contact list and last active conversation
            // only 1 to 1 conversation supported
            if (ActiveContacts == null)
            {
                ActiveContacts = new ObservableDictionary <string, ActiveContactModel>();
            }
            string participant_id;

            foreach (Conversation conversation in e)
            {
                participant_id = conversation.Participants.Keys.FirstOrDefault(c => c != CurrentUser.Id);
                if (ActiveContacts.ContainsKey(participant_id))
                {
                    ActiveContacts[participant_id].Conversation = conversation;
                }
                else
                {
                    ActiveContacts.Add(participant_id, new ActiveContactModel()
                    {
                        Conversation = conversation
                    });
                }
            }
            _conversationCache = e.ToDictionary(c => c.Id, c => new ConversationWindowManager(new ConversationViewModel(c, _client)));
        }
コード例 #2
0
ファイル: MainViewModel.cs プロジェクト: QuintenJohnson/WTalk
 void _client_ContactInformationReceived(object sender, User e)
 {
     if (ActiveContacts.ContainsKey(e.Id))
     {
         ActiveContacts[e.Id].Contact = e;
     }
     else
     {
         ActiveContacts.Add(e.Id, new ActiveContactModel()
         {
             Contact = e
         });
     }
 }