当前位置: 首页>>代码示例>>C#>>正文


C# ItemFilter类代码示例

本文整理汇总了C#中ItemFilter的典型用法代码示例。如果您正苦于以下问题:C# ItemFilter类的具体用法?C# ItemFilter怎么用?C# ItemFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ItemFilter类属于命名空间,在下文中一共展示了ItemFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Write

		internal static void Write(HierarchyNode<ContentItem> hierarchy, ContentItem selectedItem, IContentAdapterProvider adapters, ItemFilter filter, string selectableTypes, string selectableExtensions, bool excludeRoot, string target, TextWriter writer)
		{
			N2.Web.Tree.Using(hierarchy)
				.OpenTo(selectedItem)
				.Filters(filter)
				.IdProvider(n => "u" + n.Current.ID, n => "l" + n.Current.ID)
				.LinkWriter((n, w) =>
				{
					BuildLink(adapters.ResolveAdapter<NodeAdapter>(n.Current), n.Current, n.Current.Path == selectedItem.Path, target, IsSelectable(n.Current, selectableTypes, selectableExtensions)).WriteTo(w);
					if (n.Children.Count == 0 && adapters.ResolveAdapter<NodeAdapter>(n.Current).HasChildren(n.Current, filter))
					{
						var ul = new TagBuilder("ul");
						ul.AddCssClass("ajax");
						w.Write(ul.ToString(TagRenderMode.StartTag));

						var li = new TagBuilder("li");
						li.InnerHtml = "{url:" + Url.ParseTokenized("{ManagementUrl}/Content/Navigation/LoadTree.ashx")
							.AppendQuery("target", target)
							.AppendQuery(SelectionUtility.SelectedQueryKey, HttpUtility.UrlEncode(n.Current.Path))
							.AppendQuery("selectableTypes", selectableTypes)
							.AppendQuery("selectableExtensions", selectableExtensions)
							+ "}";
						w.Write(li.ToString());

						w.Write(ul.ToString(TagRenderMode.EndTag));
					}
				})
				.ExcludeRoot(excludeRoot)
				.WriteTo(writer);
		}
开发者ID:rohancragg,项目名称:n2cms,代码行数:30,代码来源:TreeUtility.cs

示例2: Tree

		/// <summary>Creates a navigation using unordered list elements.</summary>
		public static N2.Web.Tree Tree(this HtmlHelper html,
			ContentItem startsFrom = null,
			ContentItem current = null,
			int takeLevels = 2,
			bool parallelRoot = true,
			bool appendCreatorNode = false,
			ItemFilter filter = null,
			object htmlAttributes = null)
		{
			if (startsFrom == null) startsFrom = html.StartPage();
			if (current == null) current = html.CurrentPage();
			if (filter == null) filter = new NavigationFilter(html.ViewContext.HttpContext.User, html.ContentEngine().SecurityManager);

			var builder = parallelRoot
				? (HierarchyBuilder)new ParallelRootHierarchyBuilder(startsFrom, takeLevels)
				: (HierarchyBuilder)new TreeHierarchyBuilder(startsFrom, takeLevels);

			if (builder == null)
				throw new ArgumentException("builder == null");

			if (appendCreatorNode && ControlPanelExtensions.GetControlPanelState(html).IsFlagSet(ControlPanelState.DragDrop))
				builder.GetChildren = (i) => i == null ? null : i.Children.FindNavigatablePages().Where(filter).AppendCreatorNode(html.ContentEngine(), i);
			else
				builder.GetChildren = (i) => i == null ? null : i.Children.FindNavigatablePages().Where(filter);

			var tree = N2.Web.Tree.Using(builder);
			if (htmlAttributes != null)
				tree.Tag(ApplyToRootUl(htmlAttributes));

			ClassifyAnchors(startsFrom, current, parallelRoot, tree);

			return tree;
		}
开发者ID:rajeshpillai,项目名称:n2cms,代码行数:34,代码来源:HtmlExtensions.cs

示例3: GetFilters

		private ItemFilter[] GetFilters()
		{
			ItemFilter[] filters;
			if (FeedRoot != null)
				filters = new ItemFilter[] {new TypeFilter(typeof (ISyndicatable)), new AccessFilter(), new ParentFilter(FeedRoot)};
			else
				filters = new ItemFilter[] {new TypeFilter(typeof (ISyndicatable)), new AccessFilter()};
			return filters;
		}
开发者ID:GrimaceOfDespair,项目名称:kindervakantielimburg.be,代码行数:9,代码来源:RssFeed.cs

示例4: Children

        /// <summary>Builds the hierachy using the specified child factory method.</summary>
        /// <param name="filters">The filters.</param>
        /// <returns></returns>
        public HierarchyBuilder Children(params ItemFilter[] filters)
        {
            Filter = (filters.Length == 1)
                ? filters[0]
                : new AllFilter(filters);

            GetChildren = (item) => item.Children.Filter(filters);
            return this;
        }
开发者ID:EzyWebwerkstaden,项目名称:n2cms,代码行数:12,代码来源:HierarchyBuilder.cs

示例5: AllChannelMediaQuery

        public AllChannelMediaQuery()
        {
            ChannelIds = new string[] { };

            ContentTypes = new ChannelMediaContentType[] { };

            Filters = new ItemFilter[] { };
            Fields = new List<ItemFields>();
        }
开发者ID:bigjohn322,项目名称:MediaBrowser,代码行数:9,代码来源:ChannelQuery.cs

示例6: BuildTreeStructure

 internal static HierarchyNode<ContentItem> BuildTreeStructure(ItemFilter filter, IContentAdapterProvider adapters, ContentItem selectedItem, int maxDepth)
 {
     var structure = new TreeHierarchyBuilder(selectedItem, maxDepth)
         .Children((item) =>
         {
             var q = new N2.Persistence.Sources.Query { Parent = item, OnlyPages = true, Interface = Interfaces.Managing, Filter = filter };
             return adapters.ResolveAdapter<NodeAdapter>(item).GetChildren(q);
         })
         .Build();
     return structure;
 }
开发者ID:rickyinnz,项目名称:n2cms,代码行数:11,代码来源:ApiExtensions.cs

示例7: BuildBranchStructure

 internal static HierarchyNode<ContentItem> BuildBranchStructure(ItemFilter filter, IContentAdapterProvider adapters, ContentItem selectedItem, ContentItem root)
 {
     var structure = new BranchHierarchyBuilder(selectedItem, root, true) { UseMasterVersion = false }
         .Children((item) =>
         {
             var q = new N2.Persistence.Sources.Query { Parent = item, OnlyPages = true, Interface = Interfaces.Managing, Filter = filter };
             return adapters.ResolveAdapter<NodeAdapter>(item).GetChildren(q);
         })
         .Build();
     return structure;
 }
开发者ID:rickyinnz,项目名称:n2cms,代码行数:11,代码来源:ApiExtensions.cs

示例8: TreeFrom

        public Tree TreeFrom(ContentItem item, int takeLevels = 3, bool rootless = false, Func<ContentItem, string> cssGetter = null, ItemFilter filter = null)
        {
            if (item == null)
                return CreateTree(new NoHierarchyBuilder());

            if (cssGetter == null)
                cssGetter = GetNavigationClass;

            return CreateTree(new TreeHierarchyBuilder(item, takeLevels))
                .ExcludeRoot(rootless)
                .LinkProvider((i) => LinkTo(i).Class(cssGetter(i)))
                .Filters(filter ?? N2.Content.Is.Navigatable());
        }
开发者ID:Jobu,项目名称:n2cms,代码行数:13,代码来源:ViewContentHelper.cs

示例9: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            portalDc = new DALPortalDataContext();

              this.itemFilter = (ItemFilter)Session["itemFilter"];

              if (!IsPostBack)
              {
            this.selectedItemId = Convert.ToInt32(Session["selectedItemId"]);
            this.selectedCompanyCode = Session["selectedCompanyCode"].ToString();

            IQueryable<vw_item> data = EsmHelper.GetData(portalDc, this.itemFilter);

            int index = data.ToList().FindIndex(c => c.itemId.Equals(selectedItemId) && c.companyCode.Equals(selectedCompanyCode));

            RadDataPager radDataPager = RadListViewItem.FindControl("RadDataPagerItem") as RadDataPager;
            radDataPager.FireCommand("Page", (index).ToString());
              }
        }
开发者ID:dennis-vl,项目名称:dennis-vl,代码行数:19,代码来源:ItemDetail.aspx.cs

示例10: SetCriteria

        public void SetCriteria(ItemFilter itemFilter)
        {
            this.Criteria = itemFilter;

            foreach (var ob in this.Environment.GetContents(this.Area).OfType<ItemObject>())
            {
                Debug.Assert(ob.StockpiledBy == null || ob.StockpiledBy == this);

                if (ob.IsInstalled)
                    continue;

                if (Match(ob))
                {
                    if (ob.StockpiledBy == null)
                        ob.StockpiledBy = this;
                }
                else
                {
                    if (ob.StockpiledBy != null)
                        ob.StockpiledBy = null;
                }
            }

            if (this.Criteria != null && m_itemTracker.IsEnabled == false)
                EnableItemObjectView();
            else if (this.Criteria == null && m_itemTracker.IsEnabled)
                DisableItemObjectView();
            else
                m_itemTracker.Refresh();
        }
开发者ID:tomba,项目名称:dwarrowdelf,代码行数:30,代码来源:Stockpile.cs

示例11: TextBox_TextChanged

 protected override void TextBox_TextChanged(object sender, TextChangedEventArgs e)
 {
     ListItems = new ItemFilter(DriveItem.GetAllItems(), Text);
     Input.ListBox.SelectedIndex = 0;
 }
开发者ID:glupschta,项目名称:Kex,代码行数:5,代码来源:DrivesPopup.cs

示例12: RetrieveChildren

        public IEnumerable<BaseItem> RetrieveChildren(string id, bool? collapseBoxSets = null, ItemFilter[] filters = null, bool? isPlayed = null)
        {
            if (id == Guid.Empty.ToString() || string.IsNullOrEmpty(id)) return new List<BaseItem>();  //some dummy items have blank ids

            var dtos = Kernel.ApiClient.GetItems(new ItemQuery
                                                     {
                                                         UserId = Kernel.CurrentUser.Id.ToString(),
                                                         ParentId = id,
                                                         Filters = filters,
                                                         IsPlayed = isPlayed,
                                                         CollapseBoxSetItems = collapseBoxSets,
                                                         Fields = new[] {ItemFields.Overview, ItemFields.Path, ItemFields.ParentId, ItemFields.DisplayPreferencesId, 
                                                            ItemFields.DateCreated, ItemFields.IndexOptions, ItemFields.DateLastMediaAdded, ItemFields.Metascore,
                                                            ItemFields.MediaStreams, ItemFields.SortName, ItemFields.Taglines, ItemFields.MediaSources,  }
                                                     });

            return dtos == null ? new List<BaseItem>() : dtos.Items.Select(dto => GetItem(dto, dto.Type)).Where(item => item != null);
        }
开发者ID:Ceten,项目名称:MediaBrowser.Classic,代码行数:18,代码来源:MB3ApiRepository.cs

示例13: RetrieveLatestChannelItems

 public IEnumerable<BaseItem> RetrieveLatestChannelItems(string channelId = null, ItemFilter[] filters = null)
 {
     var dtos = Kernel.ApiClient.GetLatestChannelItems(Kernel.CurrentUser.ApiId, channelId, filters);
     return dtos == null ? new BaseItem[] { } : dtos.Items.Select(dto => GetItem(dto, dto.Type)).Where(item => item != null);
 }
开发者ID:Ceten,项目名称:MediaBrowser.Classic,代码行数:5,代码来源:MB3ApiRepository.cs

示例14: HasChildren

		/// <summary>Returns true when an item has children.</summary>
		/// <param name="filter">The filter to apply.</param>
		/// <param name="parent">The item whose childrens existence is to be determined.</param>
		/// <returns>True when there are children.</returns>
		public virtual bool HasChildren(ContentItem parent, ItemFilter filter)
		{
			return HasChildren(new Query { Parent = parent, Filter = filter, Interface = Interfaces.Managing });
		}
开发者ID:EzyWebwerkstaden,项目名称:n2cms,代码行数:8,代码来源:NodeAdapter.cs

示例15: Last

        private static ContentItem Last(IList<ContentItem> children, ItemFilter filter)
        {
            for (int i = children.Count - 1; i >= 0; i--)
            {
                if (!filter.Match(children[i]))
                    continue;

                return children[i];
            }
            return null;
        }
开发者ID:JohnsonYuan,项目名称:n2cms,代码行数:11,代码来源:New.aspx.cs


注:本文中的ItemFilter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。