示例#1
0
        private void searchField_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Return)
            {
                ProfilesList profilesList = new ProfilesList();
                profilesList.twitterAccountToken = twitterAccountToken;
                profilesList.setTitle("\"" + searchField.Text + "\"");
                navController.pushControl(profilesList);

                String query = searchField.Text;

                BackgroundWorker worker = new BackgroundWorker();
                worker.DoWork += (sender2, e2) =>
                {
                    Account twitterAccount = MastodonAPIWrapper.sharedApiWrapper.accountWithToken(twitterAccountToken);
                    dynamic search         = MastodonAPIWrapper.sharedApiWrapper.searchUsers(twitterAccount, query, 200);
                    profilesList.list = search;
                    profilesList.convertList();
                };
                worker.RunWorkerCompleted += (sender2, e2) =>
                {
                    profilesList.renderList();
                };
                worker.RunWorkerAsync();
            }
        }
        private void Following_Click(object sender, MouseButtonEventArgs e)
        {
            ProfilesList profilesList = new ProfilesList();

            profilesList.twitterAccountToken = twitterAccountToken;
            profilesList.setTitle("Following");
            navController.pushControl(profilesList);

            BackgroundWorker worker = new BackgroundWorker();

            worker.DoWork += (sender2, e2) =>
            {
                Account twitterAccount = MastodonAPIWrapper.sharedApiWrapper.accountWithToken(twitterAccountToken);
                dynamic followers      = MastodonAPIWrapper.sharedApiWrapper.followingList(twitterAccount, profileUserID, 200);
                profilesList.profiles = followers;
            };
            worker.RunWorkerCompleted += (sender2, e2) =>
            {
                profilesList.renderList();
            };
            worker.RunWorkerAsync();
        }