protected void Update()
 {
   IWorkflowManager workflowManager = ServiceRegistration.Get<IWorkflowManager>();
   IPlayerContextManager playerContextManager = ServiceRegistration.Get<IPlayerContextManager>();
   IPlayerContext pc = playerContextManager.GetPlayerContext(PlayerChoice.CurrentPlayer);
   bool visible = pc != null;
   string displayTitleRes = null;
   if (pc != null)
     switch (pc.AVType)
     {
       case AVType.Audio:
         displayTitleRes = Consts.RES_SHOW_AUDIO_PLAYLIST;
         break;
       case AVType.Video:
         displayTitleRes = pc.IsPrimaryPlayerContext ? Consts.RES_SHOW_VIDEO_IMAGE_PLAYLIST : Consts.RES_SHOW_PIP_PLAYLIST;
         break;
       default:
         // Unknown player context type
         visible = false;
         break;
     }
   visible = visible && !workflowManager.IsStateContainedInNavigationStack(Consts.WF_STATE_ID_SHOW_PLAYLIST);
   lock (_syncObj)
   {
     if (visible == _isVisible && displayTitleRes == _displayTitleResource)
       return;
     _isVisible = visible;
     _displayTitleResource = displayTitleRes;
   }
   FireStateChanged();
 }
        protected void CheckScreenSaver()
        {
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            if (workflowManager.IsStateContainedInNavigationStack(Consts.WF_STATE_ID_PARTY_MUSIC_PLAYER))
            {
                if (DisableScreenSaver)
                {
                    if (_screenSaverController == null)
                    {
                        IScreenControl screenControl = ServiceRegistration.Get <IScreenControl>();
                        _screenSaverController = screenControl.GetScreenSaverController();
                    }
                    if (_screenSaverController != null)
                    {
                        _screenSaverController.IsScreenSaverDisabled = true;
                    }
                }
            }
            else
            {
                if (_screenSaverController != null)
                {
                    _screenSaverController.Dispose();
                    _screenSaverController = null;
                }
            }
        }
        protected void Update()
        {
            IPlayerContextManager playerContextManager = ServiceRegistration.Get <IPlayerContextManager>();
            IWorkflowManager      workflowManager      = ServiceRegistration.Get <IWorkflowManager>();
            IPlayerContext        pcPrimary            = playerContextManager.PrimaryPlayerContext;
            IPlayer      primaryPlayer = pcPrimary == null ? null : pcPrimary.CurrentPlayer;
            IImagePlayer pp            = primaryPlayer as IImagePlayer;
            IVideoPlayer vp            = primaryPlayer as IVideoPlayer;
            IAudioPlayer ap            = primaryPlayer as IAudioPlayer;
            bool         visible       = (pp != null || vp != null || ap != null) &&
                                         !workflowManager.IsStateContainedInNavigationStack(pcPrimary.FullscreenContentWorkflowStateId);
            IResourceString displayTitleRes;

            if (ap != null)
            {
                displayTitleRes = LocalizationHelper.CreateResourceString(Consts.RES_AUDIO_VISUALIZATION);
            }
            else if (vp != null)
            {
                displayTitleRes = LocalizationHelper.CreateStaticString(
                    LocalizationHelper.CreateResourceString(Consts.RES_FULLSCREEN_VIDEO).Evaluate(vp.Name));
            }
            else
            {
                displayTitleRes = LocalizationHelper.CreateResourceString(Consts.RES_FULLSCREEN_IMAGE);
            }
            lock (_syncObj)
            {
                _isVisible            = visible;
                _displayTitleResource = displayTitleRes;
            }
            FireStateChanged();
        }
        public bool NavigateBackToOverview()
        {
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            if (!workflowManager.IsStateContainedInNavigationStack(Consts.WF_STATE_ID_PLAYLISTS_OVERVIEW) ||
                workflowManager.CurrentNavigationContext.WorkflowState.StateId == Consts.WF_STATE_ID_PLAYLISTS_OVERVIEW)
            {
                return(false);
            }
            workflowManager.NavigatePopToState(Consts.WF_STATE_ID_PLAYLISTS_OVERVIEW, false);
            return(true);
        }
        protected override void Update()
        {
            base.Update();
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            _displayTitle = LocalizationHelper.CreateResourceString(workflowManager.IsStateContainedInNavigationStack(Consts.WF_STATE_ID_LOCAL_MEDIA_NAVIGATION_ROOT) ?
                                                                    Consts.RES_SWITCH_TO_BROWSE_ML_VIEW : Consts.RES_SWITCH_TO_LOCAL_MEDIA_VIEW);
            _isInBrowseState = workflowManager.IsAnyStateContainedInNavigationStack(new Guid[]
            {
                Consts.WF_STATE_ID_LOCAL_MEDIA_NAVIGATION_ROOT,
                Consts.WF_STATE_ID_BROWSE_MEDIA_NAVIGATION_ROOT,
            }) && MediaNavigationModel.GetNavigationData(workflowManager.CurrentNavigationContext, false) != null;
        }
        protected void Update()
        {
            IPlayerContextManager playerContextManager = ServiceRegistration.Get <IPlayerContextManager>();
            IWorkflowManager      workflowManager      = ServiceRegistration.Get <IWorkflowManager>();
            IPlayerContext        pc = playerContextManager.CurrentPlayerContext;
            bool visible             = pc != null && !workflowManager.IsStateContainedInNavigationStack(pc.CurrentlyPlayingWorkflowStateId);

            if (visible == _isVisible)
            {
                return;
            }
            _isVisible = visible;
            FireStateChanged();
        }
예제 #7
0
        /// <summary>
        /// Returns the information if the playlist management action should be visible in the current workflow state.
        /// </summary>
        protected bool ShowPlaylistManagement()
        {
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            return(!workflowManager.IsStateContainedInNavigationStack(Consts.WF_STATE_ID_PLAYLISTS_OVERVIEW));
        }
        protected void Update()
        {
            ISystemStateService sss = ServiceRegistration.Get <ISystemStateService>();

            if (sss.CurrentState != SystemState.Running)
            {
                return;
            }
            INotificationService notificationService = ServiceRegistration.Get <INotificationService>();
            int numNotifications             = notificationService.Notifications.Count;
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            if (numNotifications == 0 && workflowManager.CurrentNavigationContext.WorkflowState.StateId == Consts.WF_STATE_ID_WATCH_NOTIFICATIONS)
            {
                // Don't pop the watch-notifications state from the navigation stack if we are in a sub state
                workflowManager.NavigatePopToStateAsync(Consts.WF_STATE_ID_WATCH_NOTIFICATIONS, true);
            }
            IsNotificationsHintVisible         = !workflowManager.IsStateContainedInNavigationStack(Consts.WF_STATE_ID_WATCH_NOTIFICATIONS) && numNotifications > 0;
            NumNotificationsTotal              = numNotifications;
            IsNotificationsAvailable           = numNotifications > 0;
            IsMoreThanOneNotificationAvailable = numNotifications > 1;
            if (numNotifications <= 1)
            {
                NMoreNotificationsText = string.Empty;
            }
            else if (numNotifications == 2)
            {
                NMoreNotificationsText = LocalizationHelper.Translate(Consts.RES_ONE_MORE_NOTIFICATION);
            }
            else
            {
                NMoreNotificationsText = LocalizationHelper.Translate(Consts.RES_N_MORE_NOTIFICATIONS, numNotifications - 1);
            }
            INotification notification = notificationService.PeekNotification();

            CurrentNotification = notification;
            if (notification != null)
            {
                if (string.IsNullOrEmpty(notification.CustomIconPath))
                {
                    switch (notification.Type)
                    {
                    case NotificationType.UserInteractionRequired:
                        NotificationSymbolRelFilePath = Consts.REL_PATH_USER_INTERACTION_REQUIRED_ICON;
                        break;

                    case NotificationType.Info:
                        NotificationSymbolRelFilePath = Consts.REL_PATH_INFO_ICON;
                        break;

                    case NotificationType.Warning:
                        NotificationSymbolRelFilePath = Consts.REL_PATH_WARNING_ICON;
                        break;

                    case NotificationType.Error:
                        NotificationSymbolRelFilePath = Consts.REL_PATH_ERROR_ICON;
                        break;
                    }
                }
                else
                {
                    NotificationSymbolRelFilePath = notification.CustomIconPath;
                }
                HasSubWorkflow = notification.HandlerWorkflowState.HasValue;
            }
        }