async Task LoadVideos()
        {
            videosLoader.StartLoading();
            DisableButtons();
            List <Video> videos = new List <Video>();

            try
            {
                if (selectedPeriod == Selected.Week)
                {
                    videos = await AppConstants.Twixel.RetrieveTopVideos(null, TwitchConstants.Period.Week, videosLoader.Offset, 100);
                }
                else if (selectedPeriod == Selected.Month)
                {
                    videos = await AppConstants.Twixel.RetrieveTopVideos(null, TwitchConstants.Period.Month, videosLoader.Offset, 100);
                }
                else if (selectedPeriod == Selected.AllTime)
                {
                    videos = await AppConstants.Twixel.RetrieveTopVideos(null, TwitchConstants.Period.All, videosLoader.Offset, 100);
                }
            }
            catch (TwixelException ex)
            {
                await HelperMethods.ShowMessageDialog(string.Format("Looks like there was an error. Here are the details:\nStatus Code: {0}\nError: {1}\nMessage: {2}", ex.Error.Status.ToString(), ex.Error.Error, ex.Error.Message), ex.Message);
            }
            if (!videosLoader.CheckForEnd(videos))
            {
                foreach (Video video in videos)
                {
                    videosCollection.Add(new VideosGridViewBinding(video));
                }
                videosLoader.EndLoading(100);
            }
            EnableButtons();
        }
Пример #2
0
        async Task LoadFollowingChannels()
        {
            followingChannelsLoader.StartLoading();
            Total <List <Follow <Channel> > > followingChannels = null;

            try
            {
                followingChannels = await user.RetrieveFollowing(followingChannelsLoader.Offset, 100);
            }
            catch (TwixelException ex)
            {
                await HelperMethods.ShowErrorDialog(ex);
            }
            if (followingChannels != null)
            {
                if (!followingChannelsLoader.CheckForEnd(followingChannels.wrapped))
                {
                    foreach (Follow <Channel> follow in followingChannels.wrapped)
                    {
                        followingChannelsCollection.Add(new ChannelProfileListViewBinding(follow.wrapped.logo, follow.wrapped.displayName, follow.wrapped));
                    }
                    followingChannelsLoader.EndLoading(100);
                }
            }
            else
            {
                followingChannelsLoader.ForceEnd();
            }
        }
Пример #3
0
        async Task LoadStreams()
        {
            streamsLoader.StartLoading();
            Total <List <Stream> > streams = await AppConstants.Twixel.RetrieveStreams(game.name, new List <string>(), streamsLoader.Offset, 100);

            if (!streamsLoader.CheckForEnd(streams.wrapped))
            {
                foreach (Stream stream in streams.wrapped)
                {
                    streamsCollection.Add(new GameStreamsGridViewBinding(stream));
                }
                streamsLoader.EndLoading(100);
            }
        }
Пример #4
0
        async Task LoadGames()
        {
            gamesLoader.StartLoading();
            Total <List <Game> > games = await AppConstants.Twixel.RetrieveTopGames(gamesLoader.Offset, 100);

            if (!gamesLoader.CheckForEnd(games.wrapped))
            {
                foreach (Game game in games.wrapped)
                {
                    gamesCollection.Add(new GameGridViewBinding(game));
                }
                gamesLoader.EndLoading(100);
            }
        }
        async Task LoadVideos()
        {
            videosLoader.StartLoading();
            Total <List <Video> > videos = await AppConstants.Twixel.RetrieveVideos(channel.name, videosLoader.Offset, 100);

            if (!videosLoader.CheckForEnd(videos.wrapped))
            {
                foreach (Video video in videos.wrapped)
                {
                    videosCollection.Add(new VideosGridViewBinding(video));
                }
                videosLoader.EndLoading(100);
            }
        }
        async Task LoadSearch()
        {
            searchLoader.StartLoading();
            Total <List <Stream> > searchedStreams = await AppConstants.Twixel.SearchStreams(searchQuery, searchLoader.Offset, 100);

            if (searchedStreams.total.HasValue)
            {
                numberOfStreamsTextBlock.Text = searchedStreams.total.Value.ToString();
            }

            if (!searchLoader.CheckForEnd(searchedStreams.wrapped))
            {
                foreach (Stream stream in searchedStreams.wrapped)
                {
                    streamsCollection.Add(new GameStreamsGridViewBinding(stream));
                }
                searchLoader.EndLoading(100);
            }
        }
Пример #7
0
        async Task LoadOnlineStreams()
        {
            followedOnlineStreamsLoader.StartLoading();
            List <Stream> onlineStreams = new List <Stream>();

            try
            {
                onlineStreams = await user.RetrieveOnlineFollowedStreams(followedOnlineStreamsLoader.Offset, 100);
            }
            catch (TwixelException ex)
            {
                await HelperMethods.ShowErrorDialog(ex);
            }

            if (!followedOnlineStreamsLoader.CheckForEnd(onlineStreams))
            {
                foreach (Stream onlineStream in onlineStreams)
                {
                    followedOnlineStreamsCollection.Add(new GameStreamsGridViewBinding(onlineStream));
                }
                followedOnlineStreamsLoader.EndLoading(100);
            }
        }
Пример #8
0
        async Task LoadBlockedUsers()
        {
            blockedUsersLoader.StartLoading();
            List <Block> blockedUsers = new List <Block>();

            try
            {
                blockedUsers = await user.RetrieveBlockedUsers(blockedUsersLoader.Offset, 100);
            }
            catch (TwixelException ex)
            {
                await HelperMethods.ShowErrorDialog(ex);
            }

            if (!blockedUsersLoader.CheckForEnd(blockedUsers))
            {
                foreach (Block block in blockedUsers)
                {
                    blockedUsersCollection.Add(new ChannelProfileListViewBinding(block.user));
                }
                blockedUsersLoader.EndLoading(100);
            }
        }