Exemple #1
0
 public void RefreshList()
 {
     User[] flist = Program.LobbyClient.Friends.OrderByDescending(x => x.Status == UserStatus.Online).ThenBy(x => x.UserName).ToArray();
     Dispatcher.Invoke(new Action(() =>
     {
         stackPanel1.Children.Clear();
         foreach (FriendListItem f in flist.Select(u => new FriendListItem
         {
             ThisUser = u,
             HorizontalAlignment
                 =
                     HorizontalAlignment
                     .
                     Stretch
         }))
         {
             f.MouseDoubleClick += FMouseDoubleClick;
             stackPanel1.Children.Add(f);
         }
         foreach (var g in Program.LobbyClient.Chatting.Rooms.Where(x => x.IsGroupChat))
         {
             var gc = new GroupChatListItem()
             {
                 ThisRoom            = g,
                 HorizontalAlignment = HorizontalAlignment.Stretch
             };
             gc.MouseDoubleClick += GiMouseDoubleClick;
             stackPanel1.Children.Add(gc);
         }
     }));
 }
Exemple #2
0
 public void RefreshList()
 {
     NewUser[] flist = Program.LobbyClient.Friends.OrderByDescending(x => x.Status == UserStatus.Online).ThenBy(x => x.UserName).ToArray();
     Dispatcher.Invoke(new Action(() =>
                                      {
         stackPanel1.Children.Clear();
         foreach (FriendListItem f in flist.Select(u => new FriendListItem
                                                         {
                                                             ThisUser = u,
                                                             HorizontalAlignment
                                                                 =
                                                                 HorizontalAlignment
                                                                 .
                                                                 Stretch
                                                         }))
         {
             f.MouseDoubleClick += FMouseDoubleClick;
             stackPanel1.Children.Add(f);
         }
         foreach( var g in Program.LobbyClient.Chatting.Rooms.Where(x=>x.IsGroupChat))
         {
             var gc = new GroupChatListItem()
             {
                 ThisRoom = g ,
                 HorizontalAlignment = HorizontalAlignment.Stretch
             };
             gc.MouseDoubleClick += GiMouseDoubleClick;
             stackPanel1.Children.Add(gc);
         }
                                      }));
 }
 public void RefreshList()
 {
     Dispatcher.Invoke(new Action(() =>
     {
         stackPanel1.Children.Clear();
         User[] flist = Program.lobbyClient.GetFriendsList();
         foreach (User u in flist)
         {
             FriendListItem f = new FriendListItem();
             f.ThisUser = u;
             f.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
             f.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(f_MouseDoubleClick);
             stackPanel1.Children.Add(f);
         }
         foreach (ChatRoom cr in Program.lobbyClient.Chatting.Rooms)
         {
             if (cr.ID == 0 || (cr.UserCount > 2))
             {
                 GroupChatListItem gi = new GroupChatListItem();
                 gi.ThisRoom = cr;
                 gi.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                 gi.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(gi_MouseDoubleClick);
                 stackPanel1.Children.Add(gi);
             }
         }
     }));
 }