Example #1
0
        /// <summary>
        /// 获取生成器
        /// </summary>
        /// <param name="control">控件对象</param>
        /// <returns>返回控件对应的生成器</returns>
        public static ControlBuildBase GetBuilder(this ControlHost controlHost, bool isPreview, ScreenDefinition screenDef, CompileBase compile, ProjectDocument doc, Dictionary <int, Tuple <int, string> > permissionData, HtmlTextWriter htmlWriter)
        {
            //图表控件名字为空自动生成一个默认名字
            var controlName = controlHost.Content.GetType().Name;

            if (controlName == "ChartPane" || controlName == "DropDownButton")
            {
                if (string.IsNullOrEmpty(controlHost.Name))
                {
                    controlHost.Name = controlName + ctlNumber++;
                }
            }

            if (!isPreview && doc != null && !string.IsNullOrEmpty(controlHost.Name))
            {
                controlHost.Name = doc.Name + "_" + controlHost.Name;
            }
            if (controlHost.Content != null)
            {
                var    assembly = Assembly.GetAssembly(typeof(ControlExtend));
                string typeName = string.Format("Wilmar.Build.Core.Dojo.Default.Builders.{0}Build", controlHost.Content.GetType().Name);
                if (assembly.GetType(typeName) == null)
                {
                    throw new Exception(string.Format("类型【{0}】没对应的生成器。", typeName));
                }
                ControlBuildBase builder = Activator.CreateInstance(assembly.GetType(typeName), isPreview, controlHost, screenDef, compile, doc, permissionData, htmlWriter) as ControlBuildBase;
                return(builder);
            }
            else
            {
                return(null);
            }
        }
Example #2
0
        public static string GetIsDropDownButton(ControlBuildBase controlBuildBase)
        {
            string controlName = controlBuildBase.ControlHost.Content.GetType().Name;

            if (controlName == "DropDownButton")
            {
                return(controlBuildBase.ControlHost.Name);
            }
            else
            {
                if (controlBuildBase.Parent != null)
                {
                    return(GetIsDropDownButton(controlBuildBase.Parent));
                }
            }
            return(string.Empty);
        }
Example #3
0
        public static bool GetIsListBox(ControlBuildBase controlBuildBase)
        {
            string controlName = controlBuildBase.ControlHost.Content.GetType().Name;

            if (controlName == "ListBox")
            {
                return(true);
            }
            else
            {
                if (controlBuildBase.Parent != null)
                {
                    return(GetIsListBox(controlBuildBase.Parent));
                }
            }
            return(false);
        }