Exemplo n.º 1
0
        private void InfoBoxFollowers_MouseDown(object sender, MouseButtonEventArgs e)
        {
            QuoteFmUser user = this.DataContext as QuoteFmUser;

            if (user != null)
            {
                ListOfUsers followers = QuoteSharp.API.getUsersListOfFollowers(user.username);
                if (followers != null)
                {
                    if (followers.entities != null)
                    {
                        ThreadSaveObservableCollection <QuoteFmUser> users = new ThreadSaveObservableCollection <QuoteFmUser>();
                        foreach (User follower in followers.entities)
                        {
                            users.Add(QuoteFmUser.createFromApi(follower));
                        }
                        int page = 0;
                        while (users.Count < user.FollowerCount)
                        {
                            page++;
                            ListOfUsers moreFollowers = QuoteSharp.API.getUsersListOfFollowers(user.username, page);
                            if (moreFollowers != null)
                            {
                                if (moreFollowers.entities != null)
                                {
                                    if (moreFollowers.entities.Count() == 0)
                                    {
                                        break;
                                    }
                                    foreach (User follower in followers.entities)
                                    {
                                        users.Add(QuoteFmUser.createFromApi(follower));
                                    }
                                }
                                else
                                {
                                    break;
                                }
                            }
                            else
                            {
                                break;
                            }
                        }

                        UserInterface.QuoteFM.ListUsers listUsers = new UserInterface.QuoteFM.ListUsers(users);
                        listUsers.Show();
                    }
                }
            }
        }
Exemplo n.º 2
0
 private void buttonCheckUsername_Click(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(textboxUsername.Text))
     {
         User user = QuoteSharp.API.getUser(textboxUsername.Text);
         if (user != null)
         {
             buttonAddAccount.IsEnabled = true;
             qfmUser = QuoteFmUser.createFromApi(user, getFollowings: true);
             textblockUserInfo.Text     = "Username check has been successfull. You now can add this account by pressing the button on the bottom right\n\n";
             textblockUserInfo.Text    += "Account data:\n\n";
             textblockUserInfo.Text    += qfmUser.DescriptiveText;
             buttonAddAccount.IsEnabled = true;
         }
     }
 }
Exemplo n.º 3
0
        private void ButtonUsername_Click(object sender, RoutedEventArgs e)
        {
            Button button = sender as Button;

            if (button != null)
            {
                QuoteFmUser person = button.CommandParameter as QuoteFmUser;
                if (person != null)
                {
                    if (person.FollowerCount == 0 && person.FollowingCount == 0)
                    {
                        QuoteSharp.User user = QuoteSharp.API.getUser(person.Id);
                        if (user != null)
                        {
                            person = QuoteFmUser.createFromApi(user);
                        }
                    }
                    ShowUser userInfo = new ShowUser();
                    userInfo.setPerson(person);
                    userInfo.Show();
                }
            }
        }