示例#1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            try
            {
                NavigationHelper.OnNavigatedTo(this);

                SubscribeModelEvents();
                _sensor.OrientationChanged += Sensor_OrientationChanged;

                if (VideoPageViewHelper.IsLandscapeOrientation(Orientation))
                {
                    SetVisibilityControls(Visibility.Collapsed);
                }
                else
                {
                    SetVisibilityControls(Visibility.Visible);
                }

                var viewModel = DataContext as PlaylistVideoPageViewModel;
                if (viewModel == null)
                {
                    return;
                }

                if (viewModel.NavigationPanelViewModel == null)
                {
                    return;
                }

                var binding = new Binding {
                    Source = viewModel, Path = new PropertyPath("VideoViewModel.VideoUri")
                };
                player.SetBinding(LiteTubePlayer.SourceProperty, binding);

                if (e.NavigationMode == NavigationMode.Back && viewModel.VideoViewModel.IsLive)
                {
                    player = null;
                    RestorePlayer();
                    player?.Load();
                }

                if (!viewModel.NavigationPanelViewModel.IsAuthorized)
                {
                    return;
                }

                if (_currentApplicationBar.Buttons.Contains(_favoritesApplicationBarButton))
                {
                    return;
                }
                _currentApplicationBar.Buttons.Add(_favoritesApplicationBarButton);
            }
            catch (Exception)
            {
                ;
            }
        }
示例#2
0
        private void CopyVideoUrl_Click(object sender, EventArgs eventArgs)
        {
            var viewModel = DataContext as PlaylistVideoPageViewModel;

            if (viewModel == null)
            {
                return;
            }

            VideoPageViewHelper.CopyVideoUrl(viewModel.VideoViewModel);
        }
示例#3
0
        private void AddToFavorites_Click(object sender, EventArgs e)
        {
            var viewModel = DataContext as PlaylistVideoPageViewModel;

            if (viewModel == null)
            {
                return;
            }

            VideoPageViewHelper.AddToFavorites(viewModel.VideoViewModel);
        }
示例#4
0
        private void Send_Click(object sender, EventArgs e)
        {
            var viewModel = DataContext as PlaylistVideoPageViewModel;

            if (viewModel == null)
            {
                return;
            }

            VideoPageViewHelper.SendComment(viewModel.VideoViewModel);
        }
示例#5
0
        private void ChangeOrientation(PageOrientation orientation)
        {
            if (VideoPageViewHelper.IsLandscapeOrientation(orientation))
            {
                SetPlayerFullScreenState();
                SetVisibilityControls(Visibility.Collapsed);
                return;
            }

            SetPlayerNormalState();
            SetVisibilityControls(Visibility.Visible);
        }
示例#6
0
 private void CopyVideoUrl_Click(object sender, EventArgs eventArgs)
 {
     VideoPageViewHelper.CopyVideoUrl(DataContext as VideoPageViewModel);
 }
示例#7
0
 private void AddToPlaylist_Click(object sender, EventArgs e)
 {
     VideoPageViewHelper.AddToPlaylist(DataContext as VideoPageViewModel);
 }
示例#8
0
 private void AddToFavorites_Click(object sender, EventArgs e)
 {
     VideoPageViewHelper.AddToFavorites(DataContext as VideoPageViewModel);
 }
示例#9
0
 private void Send_Click(object sender, EventArgs e)
 {
     VideoPageViewHelper.SendComment(DataContext as VideoPageViewModel);
 }
示例#10
0
 private void PlayerIsFullScreenChanged(object sender, RoutedPropertyChangedEventArgs <bool> e)
 {
     _isFullScreen = player.IsFullScreen;
     VideoPageViewHelper.PlayerIsFullScreenChanged(this, player);
 }
示例#11
0
 private void Sensor_OrientationChanged(SimpleOrientationSensor sender, SimpleOrientationSensorOrientationChangedEventArgs args)
 {
     VideoPageViewHelper.SensorOrientationChanged(this, args);
 }