本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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;
}
示例5: AllChannelMediaQuery
public AllChannelMediaQuery()
{
ChannelIds = new string[] { };
ContentTypes = new ChannelMediaContentType[] { };
Filters = new ItemFilter[] { };
Fields = new List<ItemFields>();
}
示例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;
}
示例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;
}
示例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());
}
示例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());
}
}
示例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();
}
示例11: TextBox_TextChanged
protected override void TextBox_TextChanged(object sender, TextChangedEventArgs e)
{
ListItems = new ItemFilter(DriveItem.GetAllItems(), Text);
Input.ListBox.SelectedIndex = 0;
}
示例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);
}
示例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);
}
示例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 });
}
示例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;
}