/// <summary> /// Tries to find the resource path corresponding to the given media library <paramref name="viewSpecification"/>. /// </summary> /// <param name="viewSpecification">View specification to be examined.</param> /// <param name="path">Path corresponding to the given <paramref name="viewSpecification"/>, if it is a media library view specification (i.e. one of the /// view specifications which are created in any of the sub views of this view specification). Else, this parameter will return <c>null</c>.</param> /// <returns><c>true</c>, if the given <paramref name="viewSpecification"/> is one of the direct or indirect view specifications which are created as sub view specifications /// of this view specification.</returns> public static bool TryGetLocalBrowseViewPath(ViewSpecification viewSpecification, out ResourcePath path) { MediaLibraryBrowseViewSpecification mlbvs = viewSpecification as MediaLibraryBrowseViewSpecification; if (mlbvs != null) { // We're in some MediaLibrary browsing state IServerConnectionManager serverConnectionManager = ServiceRegistration.Get<IServerConnectionManager>(); string localSystemId = ServiceRegistration.Get<ISystemResolver>().LocalSystemId; if (mlbvs.SystemId != localSystemId && mlbvs.SystemId != serverConnectionManager.HomeServerSystemId) { // If the currently browsed system is a different one, the path must be set to null path = null; return true; } // In a browsing state for the local system, we can return the base path from the view specification path = mlbvs.BasePath; return true; } BrowseMediaRootProxyViewSpecification bmrvs = viewSpecification as BrowseMediaRootProxyViewSpecification; SystemSharesViewSpecification ssvs = viewSpecification as SystemSharesViewSpecification; AllSystemsViewSpecification asvs = viewSpecification as AllSystemsViewSpecification; if (ssvs != null || asvs != null || bmrvs != null) { // If the current browsing state shows one of the root browse states, we can just set the path to null path = null; return true; } path = null; return false; }
/// <summary> /// Tries to find the resource path corresponding to the given media library <paramref name="viewSpecification"/>. /// </summary> /// <param name="viewSpecification">View specification to be examined.</param> /// <param name="path">Path corresponding to the given <paramref name="viewSpecification"/>, if it is a media library view specification (i.e. one of the /// view specifications which are created in any of the sub views of this view specification). Else, this parameter will return <c>null</c>.</param> /// <returns><c>true</c>, if the given <paramref name="viewSpecification"/> is one of the direct or indirect view specifications which are created as sub view specifications /// of this view specification.</returns> public static bool TryGetLocalBrowseViewPath(ViewSpecification viewSpecification, out ResourcePath path) { MediaLibraryBrowseViewSpecification mlbvs = viewSpecification as MediaLibraryBrowseViewSpecification; if (mlbvs != null) { // We're in some MediaLibrary browsing state IServerConnectionManager serverConnectionManager = ServiceRegistration.Get <IServerConnectionManager>(); string localSystemId = ServiceRegistration.Get <ISystemResolver>().LocalSystemId; if (mlbvs.SystemId != localSystemId && mlbvs.SystemId != serverConnectionManager.HomeServerSystemId) { // If the currently browsed system is a different one, the path must be set to null path = null; return(true); } // In a browsing state for the local system, we can return the base path from the view specification path = mlbvs.BasePath; return(true); } BrowseMediaRootProxyViewSpecification bmrvs = viewSpecification as BrowseMediaRootProxyViewSpecification; SystemSharesViewSpecification ssvs = viewSpecification as SystemSharesViewSpecification; AllSystemsViewSpecification asvs = viewSpecification as AllSystemsViewSpecification; if (ssvs != null || asvs != null || bmrvs != null) { // If the current browsing state shows one of the root browse states, we can just set the path to null path = null; return(true); } path = null; return(false); }
public AddedRemovableMediaViewSpecificationFacade(ViewSpecification dlgt, string viewDisplayName, IEnumerable<Guid> necessaryMIATypeIds, IEnumerable<Guid> optionalMIATypeIds) : base(viewDisplayName, necessaryMIATypeIds, optionalMIATypeIds) { _delegateVS = dlgt; _removableDriveVS = RemovableDriveViewSpecification.CreateViewSpecificationsForRemovableDrives(_necessaryMIATypeIds, _optionalMIATypeIds); }
public AddedRemovableMediaViewSpecificationFacade(ViewSpecification dlgt, string viewDisplayName, IEnumerable <Guid> necessaryMIATypeIds, IEnumerable <Guid> optionalMIATypeIds) : base(viewDisplayName, necessaryMIATypeIds, optionalMIATypeIds) { _delegateVS = dlgt; _removableDriveVS = RemovableDriveViewSpecification.CreateViewSpecificationsForRemovableDrives(_necessaryMIATypeIds, _optionalMIATypeIds); }
/// <summary> /// Helper method which simulates a user navigation under this view specification to the given <paramref name="targetPath"/> /// under the given <paramref name="localShare"/>. /// </summary> /// <param name="localShare">Client or server share which is located at the local system.</param> /// <param name="targetPath">Resource path to navigate to. This path must be located under the given <paramref name="localShare"/>'s base path.</param> /// <param name="navigateToViewDlgt">Callback which will be called for each view specification to navigate to to do the actual navigation.</param> public void Navigate(Share localShare, ResourcePath targetPath, NavigateToViewDlgt navigateToViewDlgt) { NavigateToLocalRootView(localShare, navigateToViewDlgt); IResourceAccessor startRA; if (!localShare.BaseResourcePath.TryCreateLocalResourceAccessor(out startRA)) { return; } IFileSystemResourceAccessor current = startRA as IFileSystemResourceAccessor; if (current == null) { // Wrong path resource, cannot navigate. Should not happen if the share is based on a filesystem resource, // but might happen if we have found a non-standard share. startRA.Dispose(); return; } while (true) { ICollection <IFileSystemResourceAccessor> children = FileSystemResourceNavigator.GetChildDirectories(current, false); current.Dispose(); current = null; if (children != null) { foreach (IFileSystemResourceAccessor childDirectory in children) { using (childDirectory) { if (childDirectory.CanonicalLocalResourcePath.IsSameOrParentOf(targetPath)) { current = childDirectory; break; } } } } if (current == null) { break; } ViewSpecification newVS = NavigateCreateViewSpecification(localShare.SystemId, current); if (newVS == null) { current.Dispose(); return; } navigateToViewDlgt(newVS); } }
/// <summary> /// Tries to find the resource path corresponding to the given local <paramref name="viewSpecification"/>. /// </summary> /// <param name="viewSpecification">View specification to be examined.</param> /// <param name="path">Path corresponding to the given <paramref name="viewSpecification"/>, if it is a local view specification (i.e. one of the /// view specifications which are created in any of the sub views of this view specification). Else, this parameter will return <c>null</c>.</param> /// <returns><c>true</c>, if the given <paramref name="viewSpecification"/> is one of the direct or indirect view specifications which are created as sub view specifications /// of this view specification.</returns> public static bool TryGetLocalBrowseViewPath(ViewSpecification viewSpecification, out ResourcePath path) { LocalMediaRootProxyViewSpecification lmrpvs = viewSpecification as LocalMediaRootProxyViewSpecification; LocalSharesViewSpecification lsvs = viewSpecification as LocalSharesViewSpecification; if (lmrpvs != null || lsvs != null) { // If the current browsing state shows one of the root states, the path must be set to null path = null; return true; } LocalDirectoryViewSpecification ldvs = viewSpecification as LocalDirectoryViewSpecification; if (ldvs != null) { // In a local browsing state, we can return the browsing path path = ldvs.ViewPath; return true; } path = null; return false; }
/// <summary> /// Tries to find the resource path corresponding to the given local <paramref name="viewSpecification"/>. /// </summary> /// <param name="viewSpecification">View specification to be examined.</param> /// <param name="path">Path corresponding to the given <paramref name="viewSpecification"/>, if it is a local view specification (i.e. one of the /// view specifications which are created in any of the sub views of this view specification). Else, this parameter will return <c>null</c>.</param> /// <returns><c>true</c>, if the given <paramref name="viewSpecification"/> is one of the direct or indirect view specifications which are created as sub view specifications /// of this view specification.</returns> public static bool TryGetLocalBrowseViewPath(ViewSpecification viewSpecification, out ResourcePath path) { LocalMediaRootProxyViewSpecification lmrpvs = viewSpecification as LocalMediaRootProxyViewSpecification; LocalSharesViewSpecification lsvs = viewSpecification as LocalSharesViewSpecification; if (lmrpvs != null || lsvs != null) { // If the current browsing state shows one of the root states, the path must be set to null path = null; return(true); } LocalDirectoryViewSpecification ldvs = viewSpecification as LocalDirectoryViewSpecification; if (ldvs != null) { // In a local browsing state, we can return the browsing path path = ldvs.ViewPath; return(true); } path = null; return(false); }
public AddedRemovableMediaViewSpecificationFacade(ViewSpecification dlgt) : this(dlgt, dlgt.ViewDisplayName, dlgt.NecessaryMIATypeIds, dlgt.OptionalMIATypeIds) { }
/// <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); ScreenConfig nextScreenConfig; LoadLayoutSettings(visibleScreen.ToString(), out nextScreenConfig); Sorting.Sorting nextSortingMode = AvailableSortings.FirstOrDefault(sorting => sorting.GetType().ToString() == nextScreenConfig.Sorting) ?? _currentSorting; NavigationData newNavigationData = new NavigationData(this, subViewSpecification.ViewDisplayName, _baseWorkflowStateId, newState.StateId, subViewSpecification, visibleScreen, _availableScreens, nextSortingMode, true) { LayoutType = nextScreenConfig.LayoutType, LayoutSize = nextScreenConfig.LayoutSize }; PushNewNavigationWorkflowState(newState, navbarDisplayLabel, newNavigationData); return newNavigationData; }
/// <summary> /// Switches to browsing by MediaLibray shares, limited to restricted MediaCategories. /// </summary> protected void SetBrowseMode() { _availableScreens = null; _defaultScreen = new BrowseMediaNavigationScreenData(_genericPlayableItemCreatorDelegate); _customRootViewSpecification = new BrowseMediaRootProxyViewSpecification(_viewName, _necessaryMias, null, _restrictedMediaCategories); }
internal View(ViewSpecification viewSpecification) { _viewSpecification = viewSpecification; _displayName = viewSpecification.ViewDisplayName; _absNumItems = viewSpecification.AbsNumItems; }
/// <summary> /// Prepares custom views or initializes specific data, which are not available at construction time (i.e. <see cref="MediaNavigationModel.GetMediaSkinOptionalMIATypes(string)"/>). /// </summary> protected virtual void Prepare() { _customRootViewSpecification = null; }
/// <summary> /// Does the actual work of navigating to the specifield sub view. This will create a new <see cref="NavigationData"/> /// instance for the new screen and push a new transient workflow state onto the workflow navigation stack. /// </summary> /// <param name="subViewSpecification">Specification of the sub view to navigate to.</param> protected internal NavigationData NavigateToView(ViewSpecification subViewSpecification) { return _navigationData.StackSubordinateNavigationContext(subViewSpecification, Derive(), LocalizationHelper.Translate(_navbarSubViewNavigationDisplayLabel, LocalizationHelper.Translate(subViewSpecification.ViewDisplayName))); }
/// <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> public NavigationData(NavigationData parent, string navigationContextName, Guid parentWorkflowStateId, Guid currentWorkflowStateId, ViewSpecification baseViewSpecification, AbstractScreenData defaultScreen, ICollection<AbstractScreenData> availableScreens, Sorting.Sorting currentSorting) : this(parent, navigationContextName, parentWorkflowStateId, currentWorkflowStateId, baseViewSpecification, defaultScreen, availableScreens, currentSorting, false) { }
/// <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); NavigationData newNavigationData = new NavigationData(this, subViewSpecification.ViewDisplayName, _baseWorkflowStateId, newState.StateId, subViewSpecification, visibleScreen, _availableScreens, _currentSorting, true); PushNewNavigationWorkflowState(newState, navbarDisplayLabel, newNavigationData); return newNavigationData; }
public void RemoveSubView(ViewSpecification subView) { _subViewSpecifications.Remove(subView); }
public void AddSubView(ViewSpecification subView) { _subViewSpecifications.Add(subView); }
/// <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="remainingScreens">New collection of remaining 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, ICollection<AbstractScreenData> remainingScreens, string navbarDisplayLabel) { WorkflowState newState = WorkflowState.CreateTransientState( "View: " + subViewSpecification.ViewDisplayName, subViewSpecification.ViewDisplayName, false, null, false, WorkflowType.Workflow); NavigationData newNavigationData = new NavigationData(this, subViewSpecification.ViewDisplayName, newState.StateId, newState.StateId, subViewSpecification, remainingScreens.FirstOrDefault(), remainingScreens, _currentSorting); PushNewNavigationWorkflowState(newState, navbarDisplayLabel, newNavigationData); return newNavigationData; }
/// <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); 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) ?? _currentSorting; NavigationData newNavigationData = new NavigationData(this, subViewSpecification.ViewDisplayName, newState.StateId, newState.StateId, subViewSpecification, nextScreen, remainingScreens, nextSortingMode) { LayoutType = nextScreenConfig.LayoutType, LayoutSize = nextScreenConfig.LayoutSize }; PushNewNavigationWorkflowState(newState, navbarDisplayLabel, newNavigationData); return newNavigationData; }
// 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(); }
protected void InitializeSearch(ViewSpecification baseViewSpecification) { _baseViewSpecification = baseViewSpecification as MediaLibraryQueryViewSpecification; if (_baseViewSpecification == null) return; if (_simpleSearchTextProperty == null) { _simpleSearchTextProperty = new WProperty(typeof(string), string.Empty); _simpleSearchTextProperty.Attach(OnSimpleSearchTextChanged); } SimpleSearchText = string.Empty; // Initialize data manually which would have been initialized by AbstractItemsScreenData.UpdateMediaItems else IsItemsValid = true; IsItemsEmpty = false; TooManyItems = false; NumItemsStr = "-"; NumItems = 0; lock (_syncObj) _view = null; _items = new ItemsList(); }
/// <summary> /// Prepares custom views or initializes specific data, which are not available at construction time (i.e. <see cref="MediaNavigationModel.GetMediaSkinOptionalMIATypes(string)"/>). /// </summary> protected virtual void Prepare() { // Read filters from plugin.xml and apply the matching ones BuildFilters(); _customRootViewSpecification = null; }