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); }
/// <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); } }
/// <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> /// 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); }