Пример #1
0
 private static Control LoadControl(int? columnSpan, Id id, GridModuleRenderingDefinition renderingDefinition)
 {
     var control = TypeUtility.Activate<IGridModuleRendering>(renderingDefinition.Type);
     control.InitializeModule(id.ToString(), columnSpan);
     return (Control)control;
 }
        private GridModuleResolver(AppDomain domain)
        {
            _definitions = new Dictionary<string, GridModuleRenderingDefinition>();
            var layouts = ScanLayouts();

            TypeUtility.LoadReferencedAssemblies(domain);
            foreach (var type in TypeUtility.GetTypesImplementingInterface<IGridModuleRendering>(domain))
            {
                if (type.IsAbstract || type.ContainsGenericParameters)
                    continue;

                var moduleName = type.Name.Replace("Rendering", "");
                var rendering = TypeUtility.Activate<IGridModuleRendering>(type);
                GridModuleRenderingDefinition definition;
                if (rendering is UserControl)
                    definition = new GridModuleRenderingDefinition(GridModuleRenderingType.Usercontrol, moduleName, layouts.ContainsKey(moduleName) ? layouts[moduleName] : "", type);
                else if (rendering is Control)
                    definition = new GridModuleRenderingDefinition(GridModuleRenderingType.Control, moduleName, null, type);
                else
                    continue;
                _definitions.Add(moduleName, definition);
            }
        }
Пример #3
0
 private static Control LoadUsercontrol(int? columnSpan, Id id, GridModuleRenderingDefinition renderingDefinition)
 {
     var modulePath = renderingDefinition.Path;
     var page = (System.Web.UI.Page)HttpContext.Current.Handler;
     var control = (IGridModuleRendering)page.LoadControl(modulePath);
     control.InitializeModule(id.ToString(), columnSpan);
     return (Control)control;
 }