private void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message)
 {
     if (message.ChannelName == PlayerContextManagerMessaging.CHANNEL)
     {
         PlayerContextManagerMessaging.MessageType messageType = (PlayerContextManagerMessaging.MessageType)message.MessageType;
         switch (messageType)
         {
         case PlayerContextManagerMessaging.MessageType.CurrentPlayerChanged:
             Update();
             break;
         }
     }
     else if (message.ChannelName == PlayerManagerMessaging.CHANNEL)
     {
         PlayerManagerMessaging.MessageType messageType = (PlayerManagerMessaging.MessageType)message.MessageType;
         switch (messageType)
         {
         case PlayerManagerMessaging.MessageType.PlayerSlotStarted:
         case PlayerManagerMessaging.MessageType.PlayerSlotClosed:
             Update();
             break;
         }
     }
     else if (message.ChannelName == WorkflowManagerMessaging.CHANNEL)
     {
         WorkflowManagerMessaging.MessageType messageType = (WorkflowManagerMessaging.MessageType)message.MessageType;
         switch (messageType)
         {
         case WorkflowManagerMessaging.MessageType.NavigationComplete:
             Update();
             break;
         }
     }
 }
示例#2
0
        private void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message)
        {
            if (!IsSystemActive())
            {
                return;
            }

            if (!_attachedToMenuItems)
            {
                UpdateMenu();
            }

            if (message.ChannelName == WorkflowManagerMessaging.CHANNEL)
            {
                WorkflowManagerMessaging.MessageType messageType = (WorkflowManagerMessaging.MessageType)message.MessageType;
                if (messageType == WorkflowManagerMessaging.MessageType.NavigationComplete)
                {
                    var context = ServiceRegistration.Get <IWorkflowManager>().CurrentNavigationContext;
                    if (context != null && context.WorkflowState.StateId == HOME_STATE_ID)
                    {
                        UpdateMenu();
                    }
                }
            }
        }
示例#3
0
        private void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message)
        {
            if (message.ChannelName == WorkflowManagerMessaging.CHANNEL)
            {
                WorkflowManagerMessaging.MessageType messageType = (WorkflowManagerMessaging.MessageType)message.MessageType;
                if (messageType == WorkflowManagerMessaging.MessageType.NavigationComplete)
                {
                    var context = ServiceRegistration.Get <IWorkflowManager>().CurrentNavigationContext;

                    if (context != null && context.WorkflowState.StateId == HOME_STATE_ID)
                    {
                        if (context.WorkflowState.StateId == HOME_STATE_ID)
                        {
                            // If we are returning to the home state then we need to manually
                            // attach and refresh the items, as we detached and missed any changes when leaving.
                            AttachAndRefreshHomeMenuItems();
                            MarkHomeContentUpdate();
                        }
                        else
                        {
                            // The items can change outside of the home state if a different WF state adds some temporary actions to the WF manager.
                            // Usually these temporary actions will be removed again before returning to the home state. To ensure that we don't
                            // unnecessarily update our items, which can prevent restoring focus correctly, don't listen to changes outside of the home state.
                            DetachHomeMenuItems();
                        }
                    }
                }
            }
        }
示例#4
0
 void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message)
 {
     if (message.ChannelName == WorkflowManagerMessaging.CHANNEL)
     {
         WorkflowManagerMessaging.MessageType messageType = (WorkflowManagerMessaging.MessageType)message.MessageType;
         switch (messageType)
         {
         case WorkflowManagerMessaging.MessageType.NavigationComplete:
             Update();
             break;
         }
     }
 }
 void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message)
 {
     if (message.ChannelName == WorkflowManagerMessaging.CHANNEL)
     {
         WorkflowManagerMessaging.MessageType messageType = (WorkflowManagerMessaging.MessageType)message.MessageType;
         switch (messageType)
         {
         case WorkflowManagerMessaging.MessageType.NavigationComplete:
             SelectedItem = null; // Clear current data for new screen
             break;
         }
     }
 }
示例#6
0
 private void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message)
 {
     if (message.ChannelName == WorkflowManagerMessaging.CHANNEL)
     {
         WorkflowManagerMessaging.MessageType messageType = (WorkflowManagerMessaging.MessageType)message.MessageType;
         if (messageType == WorkflowManagerMessaging.MessageType.StatePushed)
         {
             if (((NavigationContext)message.MessageData[WorkflowManagerMessaging.CONTEXT]).WorkflowState.StateId == HOME_STATE_ID)
             {
                 UpdateMenu();
             }
         }
         else if (messageType == WorkflowManagerMessaging.MessageType.NavigationComplete)
         {
             var context = ServiceRegistration.Get <IWorkflowManager>().CurrentNavigationContext;
             if (context != null && context.WorkflowState.StateId == HOME_STATE_ID)
             {
                 UpdateMenu();
             }
         }
     }
 }
        void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message)
        {
            if (message.ChannelName == WorkflowManagerMessaging.CHANNEL)
            {
                // Adjust our knowledge about the currently opened FSC/CP state if the user switches to one of them
                WorkflowManagerMessaging.MessageType messageType = (WorkflowManagerMessaging.MessageType)message.MessageType;
                switch (messageType)
                {
                case WorkflowManagerMessaging.MessageType.StatesPopped:
                    ICollection <Guid> statesRemoved = new List <Guid>(
                        ((IDictionary <Guid, NavigationContext>)message.MessageData[WorkflowManagerMessaging.CONTEXTS]).Keys);
                    HandleStatesRemovedFromWorkflowStack(statesRemoved);
                    break;

                case WorkflowManagerMessaging.MessageType.StatePushed:
                    NavigationContext context = (NavigationContext)message.MessageData[WorkflowManagerMessaging.CONTEXT];
                    Guid stateId = context.WorkflowState.StateId;
                    HandleWorkflowStatePushed(stateId);
                    break;
                }
            }
            else if (message.ChannelName == PlayerManagerMessaging.CHANNEL)
            {
                // React to player changes
                PlayerManagerMessaging.MessageType messageType = (PlayerManagerMessaging.MessageType)message.MessageType;
                IPlayerSlotController psc;
                switch (messageType)
                {
                case PlayerManagerMessaging.MessageType.PlayerResumeState:
                    psc = (IPlayerSlotController)message.MessageData[PlayerManagerMessaging.PLAYER_SLOT_CONTROLLER];
                    IResumeState resumeState = (IResumeState)message.MessageData[PlayerManagerMessaging.KEY_RESUME_STATE];
                    Guid         mediaItemId = (Guid)message.MessageData[PlayerManagerMessaging.KEY_MEDIAITEM_ID];
                    HandleResumeInfo(psc, mediaItemId, resumeState);
                    break;

                case PlayerManagerMessaging.MessageType.PlayerError:
                case PlayerManagerMessaging.MessageType.PlayerEnded:
                    psc = (IPlayerSlotController)message.MessageData[PlayerManagerMessaging.PLAYER_SLOT_CONTROLLER];
                    HandlePlayerEnded(psc);
                    break;

                case PlayerManagerMessaging.MessageType.PlayerStopped:
                    psc = (IPlayerSlotController)message.MessageData[PlayerManagerMessaging.PLAYER_SLOT_CONTROLLER];
                    HandlePlayerStopped(psc);
                    break;

                case PlayerManagerMessaging.MessageType.RequestNextItem:
                    psc = (IPlayerSlotController)message.MessageData[PlayerManagerMessaging.PLAYER_SLOT_CONTROLLER];
                    HandleRequestNextItem(psc);
                    break;
                }
                CleanupPlayerContexts();
                CheckMediaWorkflowStates_NoLock(); // Primary player could have been changed or closed or CP player could have been closed
            }
            else if (message.ChannelName == PlayerContextManagerMessaging.CHANNEL)
            {
                // React to internal player context manager changes
                PlayerContextManagerMessaging.MessageType messageType = (PlayerContextManagerMessaging.MessageType)message.MessageType;
                switch (messageType)
                {
                case PlayerContextManagerMessaging.MessageType.UpdatePlayerRolesInternal:
                    PlayerContext newCurrentPlayer = (PlayerContext)message.MessageData[PlayerContextManagerMessaging.NEW_CURRENT_PLAYER_CONTEXT];
                    PlayerContext newAudioPlayer   = (PlayerContext)message.MessageData[PlayerContextManagerMessaging.NEW_AUDIO_PLAYER_CONTEXT];
                    HandleUpdatePlayerRoles(newCurrentPlayer, newAudioPlayer);
                    break;
                    // PlayerContextManagerMessaging.MessageType.CurrentPlayerChanged not handled here
                }
            }
        }
        void OnMessageReceived(AsynchronousMessageQueue queue, SystemMessage message)
        {
            if (message.ChannelName == WorkflowManagerMessaging.CHANNEL)
            {
                // Adjust our knowledge about the currently opened FSC/CP state if the user switches to one of them
                WorkflowManagerMessaging.MessageType messageType =
                    (WorkflowManagerMessaging.MessageType)message.MessageType;
                switch (messageType)
                {
                case WorkflowManagerMessaging.MessageType.StatesPopped:
                    ICollection <Guid> statesRemoved = new List <Guid>(
                        ((IDictionary <Guid, NavigationContext>)message.MessageData[WorkflowManagerMessaging.CONTEXTS]).Keys);
                    HandleStatesRemovedFromWorkflowStack(statesRemoved);
                    break;

                case WorkflowManagerMessaging.MessageType.StatePushed:
                    NavigationContext context = (NavigationContext)message.MessageData[WorkflowManagerMessaging.CONTEXT];
                    Guid stateId = context.WorkflowState.StateId;
                    HandleWorkflowStatePushed(stateId);
                    break;
                }
            }
            else if (message.ChannelName == PlayerManagerMessaging.CHANNEL)
            {
                // React to player changes
                PlayerManagerMessaging.MessageType messageType =
                    (PlayerManagerMessaging.MessageType)message.MessageType;
                IPlayerSlotController psc;
                uint activationSequence;
                switch (messageType)
                {
                case PlayerManagerMessaging.MessageType.PlayerError:
                case PlayerManagerMessaging.MessageType.PlayerEnded:
                    psc = (IPlayerSlotController)message.MessageData[PlayerManagerMessaging.PLAYER_SLOT_CONTROLLER];
                    activationSequence = (uint)message.MessageData[PlayerManagerMessaging.ACTIVATION_SEQUENCE];
                    HandlePlayerEnded(psc, activationSequence);
                    break;

                case PlayerManagerMessaging.MessageType.PlayerStopped:
                    psc = (IPlayerSlotController)message.MessageData[PlayerManagerMessaging.PLAYER_SLOT_CONTROLLER];
                    activationSequence = (uint)message.MessageData[PlayerManagerMessaging.ACTIVATION_SEQUENCE];
                    HandlePlayerStopped(psc, activationSequence);
                    break;

                case PlayerManagerMessaging.MessageType.RequestNextItem:
                    psc = (IPlayerSlotController)message.MessageData[PlayerManagerMessaging.PLAYER_SLOT_CONTROLLER];
                    activationSequence = (uint)message.MessageData[PlayerManagerMessaging.ACTIVATION_SEQUENCE];
                    HandleRequestNextItem(psc, activationSequence);
                    break;

                case PlayerManagerMessaging.MessageType.PlayerSlotsChanged:
                    HandlePlayerSlotsChanged();
                    break;
                }
                CheckCurrentPlayerSlot();          // Current player could have been closed
                CheckMediaWorkflowStates_NoLock(); // Primary player could have been changed or closed or CP player could have been closed
            }
            else if (message.ChannelName == PlayerContextManagerMessaging.CHANNEL)
            {
                // React to internal player context manager changes
                PlayerContextManagerMessaging.MessageType messageType =
                    (PlayerContextManagerMessaging.MessageType)message.MessageType;
                switch (messageType)
                {
                case PlayerContextManagerMessaging.MessageType.UpdatePlayerRolesInternal:
                    int newCurrentPlayerIndex = (int)message.MessageData[PlayerContextManagerMessaging.CURRENT_PLAYER_INDEX];
                    int newAudioPlayerIndex   = (int)message.MessageData[PlayerContextManagerMessaging.AUDIO_PLAYER_INDEX];
                    HandlePlayerRolesChanged(newCurrentPlayerIndex, newAudioPlayerIndex);
                    break;
                    // PlayerContextManagerMessaging.MessageType.CurrentPlayerChanged not handled here
                }
            }
        }