コード例 #1
0
        private IReadOnlyCollection <FlowComponent> getNewCommentComponents(UpdateRegionSet createUpdateRegions)
        {
            if (AppTools.User == null)
            {
                return(new Paragraph(
                           new EwfHyperlink(
                               EnterpriseWebLibrary.EnterpriseWebFramework.UserManagement.Pages.LogIn.GetInfo(Home.GetInfo().GetUrl()),
                               new StandardHyperlinkStyle("Sign in")).Concat(" or ".ToComponents())
                           .Append(new EwfHyperlink(User.GetInfo(), new StandardHyperlinkStyle("sign up")))
                           .Concat(" to add comments on this article.".ToComponents())
                           .Materialize()).ToCollection());
            }

            commentMod = getCommentMod();
            return(FormState.ExecuteWithDataModificationsAndDefaultAction(
                       PostBack.CreateIntermediate(
                           createUpdateRegions.ToCollection(),
                           id: "comment",
                           modificationMethod: () => {
                commentMod.CommentId = MainSequence.GetNextValue();
                commentMod.Execute();
            })
                       .ToCollection(),
                       () => new FlowIdContainer(
                           commentMod.GetBodyTextTextControlFormItem(
                               false,
                               label: Enumerable.Empty <PhrasingComponent>().Materialize(),
                               controlSetup: TextControlSetup.Create(numberOfRows: 3, placeholder: "Write a comment..."),
                               value: "")
                           .ToComponentCollection()
                           .Append(new EwfButton(new StandardButtonStyle("Post Comment"))),
                           updateRegionSets: createUpdateRegions.ToCollection()).ToCollection()));
        }