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()); } }
void ItemMouseDoubleClick(object sender, MouseButtonEventArgs e) { var item = (SmallChatItem)sender; var player = (ChatPlayerItem)item.Tag; if (_playerChatStackPanel.Children.Cast <PlayerChatControl>().Any(items => (string)items._playerNameLabel.Content == player.Username && items.Visibility != Visibility.Collapsed)) { return; } var playerControl = new PlayerChatControl { Tag = player, _playerNameLabel = { Content = player.Username }, _statusEllipse = { Fill = item.StatusEllipse.Fill }, Margin = new Thickness(5, 0, 0, 0) }; playerControl.MouseDown += PlayerControlMouseDown; _playerChatStackPanel.Children.Add(playerControl); }
void item_MouseDoubleClick(object sender, MouseButtonEventArgs e) { var item = (SmallChatItem)sender; var player = (ChatPlayerItem)item.Tag; foreach (PlayerChatControl items in PlayerChatStackPanel.Children) { if ((string)items.PlayerNameLabel.Content == player.Username && items.Visibility != Visibility.Collapsed) { return; } } var playerControl = new PlayerChatControl { Tag = player, PlayerNameLabel = { Content = item.PlayerNameLabel.Content }, StatusEllipse = { Fill = item.StatusEllipse.Fill }, Margin = new Thickness(5, 0, 0, 0) }; playerControl.MouseDown += PlayerControl_MouseDown; PlayerChatStackPanel.Children.Add(playerControl); }
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()); } }
void ItemMouseDoubleClick(object sender, MouseButtonEventArgs e) { var item = (SmallChatItem)sender; var player = (ChatPlayerItem)item.Tag; if (_playerChatStackPanel.Children.Cast<PlayerChatControl>().Any(items => (string)items._playerNameLabel.Content == player.Username && items.Visibility != Visibility.Collapsed)) { return; } var playerControl = new PlayerChatControl { Tag = player, _playerNameLabel = { Content = player.Username }, _statusEllipse = { Fill = item.StatusEllipse.Fill }, Margin = new Thickness(5, 0, 0, 0) }; playerControl.MouseDown += PlayerControlMouseDown; _playerChatStackPanel.Children.Add(playerControl); }