示例#1
0
        private void OnClientRosterItem(object sender, RosterItem item)
        {
            if (!_roster.ContainsKey(item.Jid.User))
            {
                _roster.Add(item.Jid.User, item.Name);

                _nicks.Add(item.Name, item.GetAttribute("mention_name"));

                Logger.Info(string.Format("User '{0}' logged in", item.Name));
            }
        }
 public void xmpp_OnRosterItem(object sender, RosterItem item)
 {
     try
     {
         Core.UserList.Add(item);
         Core.RunOnUiThread(() =>
         {
             if (item.GetAttribute("name") == "Facebook User")
             {
                 return;
             }
             try
             {
                 var chatItem = new ChatPlayerItem
                 {
                     Group    = item.GetAttribute("group"),
                     Jid      = item.Jid,
                     Messages = new List <string>(),
                     Username = item.GetAttribute("name")
                 };
                 Core.AllPlayers.Add(item.GetAttribute("name"), chatItem);
             }
             catch
             {
                 var itemPlayer = Core.AllPlayers[item.GetAttribute("name")];
                 Core.AllPlayers.Remove(item.GetAttribute("name"));
                 Core.AllPlayers.Add(item.GetAttribute("name"), itemPlayer);
             }
             var control = new PlayerChatControl
             {
                 _playerNameLabel = { Content = item.GetAttribute("name") },
                 Tag = Core.AllPlayers[item.GetAttribute("name")]
             };
             Core.PlayerChatControls.Add(item.GetAttribute("jid"), control);
         });
     }
     catch
     {
         //MessageBox.Show(ex.ToString());
     }
 }