Example #1
0
        // --------------------------------------------------------------------------------------------------------------------

        /// <summary> Configures a button control for rendering on a web view page. </summary>
        /// <param name="content">    The button content. </param>
        /// <param name="buttonStyle"> (Optional) Style of the button. </param>
        /// <param name="buttonType"> (Optional) Type of the button. </param>
        /// <returns> The button instance. </returns>
        public Button Configure(RazorTemplateDelegate <object> content, ButtonStyles buttonStyle = ButtonStyles.Primary, ButtonTypes buttonType = ButtonTypes.Button)
        {
            ContentTemplate = content;
            ButtonStyle     = buttonStyle;
            ButtonType      = buttonType;
            return(this);
        }
        // --------------------------------------------------------------------------------------------------------------------

        /// <summary> Sets the component's body. </summary>
        /// <typeparam name="T"> Generic type parameter. </typeparam>
        /// <param name="comp"> The comp to act on. </param>
        /// <param name="content"> A razor template delegate used to render the body of the component. </param>
        /// <returns> A component. </returns>
        public static T SetContent <T>(this T comp, RazorTemplateDelegate <object> content) where T : class, IWebViewComponent
        {
            if (content != null && content != null)
            {
                System.Diagnostics.Debug.WriteLine(typeof(T).Name + ".SetContent(): The component's 'InnerHtml' property has a non-empty value which will never render while 'ContentTemplate' is set.", "WARNING");
            }
            comp.ContentTemplate = content;
            return(comp);
        }
Example #3
0
        // --------------------------------------------------------------------------------------------------------------------

        /// <summary> Configures the action link. </summary>
        /// <param name="content">        The content. </param>
        /// <param name="actionName">     Name of the action. </param>
        /// <param name="controllerName"> (Optional) Name of the controller. </param>
        /// <param name="areaName">       (Optional) Name of the area. </param>
        /// <param name="fragment">       (Optional) The fragment. </param>
        /// <param name="routeName">      (Optional) Name of the route. </param>
        /// <returns> An ActionLink. </returns>
        public ActionLink Configure(RazorTemplateDelegate <object> content, string actionName, string controllerName = null, string areaName = null,
                                    string fragment = null, string routeName = null)
        {
            Fragment        = fragment;
            ContentTemplate = content;

            SetRoute(actionName, controllerName, areaName, routeName);

            return(this);
        }
Example #4
0
        // --------------------------------------------------------------------------------------------------------------------

        /// <summary>
        /// Creates a menu control (usually for the layout page).
        /// </summary>
        /// <param name="page"></param>
        public MenuItem Configure(RazorTemplateDelegate <object> content, string actionName = null, string controllerName = null, string areaName = null)
        {
            return((MenuItem)base.Configure(content, actionName, controllerName, areaName));
        }
        // --------------------------------------------------------------------------------------------------------------------


        /// <summary> Sets the component's footer. </summary>
        /// <typeparam name="T"> Generic type parameter. </typeparam>
        /// <param name="comp"> The comp to act on. </param>
        /// <param name="footer"> A razor template delegate used to render the footer of the component. </param>
        /// <returns> A component. </returns>
        public static T SetFooter <T>(this T comp, RazorTemplateDelegate <object> footer) where T : IComponentFooter
        {
            comp.Footer = footer;
            return(comp);
        }
        // --------------------------------------------------------------------------------------------------------------------

        /// <summary> Sets the component's header. </summary>
        /// <typeparam name="T"> Generic type parameter. </typeparam>
        /// <param name="comp"> The comp to act on. </param>
        /// <param name="header"> A razor template delegate used to render the header of the component. </param>
        /// <returns> A component. </returns>
        public static T SetHeader <T>(this T comp, RazorTemplateDelegate <object> header) where T : IComponentHeader
        {
            comp.Header = header;
            return(comp);
        }
        // --------------------------------------------------------------------------------------------------------------------

        /// <summary> Sets the component title. </summary>
        /// <typeparam name="T"> Generic type parameter. </typeparam>
        /// <param name="comp"> The comp to act on. </param>
        /// <param name="title"> A razor template delegate used to render the title of the component. </param>
        /// <returns> A component. </returns>
        public static T SetTitle <T>(this T comp, RazorTemplateDelegate <object> title) where T : IComponentTitle
        {
            comp.Title = title;
            return(comp);
        }
Example #8
0
 /// <summary>
 /// Something to render immediately before the end tag.
 /// </summary>
 public ActionLink SetPostfix(RazorTemplateDelegate <object> content)
 {
     Postfix = content;
     return(this);
 }
Example #9
0
        // --------------------------------------------------------------------------------------------------------------------

        /// <summary>
        /// Something to render immediately after the link start tag.
        /// </summary>
        public Link SetPrefix(RazorTemplateDelegate <object> content)
        {
            Prefix = content;
            return(this);
        }