Exemplo n.º 1
0
        /// <summary>
        /// Gets all view names that match a pattern.
        /// </summary>
        /// <param name="controlType">The control type.</param>
        /// <param name="viewNamePattern">The view name pattern</param>
        /// <returns></returns>
        public IEnumerable <string> GetViewNames(string controlType, string viewNamePattern)
        {
            var mvcProxy = new MvcControllerProxy();

            mvcProxy.ControllerName = controlType;
            var controller = mvcProxy.GetController() as Controller;

            if (controller == null)
            {
                return(new List <string>());
            }

            return(ViewSelectorHelpers.GetViewNames(null, controller, viewNamePattern));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Checks if there are separate custom desiger views for the particular control type.
        /// </summary>
        /// <param name="controlType">The type of the control.</param>
        /// <returns></returns>
        public bool HasCustomDesigners(string controlType)
        {
            var mvcProxy = new MvcControllerProxy();

            mvcProxy.ControllerName = controlType;
            var controller = mvcProxy.GetController() as Controller;

            if (controller == null)
            {
                return(true);
            }

            var designerNamePattern = "DesignerView.*";
            var views = controller.GetViews(null).Where(view => Regex.IsMatch(view, designerNamePattern));

            return(views.Count() > 0);
        }