本文整理汇总了C#中System.PageData类的典型用法代码示例。如果您正苦于以下问题:C# PageData类的具体用法?C# PageData怎么用?C# PageData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PageData类属于System命名空间,在下文中一共展示了PageData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateBreabCrumbs
/// <summary>
/// Creates the bread crumb link string from the start page of the site to the supplied page
/// </summary>
/// <param name="page">The last page in the bread crumb string.</param>
/// <returns>A bread crumb string with anchors to parent pages.</returns>
private string GenerateBreabCrumbs(PageData page)
{
// Initiate a string builder based on max length. The generated html is considerably longer than the visible text.
StringBuilder breadCrumbsText = new StringBuilder(8 * MaxLength);
// Initiate a counter holding the visible length of the bread crumbs with the length of the start page link text.
int breadCrumbsLength = Translate("/navigation/startpage").Length;
while (page != null && page.PageLink != PageReference.StartPage)
{
breadCrumbsLength += page.PageName.Length + Separator.Length;
if (breadCrumbsLength > MaxLength)
{
breadCrumbsText.Insert(0, Separator + "...");
break;
}
// Insert the link at beginning of the bread crumbs string
breadCrumbsText.Insert(0, Separator + GetLink(page));
// Get next visible parent
page = GetParentPageData(page);
}
// Generate the start page link
string startPageLinkUrl = Server.UrlPathEncode(GetPage(PageReference.StartPage).LinkURL);
string startPageLink = String.Format(_link, startPageLinkUrl, Translate("/navigation/startpagelinktitle"), Translate("/navigation/startpage"));
// Insert the startpage link and return
return breadCrumbsText.Insert(0, startPageLink).ToString();
}
示例2: BuildPageTemplate
protected virtual void BuildPageTemplate(PageData pageData, string theme, RequestContext context,
StringBuilder output, CursorCollection placeHolders,
DirectiveCollection directives, List<IControlsContainer> controlConatiners)
{
controlConatiners.Add(pageData);
if (!String.IsNullOrEmpty(pageData.MasterPage))
{
this.BuildWithMasterPage(pageData.MasterPage, context, output, placeHolders, directives);
return;
}
if (!String.IsNullOrEmpty(pageData.ExternalPage))
{
this.BuildWithExternalPage(pageData.ExternalPage, context, output, placeHolders, directives);
return;
}
if (this.BuildTemplateFromPresentationData(pageData.Presentation, theme, output, placeHolders, directives, context))
return;
if (pageData.Template != null)
{
BuildPageTemplateRecursive(pageData.Template, theme, context, output, placeHolders, directives, controlConatiners);
return;
}
var defaultRootTemplate = new RootTemplate();
defaultRootTemplate.FromString(ControlUtilities.GetSitefinityTextResource(Constants.DefaultFrontendPageTemplate));
RootTemplate result = this.GetRootTemplate(defaultRootTemplate, context, theme);
this.ProcessStringTemplate(result.Template, output, placeHolders, directives);
}
示例3: GetPropertyTags
private static IEnumerable<string> GetPropertyTags(PageData page, PropertyDefinition propertyDefinition)
{
var tagNames = page[propertyDefinition.Name] as string;
return tagNames == null
? Enumerable.Empty<string>()
: tagNames.Split(new[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries);
}
示例4: ShowInSiteMap
private bool ShowInSiteMap(PageData page)
{
//// Might want to only expose project page types.
//if(!(page is MyProjectPageBase))
//{
// return false;
//}
if (!page.IsIndexablePageType())
{
return false;
}
if (!page.CheckPublishedStatus(PagePublishedStatus.Published))
{
return false;
}
if (!_filterAccessWrapper.QueryDistinctAccessEdit(page, AccessLevel.NoAccess))
{
return false;
}
//// Dynamic property: Checkbox for including/excluding page instance in sitemap.xml. For an overridable dynamic property checkbox
//// wrapper, see https://blog.mathiaskunto.com/2015/02/09/custom-property-checkbox-wrapper-as-dynamic-property-in-episerver-7-5/
//if (!(page as MyProjectPageBase).IncludeInSitemap)
//{
// return false;
//}
return true;
}
示例5: RoutePartial
public override object RoutePartial(PageData content, SegmentContext segmentContext)
{
var routedContet = base.RoutePartial(content, segmentContext);
var segmentPair = segmentContext.GetNextValue(segmentContext.RemainingPath);
if (String.IsNullOrEmpty(segmentPair.Next))
{
return routedContet;
}
var facetNames = _facetUrlCreator.GetFacetModels().ToArray();
var nextSegment = _facetUrlCreator.GetFacetValue(facetNames, segmentPair.Next);
if (String.IsNullOrEmpty(nextSegment))
{
return routedContet;
}
var routeFacets = segmentContext.RouteData.Values[FacetUrlService.RouteFacets] as ConcurrentDictionary<RouteFacetModel, HashSet<object>>;
if (routeFacets == null)
{
segmentContext.RouteData.Values[FacetUrlService.RouteFacets] = new ConcurrentDictionary<RouteFacetModel, HashSet<object>>();
routeFacets = (ConcurrentDictionary<RouteFacetModel, HashSet<object>>)segmentContext.RouteData.Values[FacetUrlService.RouteFacets];
}
AddFacetsToSegmentContext(routeFacets, segmentContext, facetNames, nextSegment, segmentPair.Remaining, null);
return routedContet;
}
示例6: ConvertUrlToExternal
public string ConvertUrlToExternal(PageData pageData = null, PageReference p = null)
{
if (pageData == null && p == null)
{
return string.Empty;
}
var page = pageData ?? _repository.Get<PageData>(p);
var pageUrlBuilder = new UrlBuilder(page.LinkURL);
Global.UrlRewriteProvider.ConvertToExternal(pageUrlBuilder, page.PageLink, Encoding.UTF8);
string pageURL = pageUrlBuilder.ToString();
UriBuilder uriBuilder = new UriBuilder(SiteDefinition.Current.SiteUrl);
uriBuilder.Path = pageURL;
var jj = ServiceLocator.Current.GetInstance<UrlResolver>().GetUrl(p);
if (uriBuilder.Path == "/")
return uriBuilder.Uri.AbsoluteUri;
string[] words = uriBuilder.Uri.AbsoluteUri.Split(new char[] {':', '/', '.'},
StringSplitOptions.RemoveEmptyEntries);
bool reoccurs = words.Count(q => q == "http") > 1;
if (reoccurs)
return uriBuilder.Uri.LocalPath.StartsWith("/") ? uriBuilder.Uri.LocalPath.Remove(0,1) : uriBuilder.Uri.LocalPath;
return uriBuilder.Uri.AbsoluteUri;
}
示例7: AppendPage
/// <summary>
/// Appends the page.
/// </summary>
/// <param name="pageData">The page data.</param>
/// <param name="json">The json.</param>
private void AppendPage(PageData pageData, StringBuilder json)
{
json.Append(string.Format("{{\"w\":{0},\"h\":{1},\"number\":{2}",
pageData.Width.ToString(_defaultCulture),
pageData.Height.ToString(_defaultCulture),
pageData.Number.ToString(_defaultCulture)));
}
开发者ID:groupdocs-annotation,项目名称:groupdocs-annotation-net-sample,代码行数:12,代码来源:FileDataJsonSerializer.cs
示例8: EditAlbums
public ActionResult EditAlbums(int page = 1)
{
string login = User.Identity.Name;
var album = new PageData<string>(albumService.GetAllUserAlbumsNams(login), page);
return View(album);
}
示例9: GetFriendlyURL
public static string GetFriendlyURL(PageData pageData)
{
UrlBuilder pageURLBuilder = new UrlBuilder(pageData.LinkURL);
EPiServer.Global.UrlRewriteProvider.ConvertToExternal(pageURLBuilder, pageData.PageLink, UTF8Encoding.UTF8);
return GetSiteRoot() + pageURLBuilder.Path;
}
示例10: GetLanguageInfo
public IEnumerable<ChromeLanguageInfo> GetLanguageInfo(PageData page)
{
List<ChromeLanguageInfo> languages = new List<ChromeLanguageInfo>();
ReadOnlyStringList pageLanguages = page.PageLanguages;
string currentLanguage = page.LanguageBranch;
foreach (string language in pageLanguages)
{
LanguageBranch languageBranch = _languageBranchRepository.ListEnabled().FirstOrDefault(l => l.LanguageID.Equals(language, StringComparison.InvariantCultureIgnoreCase));
if (languageBranch != null)
{
languages.Add(new ChromeLanguageInfo()
{
DisplayName = languageBranch.Name,
IconUrl = languageBranch.ResolvedIconPath, //"/Content/Images/flags/" + language + ".png",
// We use this to enable language switching inside edit mode too
Url = languageBranch.CurrentUrlSegment,
EditUrl = PageEditing.GetEditUrlForLanguage(page.ContentLink, languageBranch.LanguageID),
Selected = string.Compare(language, currentLanguage, StringComparison.InvariantCultureIgnoreCase) == 0
});
}
}
return languages;
}
示例11: GetCurrentPagePreview
/// <summary>
/// Gets the currnt page's preview version
/// </summary>
/// <param name="pageManager">The page manager</param>
/// <param name="pageName">The current page name</param>
/// <returns>The current page preview</returns>
public PageDraft GetCurrentPagePreview(PageManager pageManager, string pageName)
{
var homePage = new PageData();
foreach (var f in pageManager.GetPageDataList())
{
if (f.NavigationNode.Title.GetString(f.NavigationNode.AvailableCultures[0], false).ToLower() == pageName.ToLower()
&& !f.NavigationNode.IsDeleted
&& f.NavigationNode.ParentId == new Guid(System.Web.SiteMap.RootNode.Key))
{
homePage = f;
break;
}
}
if (homePage == null)
return null;
var homePagePreview = pageManager.GetPreview(homePage.NavigationNode.PageId);
if (homePagePreview == null)
return null;
if (homePagePreview.Controls[0].Properties.FirstOrDefault(r => r.Name == "Settings") == null)
return null;
return homePagePreview;
}
示例12: GetMailInformation
/// <summary>
/// Populates needed mail information before sending. Will also check
/// for Mailgun specific properties
/// </summary>
/// <remarks>
/// Note! Mailgun validate campaign codes, and if the campaign does
/// not exist, it will be ignored (the email will still be sent)
/// Note! Tags are limited to a count of 200
/// </remarks>
/// <param name="mailPage"></param>
/// <returns></returns>
public override MailInformation GetMailInformation(PageData mailPage)
{
MailInformation mailInformation = base.GetMailInformation(mailPage);
IPopulateCustomProperties customPropertiesProvider = mailPage as IPopulateCustomProperties;
if (customPropertiesProvider == null)
{
// The base class will add custom properties if the page type
// implements that - if NOT, we'll try to add them ourselves
// by looking for special property names relevant to Mailgun
var campaign = mailPage[MAILGUN_CAMPAIGN_PROPERTYNAME];
if (campaign != null)
{
mailInformation.Utm.Campaign = campaign.ToString();
}
// Since the Utm Campaign can be set independently, we check if it
// is set, and use it as a Mailgun campaign too
if(string.IsNullOrEmpty(mailInformation.Utm.Campaign) == false)
{
mailInformation.CustomProperties.Add("o:campaign", mailInformation.Utm.Campaign);
}
if (mailPage[MAILGUN_TAG_PROPERTYNAME] != null)
{
mailInformation.CustomProperties.Add("o:tag", mailPage[MAILGUN_TAG_PROPERTYNAME]);
}
}
return mailInformation;
}
示例13: GetPageTags
private IEnumerable<string> GetPageTags(PageData page)
{
var pageType = _pageTypeRepository.Load(page.PageTypeID);
return pageType.PropertyDefinitions
.Where(TagsHelper.IsTagProperty)
.SelectMany(x => GetPropertyTags(page, x));
}
示例14: EditAlbum
public ActionResult EditAlbum(string albumName, int page = 1)
{
ViewBag.AlbumName = albumName;
string login = User.Identity.Name;
var photos = new PageData<PhotoOfAlbumDTO>(photoService.GetPhotosOfAlbum(login, albumName), page);
return View(photos);
}
示例15: Page
/// <summary>
/// Initializes a new instance of the <see cref="Page"/> class.
/// </summary>
/// <param name="client"><see cref="T:TcmCoreService.Client" /></param>
/// <param name="pageData"><see cref="T:Tridion.ContentManager.CoreService.Client.PageData" /></param>
protected Page(Client client, PageData pageData)
: base(client, pageData)
{
if (pageData == null)
throw new ArgumentNullException("pageData");
mPageData = pageData;
}