private void ShowSingleChannelGuide(IChannel channel)
        {
            if (channel == null || CurrentChannelGroup == null)
            {
                return;
            }

            int channelId = channel.ChannelId;
            int groupId   = CurrentChannelGroup.ChannelGroupId;
            IWorkflowManager        workflowManager         = ServiceRegistration.Get <IWorkflowManager>();
            NavigationContextConfig navigationContextConfig = new NavigationContextConfig();

            navigationContextConfig.AdditionalContextVariables = new Dictionary <string, object>();
            navigationContextConfig.AdditionalContextVariables[SlimTvClientModel.KEY_CHANNEL_ID] = channelId;
            navigationContextConfig.AdditionalContextVariables[SlimTvClientModel.KEY_GROUP_ID]   = groupId;
            Guid stateId = new Guid("A40F05BB-022E-4247-8BEE-16EB3E0B39C5");

            if (workflowManager.IsAnyStateContainedInNavigationStack(new Guid[] { stateId }))
            {
                workflowManager.NavigatePopToState(stateId, false);
            }
            else
            {
                workflowManager.NavigatePush(stateId, navigationContextConfig);
            }
        }
Exemplo n.º 2
0
        public override async Task <AsyncResult <ContentDirectoryMessaging.MediaItemChangeType> > ProcessAsync(MediaItem mediaItem)
        {
            // If the MediaItem was loaded from ML
            bool result = false;

            if (IsManagedByMediaLibrary(mediaItem))
            {
                foreach (KeyValuePair <Guid, Guid> aspectScreen in _aspectScreens)
                {
                    if (mediaItem.Aspects.ContainsKey(aspectScreen.Key))
                    {
                        ServiceRegistration.Get <IThreadPool>().Add(() =>
                        {
                            // TODO: This is a workaround for a specific IWorkflowManager issue:
                            // By interface design it is able to support batching of WF transitions, but the screen manager is not. In our special case here
                            // the closing of the dialog leads to a "Pop", while the action itself issues a "Push". The order is not always kept and leads to
                            // unpredictable results. So the workaround moves the "Push" into a background thread and waits a while before executing.
                            // Ideally the IScreenManager implementation should by finished.
                            Thread.Sleep(300);
                            var wf            = ServiceRegistration.Get <IWorkflowManager>();
                            var contextConfig = new NavigationContextConfig {
                                AdditionalContextVariables = new Dictionary <string, object> {
                                    { Consts.KEY_MEDIA_ITEM, mediaItem }
                                }
                            };
                            wf.NavigatePush(aspectScreen.Value, contextConfig);
                            result = true;
                        });
                        break;
                    }
                }
            }
            return(new AsyncResult <ContentDirectoryMessaging.MediaItemChangeType>(result, ContentDirectoryMessaging.MediaItemChangeType.None));
        }
Exemplo n.º 3
0
        public static void Show(IProgram program)
        {
            NavigationContextConfig navigationContextConfig = new NavigationContextConfig();

            navigationContextConfig.AdditionalContextVariables = new Dictionary <string, object>();
            navigationContextConfig.AdditionalContextVariables[SlimTvClientModel.KEY_PROGRAM] = program;
            navigationContextConfig.AdditionalContextVariables[SlimTvClientModel.KEY_MODE]    = false;
            Show(navigationContextConfig);
        }
Exemplo n.º 4
0
        public static void Show(ISchedule schedule)
        {
            NavigationContextConfig navigationContextConfig = new NavigationContextConfig();

            navigationContextConfig.AdditionalContextVariables = new Dictionary <string, object>();
            navigationContextConfig.AdditionalContextVariables[SlimTvClientModel.KEY_SCHEDULE] = schedule;
            navigationContextConfig.AdditionalContextVariables[SlimTvClientModel.KEY_MODE]     = true;
            Show(navigationContextConfig);
        }
Exemplo n.º 5
0
        private static void Show(NavigationContextConfig context)
        {
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();
            Guid             stateId         = new Guid("3C6081CB-88DC-44A7-9E17-8D7BFE006EE5");

            if (workflowManager.IsAnyStateContainedInNavigationStack(new Guid[] { stateId }))
            {
                workflowManager.NavigatePopToState(stateId, false);
            }
            else
            {
                workflowManager.NavigatePush(stateId, context);
            }
        }
        public static void Show(IProgram program)
        {
            NavigationContextConfig context = null;

            if (program != null)
            {
                context = new NavigationContextConfig();
                context.AdditionalContextVariables = new Dictionary <string, object>();
                context.AdditionalContextVariables[SlimTvClientModel.KEY_PROGRAM] = program;
            }
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            workflowManager.NavigatePush(STATE_MANUAL_SCHEDULE, context);
        }