public override void Execute()
        {
            bool   isBrowseMode;
            string screenName;
            Guid   currentWorkflowState;

            if (!GetRootState(out screenName, out isBrowseMode, out currentWorkflowState))
            {
                return;
            }

            string oldScreen = null;

            if (isBrowseMode)
            {
                NavigationData.LoadScreenHierarchy(screenName + "_OLD", out oldScreen);
            }

            NavigationData.SaveScreenHierarchy(screenName,
                                               isBrowseMode ? oldScreen : Consts.USE_BROWSE_MODE,
                                               !isBrowseMode /* backup when switching to browse mode */);

            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            workflowManager.StartBatchUpdate();
            workflowManager.NavigatePopToState(currentWorkflowState, true);
            workflowManager.NavigatePush(currentWorkflowState);
            workflowManager.EndBatchUpdate();
        }
Ejemplo n.º 2
0
        protected void LeaveMediaItemActionState()
        {
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            if (_deferredAction?.DoesChangeWorkflow ?? false)
            {
                workflowManager.StartBatchUpdate();
            }
            workflowManager.NavigatePop(1);
        }
        protected static void Navigate(Guid rootWorkflowState, ResourcePath path)
        {
            IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>();

            workflowManager.StartBatchUpdate();
            try
            {
                workflowManager.NavigatePopStates(new Guid[] { Consts.WF_STATE_ID_LOCAL_MEDIA_NAVIGATION_ROOT, Consts.WF_STATE_ID_BROWSE_MEDIA_NAVIGATION_ROOT });

                workflowManager.NavigatePush(rootWorkflowState);

                Share localShare = FindLocalShareContainingPath(path);
                if (localShare == null)
                {
                    ServiceRegistration.Get <ILogger>().Warn("AbstractBrowseMediaNavigationScreenData: Cannot navigate to local browse view - no local share countaining path '{0}' found", path);
                    return;
                }

                NavigationData nd = MediaNavigationModel.GetNavigationData(workflowManager.CurrentNavigationContext, false);
                if (nd == null)
                {
                    return;
                }
                AbstractMediaRootProxyViewSpecification rootVS = FindParentViewSpecification <AbstractMediaRootProxyViewSpecification>(nd);

                if (rootVS == null)
                {
                    return;
                }

                rootVS.Navigate(localShare, path, navigateVS =>
                {
                    NavigationData currentNd = MediaNavigationModel.GetNavigationData(workflowManager.CurrentNavigationContext, false);
                    if (currentNd == null)
                    {
                        ServiceRegistration.Get <ILogger>().Warn("AbstractBrowseMediaNavigationScreenData: Cannot navigate to local browse view - no navigation data found");
                        return;
                    }
                    AbstractItemsScreenData sd = (AbstractItemsScreenData)currentNd.CurrentScreenData;
                    sd.NavigateToView(navigateVS);
                });
            }
            finally
            {
                workflowManager.EndBatchUpdate();
            }
        }