/// <summary>
        /// Button click event that gets the next 20 followed streamers and loads them into the datagridview
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void NextButton_Click(object sender, EventArgs e)
        {
            string pagination = _paginationStack.Peek();

            LoadTabFollowedStreamers(APICalls.GetFollowedStreamersNext(_userID, pagination));
            PreviousButton.Visible = true;
        }
Exemple #2
0
 /// <summary>
 /// Button click event that fills the datagridview with criteria based in the comboboxes
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ApplyButton_Click(object sender, EventArgs e)
 {
     if (_selectedStreamer != null)
     {
         NextButton.Visible = true;
         FillPastStreamsDataGridView(APICalls.GetStreams(_selectedStreamer.id, VideoTypeComboBox.Text, CreatedPeriodComboBox.Text, SortByComboBox.Text, int.Parse(ItemsPerPageComboBox.Text)));
     }
 }
Exemple #3
0
        /// <summary>
        /// Gets followed streamers
        /// </summary>
        /// <returns>UserFollowData object wich has a list of followed streamers' information</returns>
        private async Task <UserFollowData> getFollowedStreamers()
        {
            //used
            UserFollowData returnValue = null;

            string twitchUserName = txtTwitchUserName.Text;
            int    twitchUserID;

            twitchUserID = await getUserID(twitchUserName);

            returnValue = APICalls.GetFollowedStreamers(twitchUserID);

            return(returnValue);
        }
        /// <summary>
        /// Button click event that gets the previous 20 followed streamers and loads them into the datagridview
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PreviousButton_Click(object sender, EventArgs e)
        {
            _paginationStack.Pop();
            _paginationStack.Pop();

            if (_paginationStack.Count == 0)
            {
                LoadTabFollowedStreamers(APICalls.GetFollowedStreamers(_userID));
                PreviousButton.Visible = false;
            }
            else
            {
                string pagination = _paginationStack.Peek();
                LoadTabFollowedStreamers(APICalls.GetFollowedStreamersNext(_userID, pagination));
            }
        }
        /// <summary>
        /// Loads the first 20 followed streamers and inserts them into datagridview
        /// </summary>
        /// <param name="followedStreamerObject">Objects to insert into the datagridview</param>
        private void LoadTabFollowedStreamers(UserFollowData followedStreamerObject)
        {
            //Iprogress to update GUI Thread
            var addToDataGridView = new Progress <StreamerDataGridViewValues>(value =>
            {
                StreamerDataGridView.Rows.Add(value.ButtonText, value.StreamerImage, value.StreamerName);
            });
            var updateGUIThread = addToDataGridView as IProgress <StreamerDataGridViewValues>;

            try
            {
                SharedFunctions.ClearDataGridView(StreamerDataGridView);
                _paginationStack.Push(followedStreamerObject.pagination.cursor);

                string streamerLoginNames = "";
                //Create followed streamer URL Query
                followedStreamerObject.Data.ForEach(streamerFollowed => streamerLoginNames = streamerLoginNames + streamerFollowed.to_id + "&id=");
                //Cleaning up last "&id="
                streamerLoginNames = streamerLoginNames.Substring(0, streamerLoginNames.Length - 3);


                UserDataInformation followedStreamersList = APICalls.GetStreamerInformation(streamerLoginNames);
                _followedStreamerInformation = followedStreamersList.User;

                Task.Run(() =>
                {
                    followedStreamersList.User.ForEach(streamer =>
                    {
                        Bitmap bitmap = SharedFunctions.GetBitmapImage(streamer.profile_image_url);
                        updateGUIThread.Report(new StreamerDataGridViewValues("Select", bitmap, streamer.login));
                    });
                });
            }
            catch (ArgumentOutOfRangeException e)
            {
                updateGUIThread.Report(new StreamerDataGridViewValues("No More Streamers", Properties.Resources.RedX,
                                                                      "Click Previous button to go back to streamers"));
                Console.WriteLine(e.Message);
            }
            catch (NullReferenceException e)
            {
                updateGUIThread.Report(new StreamerDataGridViewValues("No More Streamers", Properties.Resources.RedX,
                                                                      "Click Previous button to go back to streamers"));
                Console.WriteLine(e.Message);
            }
        }
Exemple #6
0
        private async Task <UserDataInformation> getUserInformation()
        {
            //used
            UserDataInformation user = null;
            UserFollowData      followedStreamerList = await getFollowedStreamers();

            string streamerLoginNames = "";

            //Create first 20 followed URL Query
            followedStreamerList.Data.ForEach(streamerFollowed => streamerLoginNames = streamerLoginNames + streamerFollowed.to_name + "&login="******"&login="
            streamerLoginNames = streamerLoginNames.Substring(0, streamerLoginNames.Length - 7);

            user = APICalls.GetStreamerInformation(streamerLoginNames);

            return(user);
        }
 private VODMasterObject GetPastStreams(string beforeOrAfter, string pagination, string previousStreamType)
 {
     return(APICalls.GetStreams(_selectedStreamer.id, beforeOrAfter, pagination, "highlight"));
 }
 private VODMasterObject GetPastStreams()
 {
     return(APICalls.GetStreams(_selectedStreamer.id, "highlight"));
 }
Exemple #9
0
 private VODMasterObject getPastStreams()
 {
     return(APICalls.GetStreams(StreamerInformation.id, "highlight"));
 }
        /// <summary>
        /// Gets the UserInformation for the Username in Properties.Settings UserName
        /// </summary>
        /// <returns>UserDataObject for the username in Properties.Settings UserName</returns>
        private UserInformation getUserInformation()
        {
            UserDataInformation userDataInformationObject = APICalls.GetStreamerInformation(Properties.Settings.Default.UserName);

            return(userDataInformationObject.User[0]);
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="userID"></param>
 public void setupStreamerPickControl(int userID)
 {
     _userID = userID;
     LoadTabFollowedStreamers(APICalls.GetFollowedStreamers(_userID));
 }
        /// <summary>
        /// Button click event that fills the datagridview with criteria based in the combobox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ApplyButton_Click(object sender, EventArgs e)
        {
            int numOfObjects = int.Parse(ItemsPerPageComboBox.Text);

            LoadTabFollowedStreamers(APICalls.GetFollowedStreamers(_userID, numOfObjects));
        }
Exemple #13
0
        /// <summary>
        /// Get twitch user ID
        /// </summary>
        /// <param name="username">Twitch username</param>
        /// <returns></returns>
        private async Task <int> getUserID(string username)
        {
            UserDataInformation userDataInformationObject = APICalls.GetStreamerInformation(username);

            return(userDataInformationObject.User[0].id);
        }