protected void UpdateGroupingsList()
        {
            _groupingItemsList.Clear();
            NavigationData navigationData           = GetCurrentNavigationData();
            ICollection <Sorting.Sorting> groupings = navigationData.AvailableGroupings;

            if (groupings == null)
            {
                return;
            }
            ListItem groupingItem = new ListItem(Consts.KEY_NAME, Consts.RES_NO_GROUPING)
            {
                Command  = new MethodDelegateCommand(() => navigationData.CurrentGrouping = null),
                Selected = navigationData.CurrentGrouping == null
            };

            groupingItem.AdditionalProperties[Consts.KEY_GROUPING] = null;
            _groupingItemsList.Add(groupingItem);

            foreach (Sorting.Sorting grouping in groupings.Where(g => g.IsAvailable(navigationData.CurrentScreenData)))
            {
                Sorting.Sorting groupingCopy = grouping;
                groupingItem = new ListItem(Consts.KEY_NAME, grouping.GroupByDisplayName)
                {
                    Command  = new MethodDelegateCommand(() => navigationData.CurrentGrouping = groupingCopy),
                    Selected = navigationData.CurrentGrouping == groupingCopy
                };
                groupingItem.AdditionalProperties[Consts.KEY_GROUPING] = groupingCopy;
                _groupingItemsList.Add(groupingItem);
            }
            _groupingItemsList.FireChange();
        }
Пример #2
0
 /// <summary>
 /// Creates a new navigation data structure for a new media navigation step.
 /// </summary>
 /// <param name="parent">Parent navigation data, this navigation data is derived from.</param>
 /// <param name="navigationContextName">Name, which is used for the corresponding workflow navigation context.</param>
 /// <param name="currentWorkflowStateId">Id of the workflow state which corresponds to the new media navigation step.</param>
 /// <param name="parentWorkflowStateId">Id of the workflow state to which the workflow navigation should be reverted when
 /// another filter is choosen.</param>
 /// <param name="baseViewSpecification">View specification for the media items of the new media navigation step.</param>
 /// <param name="defaultScreen">Screen which should present the new navigation step by default.</param>
 /// <param name="availableScreens">Available set of screen descriptions which can present the new media navigation step.</param>
 /// <param name="currentSorting">Denotes the current sorting for the items to be shown. If this is set to <c>null</c>,
 /// default sorting will be applied.</param>
 /// <param name="currentGrouping">Denotes the current grouping for the items to be shown.</param>
 public NavigationData(NavigationData parent, string navigationContextName, Guid parentWorkflowStateId, Guid currentWorkflowStateId,
                       ViewSpecification baseViewSpecification, AbstractScreenData defaultScreen, ICollection <AbstractScreenData> availableScreens,
                       Sorting.Sorting currentSorting, Sorting.Sorting currentGrouping) :
     this(parent, navigationContextName, parentWorkflowStateId, currentWorkflowStateId, baseViewSpecification, defaultScreen, availableScreens,
          currentSorting, currentGrouping, false)
 {
 }
Пример #3
0
        /// <summary>
        /// Enters a new media navigation context by inheriting all currently available screens. This is used for
        /// presenting the contents of a media items or filter group, where the current menu should remain available.
        /// Only the currently visible screen can be exchanged to configure another presentation mode for the group to
        /// be stepped-in.
        /// </summary>
        /// <remarks>
        /// Actually, we mix two different concerns in this method:
        /// <list type="number">
        /// <item>The setting that the new navigation context will be subordinated, i.e. it will be removed/exchanged by a filter action</item>
        /// <item>The setting that all menu actions will be adopted from the parent navigation context</item>
        /// </list>
        /// But in fact, filter actions are only used together with the concept that there exist two different kind of navigation contexts;
        /// autonomous contexts and subordinated contexts.
        /// If there are no filter actions present (like in the browse media navigation modes), the only difference between the methods
        /// <see cref="StackSubordinateNavigationContext"/> and <see cref="StackAutonomousNavigationContext"/> is the inheritance of the menu.
        /// </remarks>
        /// <param name="subViewSpecification">Specification for the sub view to be shown in the new navigation context.</param>
        /// <param name="visibleScreen">Screen which should be visible in the new navigation context.</param>
        /// <param name="navbarDisplayLabel">Display label to be shown in the navigation bar for the new navigation context.</param>
        /// <returns>Newly created navigation data.</returns>
        public NavigationData StackSubordinateNavigationContext(ViewSpecification subViewSpecification, AbstractScreenData visibleScreen,
                                                                string navbarDisplayLabel)
        {
            WorkflowState newState = WorkflowState.CreateTransientState(
                "View: " + subViewSpecification.ViewDisplayName, subViewSpecification.ViewDisplayName,
                false, null, true, WorkflowType.Workflow, null);

            ScreenConfig nextScreenConfig;

            LoadLayoutSettings(visibleScreen.ToString(), out nextScreenConfig);

            Sorting.Sorting nextSortingMode = AvailableSortings.FirstOrDefault(
                sorting => sorting.GetType().ToString() == nextScreenConfig.Sorting && sorting.IsAvailable(visibleScreen)) ?? _currentSorting;
            Sorting.Sorting nextGroupingMode = string.IsNullOrEmpty(nextScreenConfig.Grouping) ? null : AvailableGroupings.FirstOrDefault(
                grouping => grouping.GetType().ToString() == nextScreenConfig.Grouping && grouping.IsAvailable(visibleScreen)) ?? _currentGrouping;

            NavigationData newNavigationData = new NavigationData(this, subViewSpecification.ViewDisplayName,
                                                                  _baseWorkflowStateId, newState.StateId, subViewSpecification, visibleScreen, _availableScreens, nextSortingMode, nextGroupingMode, true)
            {
                LayoutType = nextScreenConfig.LayoutType,
                LayoutSize = nextScreenConfig.LayoutSize
            };

            PushNewNavigationWorkflowState(newState, navbarDisplayLabel, newNavigationData);
            return(newNavigationData);
        }
        protected void SetGrouping(Sorting.Sorting grouping)
        {
            NavigationData navigationData = GetCurrentNavigationData();

            if (navigationData == null)
            {
                return;
            }
            navigationData.CurrentGrouping = grouping;
        }
Пример #5
0
        /// <summary>
        /// Enters a new media navigation context by modifying the list of available screens. This is used for
        /// presenting the result of a filter, where the menu must be changed.
        /// </summary>
        /// <param name="subViewSpecification">Specification for the sub view to be shown in the new navigation context.</param>
        /// <param name="currentMenuItemLabel">Current menu item label needed for distinction of available screens.</param>
        /// <param name="navbarDisplayLabel">Display label to be shown in the navigation bar for the new navigation context.</param>
        /// <returns>Newly created navigation data.</returns>
        public NavigationData StackAutonomousNavigationContext(ViewSpecification subViewSpecification, string currentMenuItemLabel, string navbarDisplayLabel)
        {
            AbstractScreenData currentScreen = AvailableScreens.FirstOrDefault(screen => screen.MenuItemLabel == currentMenuItemLabel);
            ICollection <AbstractScreenData> remainingScreens = new List <AbstractScreenData>(AvailableScreens.Where(screen => screen != currentScreen));

            WorkflowState newState = WorkflowState.CreateTransientState(
                "View: " + subViewSpecification.ViewDisplayName, subViewSpecification.ViewDisplayName,
                false, null, false, WorkflowType.Workflow, null);

            string             nextScreenName;
            AbstractScreenData nextScreen = null;

            // Try to load the prefered next screen from settings.
            if (LoadScreenHierarchy(CurrentScreenData.GetType().ToString(), out nextScreenName))
            {
                nextScreen = remainingScreens.FirstOrDefault(s => s.GetType().ToString() == nextScreenName);
            }

            // Default way: always take the first of the available screens.
            if (nextScreen == null)
            {
                nextScreen = remainingScreens.First(s => s != currentScreen);
            }

            ScreenConfig nextScreenConfig;

            LoadLayoutSettings(nextScreen.GetType().ToString(), out nextScreenConfig);

            Sorting.Sorting nextSortingMode = AvailableSortings.FirstOrDefault(
                sorting => sorting.GetType().ToString() == nextScreenConfig.Sorting && sorting.IsAvailable(nextScreen)) ?? _currentSorting;
            Sorting.Sorting nextGroupingMode = String.IsNullOrEmpty(nextScreenConfig.Grouping) ? null : AvailableGroupings.FirstOrDefault(
                grouping => grouping.GetType().ToString() == nextScreenConfig.Grouping && grouping.IsAvailable(nextScreen)) ?? _currentGrouping;

            NavigationData newNavigationData = new NavigationData(this, subViewSpecification.ViewDisplayName,
                                                                  newState.StateId, newState.StateId, subViewSpecification, nextScreen, remainingScreens,
                                                                  nextSortingMode, nextGroupingMode)
            {
                LayoutType = nextScreenConfig.LayoutType, LayoutSize = nextScreenConfig.LayoutSize
            };

            PushNewNavigationWorkflowState(newState, navbarDisplayLabel, newNavigationData);
            return(newNavigationData);
        }
Пример #6
0
 // If the suppressActions parameter is set to <c>true</c>, no actions will be built. Instead, they will be inherited from
 // the parent navigation step. That is used for subview navigation where the navigation step doesn't produce own
 // workflow actions.
 protected NavigationData(NavigationData parent, string navigationContextName, Guid parentWorkflowStateId, Guid currentWorkflowStateId,
                          ViewSpecification baseViewSpecification, AbstractScreenData defaultScreen, ICollection <AbstractScreenData> availableScreens,
                          Sorting.Sorting currentSorting, bool suppressActions)
 {
     _parent = parent;
     _navigationContextName  = navigationContextName;
     _currentWorkflowStateId = currentWorkflowStateId;
     _baseWorkflowStateId    = parentWorkflowStateId;
     _baseViewSpecification  = baseViewSpecification;
     _currentScreenData      = defaultScreen;
     _availableScreens       = availableScreens ?? new List <AbstractScreenData>();
     _currentSorting         = currentSorting;
     if (suppressActions)
     {
         _dynamicWorkflowActions = null;
     }
     else
     {
         BuildWorkflowActions();
     }
 }
Пример #7
0
        protected void UpdateSortingsList()
        {
            _sortingItemsList.Clear();
            NavigationData navigationData          = GetCurrentNavigationData();
            ICollection <Sorting.Sorting> sortings = navigationData.AvailableSortings;

            if (sortings == null)
            {
                return;
            }
            foreach (Sorting.Sorting sorting in sortings)
            {
                Sorting.Sorting sortingCopy = sorting;
                ListItem        sortingItem = new ListItem(Consts.KEY_NAME, sorting.DisplayName)
                {
                    Command = new MethodDelegateCommand(() => navigationData.CurrentSorting = sortingCopy)
                };
                sortingItem.AdditionalProperties[Consts.KEY_SORTING] = sortingCopy;
                _sortingItemsList.Add(sortingItem);
            }
            _sortingItemsList.FireChange();
        }
Пример #8
0
 public CombinedSorting(Sorting.Sorting grouping, Sorting.Sorting sorting)
 {
     _grouping = grouping;
     _sorting  = sorting;
 }