private void PopulateLists()
        {
            Dispatcher.Invoke(() =>
            {
                serversListView.Items.Clear();
                List <DiscordServer> tempCopy = MainClient.GetServersList();
                tempCopy.Sort((s1, s2) => s1.Name.CompareTo(s2.Name));
                foreach (var server in tempCopy)
                {
                    ServerStub stub = new ServerStub(server);

                    serversListView.Items.Add(stub);
                }
            });
        }
 private void serversListView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (serversListView.SelectedIndex > -1)
     {
         ServerStub stub = serversListView.SelectedItem as ServerStub;
         ServerView view = new ServerView(stub.Server, MainClient);
         view.Closed += (se, xe) =>
         {
             openServerViews.Remove(se as ServerView);
         };
         openServerViews.Add(view);
         view.Show();
         //ServerInfo info = new ServerInfo(stub.Server);
         //info.ShowDialog();
     }
 }
Beispiel #3
0
        public UserInfo(DiscordMember member, DiscordClient client)
        {
            InitializeComponent();
            SetupTheme();

            Member = member;
            mainClientReference = client;

            if (Member.Avatar != null)
            {
                BitmapImage _userAvatar = new BitmapImage(Member.GetAvatarURL());
                Icon = _userAvatar;
                try
                {
                    userAvatar.Source = _userAvatar;
                }
                catch (Exception) { }
            }
            usernameLabel.Content = Member.Username + $" (#{Member.Discriminator})";
            Title = "User info for " + Member.Username;
            if (member.CurrentGame != null)
            {
                userID.Content = $"Playing {member.CurrentGame}";
            }
            else
            {
                userID.Content = "";
            }

            foreach (var server in mainClientReference.GetServersList())
            {
                foreach (var __member in server.Members)
                {
                    if (__member.Value.ID == member.ID)
                    {
                        ServerStub stub = new ServerStub(server);
                        inServers.Items.Add(stub);
                    }
                }
            }
        }
        public UserInfo(DiscordMember member, DiscordClient client)
        {
            InitializeComponent();
            SetupTheme();

            Member = member;
            mainClientReference = client;

            if(Member.Avatar != null)
            {
                BitmapImage _userAvatar = new BitmapImage(Member.GetAvatarURL());
                Icon = _userAvatar;
                try
                {
                    userAvatar.Source = _userAvatar;
                }
                catch (Exception) { }
            }
            usernameLabel.Content = Member.Username + $" (#{Member.Discriminator})";
            Title = "User info for " + Member.Username;
            if (member.CurrentGame != null)
                userID.Content = $"Playing {member.CurrentGame}";
            else
                userID.Content = "";

            foreach(var server in mainClientReference.GetServersList())
            {
                foreach(var __member in server.members)
                {
                    if(__member.ID == member.ID)
                    {
                        ServerStub stub = new ServerStub(server);
                        inServers.Items.Add(stub);
                    }
                }
            }
            
        }
 private void PopulateLists()
 {
     Dispatcher.Invoke(() =>
     {
         serversListView.Items.Clear();
         List<DiscordServer> tempCopy = MainClient.GetServersList();
         tempCopy.Sort((s1, s2) => s1.name.CompareTo(s2.name));
         foreach (var server in tempCopy)
         {
             ServerStub stub = new ServerStub(server);
             
             serversListView.Items.Add(stub);
         }
     });
 }
        private void PopulateLists()
        {
            Dispatcher.Invoke(() =>
            {
                serversListView.Items.Clear();
                foreach (var server in MainClient.GetServersList())
                {
                    ServerStub stub = new ServerStub(server);
                    //serversListView.Items.Add(server.name);

                    serversListView.Items.Add(stub);
                }
            });
        }