private void UpdateNowPlayingItem(TransportOsdViewModel viewModel)
        {
            var menuViewModel = new InfoPanelViewModel(viewModel);

            PageContent.DataContext = MenuList.DataContext = menuViewModel;

            menuViewModel.PropertyChanged += InfoPanel_PropertyChanged;

            var media = viewModel.NowPlayingItem;

            UpdateLogo(viewModel, media);
        }
예제 #2
0
        private async void UpdateImage(TransportOsdViewModel viewModel)
        {
            var media = viewModel.NowPlayingItem;

            ImgPrimary.Visibility = Visibility.Hidden;

            if (media != null)
            {
                var apiClient = viewModel.ConnectionManager.GetApiClient(media);

                if (media.SeriesPrimaryImageTag != null)
                {
                    try
                    {
                        ImgPrimary.Source = await viewModel.ImageManager.GetRemoteBitmapAsync(apiClient, apiClient.GetImageUrl(media.SeriesId, new ImageOptions
                        {
                            Height = 350,
                            Tag = media.SeriesPrimaryImageTag,
                            ImageType = ImageType.Primary

                        }), CancellationToken.None);

                        ImgPrimary.Visibility = Visibility.Visible;
                    }
                    catch
                    {
                        // Already logged at lower levels
                    }
                }
                else if (media.HasPrimaryImage)
                {
                    try
                    {
                        ImgPrimary.Source = await viewModel.ImageManager.GetRemoteBitmapAsync(apiClient, apiClient.GetImageUrl(media, new ImageOptions
                        {
                            Height = 600,
                            ImageType = ImageType.Primary

                        }), CancellationToken.None);

                        ImgPrimary.Visibility = Visibility.Visible;
                    }
                    catch
                    {
                        // Already logged at lower levels
                    }
                }
            }
        }
        private async void UpdateImage(TransportOsdViewModel viewModel)
        {
            var media = viewModel.NowPlayingItem;

            ImgPrimary.Visibility = Visibility.Hidden;

            if (media != null && media.HasPrimaryImage)
            {
                try
                {
                    ImgPrimary.Source = await viewModel.ImageManager.GetRemoteBitmapAsync(viewModel.ApiClient.GetImageUrl(media, new ImageOptions
                    {
                        Height = 300

                    }), CancellationToken.None);

                    ImgPrimary.Visibility = Visibility.Visible;
                }
                catch
                {
                    // Already logged at lower levels
                }
            }
        }
        private async void UpdateLogo(TransportOsdViewModel viewModel, BaseItemDto media)
        {
            ImgLogo.Visibility = Visibility.Hidden;

            if (media != null && (media.HasLogo || !string.IsNullOrEmpty(media.ParentLogoItemId)))
            {
                try
                {
                    ImgLogo.Source = await viewModel.ImageManager.GetRemoteBitmapAsync(viewModel.ApiClient.GetLogoImageUrl(media, new ImageOptions
                    {
                    }));

                    ImgLogo.Visibility = Visibility.Visible;
                }
                catch
                {
                    // Already logged at lower levels
                }
            }
        }
        private void UpdateNowPlayingItem(TransportOsdViewModel viewModel)
        {
            UpdateImage(viewModel);

            var media = viewModel.NowPlayingItem;

            TxtName.Text = media == null ? string.Empty : GetName(media);
        }
 public InfoPanelViewModel(TransportOsdViewModel transportViewModel)
 {
     _transportViewModel = transportViewModel;
 }
        void FullscreenVideoPage_Loaded(object sender, RoutedEventArgs e)
        {
            _lastMouseInput = DateTime.Now;
            _activityTimer = new Timer(TimerCallback, null, 100, 100);

            _userInputManager.MouseMove += _userInputManager_MouseMove;
            _presentation.SetGlobalThemeContentVisibility(false);
            _playbackManager.PlaybackCompleted += _playbackManager_PlaybackCompleted;

            Osd.DataContext = _viewModel = new TransportOsdViewModel(_playbackManager, _apiClient, _imageManager, _presentation, _logger, _nav, _serverEvents);
        }
        void FullscreenVideoPage_Loaded(object sender, RoutedEventArgs e)
        {
            _lastMouseInput = DateTime.Now;
            _activityTimer = new Timer(TimerCallback, null, 100, 100);
            
            _userInputManager.MouseMove += _userInputManager_MouseMove;

            var player = _playbackManager
                .MediaPlayers
                .OfType<IVideoPlayer>()
                .FirstOrDefault(i => i.PlayState != PlayState.Idle);

            if (player != null && player.RequiresGlobalMouseHook)
            {
                _userInputManager.GlobalMouseMove += _userInputManager_GlobalMouseMove;
            }

            _presentation.SetGlobalThemeContentVisibility(false);
            _playbackManager.PlaybackCompleted += _playbackManager_PlaybackCompleted;

            Osd.DataContext = _viewModel = new TransportOsdViewModel(_playbackManager, _imageManager, _presentation, _logger, _nav, _connectionManager);
        }