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


C# IPublishedContent.Ancestor方法代码示例

本文整理汇总了C#中IPublishedContent.Ancestor方法的典型用法代码示例。如果您正苦于以下问题:C# IPublishedContent.Ancestor方法的具体用法?C# IPublishedContent.Ancestor怎么用?C# IPublishedContent.Ancestor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPublishedContent的用法示例。


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

示例1: Settings

        private static DialogueSettings Settings(IPublishedContent forumRootNode)
        {
            if (forumRootNode != null)
            {
                var settings = new DialogueSettings();

                // Content
                settings.ForumId = forumRootNode.Id;
                settings.ForumRootUrl = forumRootNode.Url;
                settings.ForumName = forumRootNode.GetPropertyValue<string>("forumName");
                settings.ForumDescription = forumRootNode.GetPropertyValue<string>("forumDescription");
                settings.ForumRootUrlWithDomain = string.Concat(AppHelpers.ReturnCurrentDomain(), settings.ForumRootUrl);

                // Urls
                settings.TopicUrlName = forumRootNode.GetPropertyValue<string>(AppConstants.PropTopicUrlName);
                settings.MemberUrlName = forumRootNode.GetPropertyValue<string>(AppConstants.PropMemberUrlName);
                settings.DialogueUrlName = forumRootNode.GetPropertyValue<string>(AppConstants.PropDialogueUrlName);

                var loginPage = forumRootNode.Descendant(AppConstants.DocTypeLogin) ?? forumRootNode.Ancestor(AppConstants.DocTypeLogin);
                settings.LoginUrl = loginPage != null ? loginPage.Url : "/Unable-to-find-login-page";

                var registerPage = forumRootNode.Descendant(AppConstants.DocTypeRegister) ?? forumRootNode.Ancestor(AppConstants.DocTypeRegister);
                settings.RegisterUrl = registerPage != null ? registerPage.Url : "/Unable-to-find-Register-page";

                settings.BannedEmails = forumRootNode.GetPropertyValue<string[]>("bannedEmail").ToList();
                settings.BannedLinks = forumRootNode.GetPropertyValue<string[]>("bannedLinks").ToList();
                settings.BannedWords = forumRootNode.GetPropertyValue<string[]>("bannedWords").ToList();

                // General

                var extensions = forumRootNode.GetPropertyValue<string>("fileUploadAllowedExtensions");
                if (!string.IsNullOrEmpty(extensions))
                {
                    settings.FileUploadAllowedExtensions = extensions.ToLower()
                                                            .TrimStart(',').TrimEnd(',')
                                                            .Split(',')
                                                            .Where(x => !string.IsNullOrEmpty(x)).ToList();
                }
                else
                {
                    settings.FileUploadAllowedExtensions = new List<string>();
                }

                settings.FileUploadMaximumFilesize = forumRootNode.GetPropertyValue<int>("fileUploadMaximumFilesize");

                settings.AllowRssFeeds = forumRootNode.GetPropertyValue<bool>("allowRssFeeds");
                settings.SuspendRegistration = forumRootNode.GetPropertyValue<bool>("suspendRegistration");
                settings.EnableSpamReporting = forumRootNode.GetPropertyValue<bool>("enableSpamReporting");
                settings.EnableMemberReporting = forumRootNode.GetPropertyValue<bool>("enableMemberReporting");
                settings.AllowEmailSubscriptions = forumRootNode.GetPropertyValue<bool>("allowEmailSubscriptions");
                settings.ManuallyAuthoriseNewMembers = forumRootNode.GetPropertyValue<bool>("manuallyAuthoriseNewMembers");
                settings.EmailAdminOnNewMemberSignup = forumRootNode.GetPropertyValue<bool>("emailAdminOnNewMemberSignup");
                settings.NewMembersMustConfirmAccountsViaEmail = forumRootNode.GetPropertyValue<bool>("newMembersMustConfirmAccountsViaEmail");
                settings.AllowMemberSignatures = forumRootNode.GetPropertyValue<bool>("allowMemberSignatures");
                settings.TopicsPerPage = forumRootNode.GetPropertyValue<int>("topicsPerPage");
                settings.AllowPostsToBeMarkedAsSolution = forumRootNode.GetPropertyValue<bool>("allowPostsToBeMarkedAsSolution");
                settings.PostsPerPage = forumRootNode.GetPropertyValue<int>("postsPerPage");
                settings.ActivitiesPerPage = forumRootNode.GetPropertyValue<int>("activitiesPerPage");
                settings.AllowPrivateMessages = forumRootNode.GetPropertyValue<bool>("allowPrivateMessages");
                settings.PrivateMessageInboxSize = forumRootNode.GetPropertyValue<int>("privateMessageInboxSize");
                settings.PrivateMessageFloodControl = forumRootNode.GetPropertyValue<int>("privateMessageFloodControl");

                // Points
                settings.AllowPoints = forumRootNode.GetPropertyValue<bool>("allowPoints");
                settings.AmountOfPointsBeforeAUserCanVote = forumRootNode.GetPropertyValue<int>("amountOfPointsBeforeAUserCanVote");
                settings.PointsAddedPerNewPost = forumRootNode.GetPropertyValue<int>("pointsAddedPerNewPost");
                settings.PointsAddedForPositiveVote = forumRootNode.GetPropertyValue<int>("pointsAddedForPositiveVote");
                settings.PointsDeductedForNegativeVote = forumRootNode.GetPropertyValue<int>("pointsDeductedForNegativeVote");
                settings.PointsAddedForASolution = forumRootNode.GetPropertyValue<int>("pointsAddedForASolution");

                // Email
                settings.AdminEmailAddress = forumRootNode.GetPropertyValue<string>("adminEmailAddress");
                settings.NotificationReplyEmailAddress = forumRootNode.GetPropertyValue<string>("notificationReplyEmailAddress");

                // Theme
                settings.Theme = forumRootNode.GetPropertyValue<string>("theme");

                // Member Group
                var memberGroupService = AppHelpers.UmbServices().MemberGroupService;
                var memberGroupCsv = forumRootNode.GetPropertyValue<string>("newMemberStartingGroup");

                //NOTE: Take the FIRST one only if there are multiple
                if (memberGroupCsv != null)
                {
                    var memberGroupId = memberGroupCsv.Split(',').FirstOrDefault();
                    settings.Group = memberGroupService.GetByName(memberGroupId);
                }
                else
                {
                    settings.Group = memberGroupService.GetByName(AppConstants.MemberGroupDefault);
                }

                // Spam
                settings.EnableAkismetSpamControl = forumRootNode.GetPropertyValue<bool>("enableAkismetSpamControl");
                settings.AkismetKey = forumRootNode.GetPropertyValue<string>("enterYourAkismetKeyHere");
                settings.SpamQuestion = forumRootNode.GetPropertyValue<string>("enterASpamRegistrationPreventionQuestion");
                settings.SpamAnswer = forumRootNode.GetPropertyValue<string>("enterTheAnswerToYourSpamQuestion");

                // Social
                settings.FacebookAppId = forumRootNode.GetPropertyValue<string>("FacebookAppId");
//.........这里部分代码省略.........
开发者ID:ryan-buckman,项目名称:Dialogue,代码行数:101,代码来源:Dialogue.cs


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