예제 #1
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            if (AppConstants.activeUser.authorized)
            {
                user = AppConstants.activeUser;
                try
                {
                    channel = await user.RetrieveChannel();
                }
                catch (TwixelException ex)
                {
                    await HelperMethods.ShowErrorDialog(ex);
                }
                if (channel != null)
                {
                    statusTextBox.Text = channel.status;
                    if (channel.game != null)
                    {
                        gameTextBox.Text = channel.game;
                    }
                    await PlayStream();
                }

                volumeFlyout = new VolumeFlyout(volumeSlider, muteButton, volumeButton, streamPlayer);
                chatWindow   = new ChatWindow(Dispatcher, user.name, chatListView, chatScrollViewer, chatBox, sendButton);
                await chatWindow.LoadChatWindow();

                streamKeyTextBox.Text = user.streamKey;
                await LoadOnlineStreams();
                await LoadFollowingChannels();
                await LoadBlockedUsers();
                await LoadChannelEditors();
            }
            base.OnNavigatedTo(e);
        }
예제 #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();
            }
        }
        private async Task ResetStatus()
        {
            try
            {
                stream = await AppConstants.Twixel.RetrieveStream(stream.channel.name);
            }
            catch (TwixelException ex)
            {
                await HelperMethods.ShowErrorDialog(ex);

                return;
            }
            streamerNameTextBlock.Text      = stream.channel.displayName;
            streamDescriptionTextBlock.Text = stream.channel.status;
            gameNameTextBlock.Text          = stream.game;
            if (stream.viewers.HasValue)
            {
                streamViewersTextBlock.Text = stream.viewers.Value.ToString();
            }
        }
예제 #4
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);
            }
        }
예제 #5
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);
            }
        }
예제 #6
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            if (Frame.BackStack.Count > 0)
            {
                if (Frame.BackStack[Frame.BackStack.Count - 1].SourcePageType == typeof(LoadingPage) ||
                    Frame.BackStack[Frame.BackStack.Count - 1].SourcePageType == typeof(FinalConfirmation))
                {
                    HelperMethods.DisableBackButton();
                }
            }

            progressRing.IsActive = true;

            try
            {
                streams = await AppConstants.Twixel.RetrieveFeaturedStreams(0, 10);
            }
            catch (TwixelException ex)
            {
                await HelperMethods.ShowErrorDialog(ex);
            }
            foreach (FeaturedStream stream in streams)
            {
                stream.CleanTextString();
                stream.text = stream.text.Replace('\n', ' ').Trim();
                Dictionary <AppConstants.StreamQuality, Uri> q = null;
                try
                {
                    q = await HelperMethods.RetrieveHlsStream(stream.stream.channel.name);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }
                if (q != null)
                {
                    qualities.Add(q);
                }
                else
                {
                    qualities.Add(q);
                }
            }

            if (streams.Count > 0)
            {
                SetUpFeaturedStream();
                streamButton.IsEnabled = true;
                playButton.IsEnabled   = true;
                nextButton.IsEnabled   = true;
            }

            Total <List <Game> > topGames = null;

            try
            {
                topGames = await AppConstants.Twixel.RetrieveTopGames(0, 10);
            }
            catch (TwixelException ex)
            {
                await HelperMethods.ShowErrorDialog(ex);
            }
            if (topGames != null)
            {
                foreach (Game game in topGames.wrapped)
                {
                    topGamesCollection.Add(new GameGridViewBinding(game));
                }
            }
            progressRing.IsActive = false;
            base.OnNavigatedTo(e);
        }