public Grid(IGridConfig gridConfig) { var gridConfig1 = gridConfig; Width = gridConfig1.Width; Height = gridConfig1.Height; }
public ManifestRepository(IAppPolicyCache cache, ILogger logger) { _cache = cache; _gridConfig = Current.Configs.Grids(); _logger = logger; _defaultManifest = GetDefaultManifest("{gridEditors:[{\"name\": \"\",\"alias\": \"\",\"view\": \"/App_Plugins/DocTypeGridEditor/Views/doctypegrideditor.html\",\"render\": \"/Views/Partials/TypedGrid/Editors/DocTypeGridEditor.cshtml\",\"icon\": \"icon-document\",\"config\": {\"allowedDocTypes\": [ ], \"nameTemplate\": \"\", \"enablePreview\": true, \"largeDialog\": false, \"showDocTypeSelectAsGrid\": false, \"viewPath\": \"/Views/Partials/TypedGrid/Editors/\", \"previewViewPath\": \"/Views/Partials/TypedGrid/Editors/Previews/\", \"previewCssFilePath\": \"\", \"previewJsFilePath\": \"\" }}]}"); }
protected override void Initialize(IGridConfig gridCfg, Matrix <Cell> input) { _matrix = input; (_matrix.Height == _matrix.Width).AssertTrue(); (gridCfg.GridDim == null && gridCfg.BlockDim == null).AssertTrue(); gridCfg.SetDims(new dim3(1), new dim3(64)); }
/// <summary> /// Initializes a new instance of the <see cref="GridParser"/> class. /// </summary> public GridParser() { this.gridConfig = UmbracoConfig.For.GridConfig( ApplicationContext.Current.ProfilingLogger.Logger, ApplicationContext.Current.ApplicationCache.RuntimeCache, new DirectoryInfo(ParserHelper.MapPath(SystemDirectories.AppPlugins)), new DirectoryInfo(ParserHelper.MapPath(SystemDirectories.Config)), HttpContext.Current != null && HttpContext.Current.IsDebuggingEnabled); }
/// <summary> /// Gets the IGridConfig /// </summary> public IGridConfig GridConfig(ILogger logger, IRuntimeCacheProvider runtimeCache, DirectoryInfo appPlugins, DirectoryInfo configFolder, bool isDebug) { if (_gridConfig == null) { _gridConfig = new GridConfig(logger, runtimeCache, appPlugins, configFolder, isDebug); } return(_gridConfig); }
private void BuildForm(IFormConfig formConfig, IGridConfig gridConfig, EntityConfig entityConfig, bool hasConfiguration, Type modelType) { //var modelConfig = adminBaseConfig.ModelConfig; //var entityConfig = adminBaseConfig.EntityConfig; if (!hasConfiguration) { //Register by default settings and fields PopulateFields(modelType, formConfig); } //PopulateEntityConfig(entityType, entityConfig); //Adding primary keys to KeyField var hasExcludeFields = formConfig?.FieldConfig?.ExcludedFields?.Count > 0; if (hasExcludeFields) { PopulateFields(modelType, formConfig, formConfig.FieldConfig.ExcludedFields); } var fields = formConfig.AllFields; foreach (var field in fields) { PopulateFieldOptions(field, formConfig.FieldConditions, entityConfig); } if (gridConfig != null) { var hasListFields = gridConfig.Fields.Count > 0; if (hasListFields) { foreach (var field in gridConfig.Fields) { PopulateFieldOptions(field, formConfig.FieldConditions, entityConfig); } } else { var properties = GetProperties(modelType); foreach (var prop in properties) { var field = new Field { FieldExpression = ExpressionHelper.GetPropertyExpression(modelType, prop) }; PopulateFieldOptions(field, formConfig.FieldConditions, entityConfig); gridConfig.AddField(field); } } } }
public ManifestRepository() { _cache = ApplicationContext.Current.ApplicationCache.RuntimeCache; _gridConfig = UmbracoConfig.For.GridConfig( ApplicationContext.Current.ProfilingLogger.Logger, _cache, new DirectoryInfo(HttpContext.Current.Server.MapPath(SystemDirectories.AppPlugins)), new DirectoryInfo(HttpContext.Current.Server.MapPath(SystemDirectories.Config)), HttpContext.Current.IsDebuggingEnabled); }
protected override void Initialize(IGridConfig gridCfg, float[,] a, float[,] b) { _a = a; _b = b; (_a.Width() == _b.Height()).AssertTrue(); _c = new float[a.Height(), b.Width()]; var blockDim = new dim3(16, 16, 1); var gridDim = new dim3((int)Math.Ceil(1.0 * _b.Width() / 16), (int)Math.Ceil(1.0 * _a.Height() / 16), 1); gridCfg.SetDims(gridDim, blockDim); }
public static void ReplaceEditorObjectFromConfig(GridControl control) { // Get the "editor" object from the JSON JObject editor = control.JObject.GetObject("editor"); // Get the alias of the editor string alias = editor == null ? null : editor.GetString("alias"); // Skip if we dont have an alias if (String.IsNullOrWhiteSpace(alias)) { return; } // Get a reference to the grid configuration IGridConfig config = Current.Configs.GetConfig <IGridConfig>(); //// Get a reference to the grid configuration //IGridConfig config = UmbracoConfig.For.GridConfig( // ApplicationContext.Current.ProfilingLogger.Logger, // ApplicationContext.Current.ApplicationCache.RuntimeCache, // new DirectoryInfo(MapPath(SystemDirectories.AppPlugins)), // new DirectoryInfo(MapPath(SystemDirectories.Config)), // HttpContext.Current == null || HttpContext.Current.IsDebuggingEnabled //); // Find the editor in the configuration IGridEditorConfig found = config.EditorsConfig.Editors.FirstOrDefault(x => x.Alias == alias); // Skip if not found if (found == null) { return; } JObject serialized = new JObject(); serialized["name"] = found.Name; serialized["alias"] = found.Alias; serialized["view"] = found.View; serialized["render"] = found.Render; serialized["icon"] = found.Icon; serialized["config"] = JObject.FromObject(found.Config); control.JObject["editor"] = serialized; }
protected override void Initialize(IGridConfig gridCfg, float[,] a, float[,] b) { (a.Width() == b.Height()).AssertTrue(); _a = a; _b = b; _c = new float[_a.Height(), _b.Width()]; if (gridCfg.GridDim != null && gridCfg.BlockDim != null) { return; } (gridCfg.GridDim == null ^ gridCfg.BlockDim == null).AssertFalse(); const int defaultBlockSize = 16; var blockDim = gridCfg.BlockDim ?? new dim3(Min(_b.Width(), defaultBlockSize), Min(_a.Height(), defaultBlockSize)); var gridDim = gridCfg.GridDim ?? new dim3((int)Ceilf(1f * _b.Width() / blockDim.X), (int)Ceilf(1f * _a.Height() / blockDim.Y)); gridCfg.SetDims(gridDim, blockDim); }
public BackOfficeController( IBackOfficeUserManager userManager, IRuntimeState runtimeState, IRuntimeMinifier runtimeMinifier, IOptions <GlobalSettings> globalSettings, IHostingEnvironment hostingEnvironment, ILocalizedTextService textService, IGridConfig gridConfig, BackOfficeServerVariables backOfficeServerVariables, AppCaches appCaches, IBackOfficeSignInManager signInManager, IBackOfficeSecurityAccessor backofficeSecurityAccessor, ILogger <BackOfficeController> logger, IJsonSerializer jsonSerializer, IBackOfficeExternalLoginProviders externalLogins, IHttpContextAccessor httpContextAccessor, IBackOfficeTwoFactorOptions backOfficeTwoFactorOptions, IManifestParser manifestParser, ServerVariablesParser serverVariables) : this(userManager, runtimeState, runtimeMinifier, globalSettings, hostingEnvironment, textService, gridConfig, backOfficeServerVariables, appCaches, signInManager, backofficeSecurityAccessor, logger, jsonSerializer, externalLogins, httpContextAccessor, backOfficeTwoFactorOptions, manifestParser, serverVariables, StaticServiceProvider.Instance.GetRequiredService <IOptions <SecuritySettings> >() ) { }
public BackOfficeController( IBackOfficeUserManager userManager, IRuntimeState runtimeState, IRuntimeMinifier runtimeMinifier, IOptionsSnapshot <GlobalSettings> globalSettings, IHostingEnvironment hostingEnvironment, ILocalizedTextService textService, IGridConfig gridConfig, BackOfficeServerVariables backOfficeServerVariables, AppCaches appCaches, IBackOfficeSignInManager signInManager, IBackOfficeSecurityAccessor backofficeSecurityAccessor, ILogger <BackOfficeController> logger, IJsonSerializer jsonSerializer, IBackOfficeExternalLoginProviders externalLogins, IHttpContextAccessor httpContextAccessor, IBackOfficeTwoFactorOptions backOfficeTwoFactorOptions, IManifestParser manifestParser, ServerVariablesParser serverVariables, IOptions <SecuritySettings> securitySettings) { _userManager = userManager; _runtimeState = runtimeState; _runtimeMinifier = runtimeMinifier; _globalSettings = globalSettings.Value; _hostingEnvironment = hostingEnvironment; _textService = textService; _gridConfig = gridConfig ?? throw new ArgumentNullException(nameof(gridConfig)); _backOfficeServerVariables = backOfficeServerVariables; _appCaches = appCaches; _signInManager = signInManager; _backofficeSecurityAccessor = backofficeSecurityAccessor; _logger = logger; _jsonSerializer = jsonSerializer; _externalLogins = externalLogins; _httpContextAccessor = httpContextAccessor; _backOfficeTwoFactorOptions = backOfficeTwoFactorOptions; _manifestParser = manifestParser; _serverVariables = serverVariables; _securitySettings = securitySettings; }
public GridValueConverter(PropertyEditorCollection propertyEditors, IGridConfig config, ILogger <GridValueConverter> logger) : base(propertyEditors, logger) =>
public DefaultGridFactory(ILogger <DefaultGridFactory> logger, IGridConfig gridConfig, GridConverterCollection converters) { _logger = logger; _gridConfig = gridConfig; _converters = converters; }
/// <summary> /// Only for testing /// </summary> /// <param name="value"></param> public void SetGridConfig(IGridConfig value) { _gridConfig = value; }
/// <summary> /// Configure a template column at the given position, /// using the IGtridConfig settings. /// </summary> /// <param name="pos">Position to insert column</param> /// <param name="config">Column settings</param> /// <returns>The next column pos</returns> protected int BindTemplateColumn(int pos, IGridConfig config) { TemplateColumn column = new TemplateColumn(); column.HeaderText = config.HeaderText; column.ItemTemplate = config.ItemTemplate; column.EditItemTemplate = config.EditItemTemplate; // column.SortExpression = config.sortExpression; // See DataGridColumn.SortExpression Property // column.DataFormatString = config.dataFormat; // See Formatting Types in .NET Dev Guide Grid.Columns.AddAt(pos, column); return pos + 1; }
/// <summary> /// Initializes a new instance of the <see cref="GridParser"/> class. /// </summary> /// <param name="gridConfig"> /// The grid config. /// </param> public GridParser(IGridConfig gridConfig) { this.gridConfig = gridConfig; }
public GridValueConverter(PropertyEditorCollection propertyEditors, IGridConfig config) : base(propertyEditors) { _config = config; }
void IKernel.Initialize(IGridConfig gridCfg, params Object[] args) { (args != null && args.Count() == 7).AssertTrue(); Initialize(gridCfg, (T1)args[0], (T2)args[1], (T3)args[2], (T4)args[3], (T5)args[4], (T6)args[5], (T7)args[6]); }
protected virtual void Initialize(IGridConfig gridCfg, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) { }
public IEnumerable <DiagnosticGroup> GetDiagnosticGroups() { var groups = new List <DiagnosticGroup>(); int id = 0; var group = new DiagnosticGroup(id++, "Umbraco Configuration"); var sections = new List <DiagnosticSection>(); var section = new DiagnosticSection("Umbraco Version"); section.Diagnostics.Add(new Diagnostic("Version", runtimeState.Version)); section.Diagnostics.Add(new Diagnostic("Semantic Version", runtimeState.SemanticVersion.ToSemanticString())); section.Diagnostics.Add(new Diagnostic("Application URL", runtimeState.ApplicationUrl.ToString())); section.Diagnostics.Add(new Diagnostic("Application Virtual Path", runtimeState.ApplicationVirtualPath)); section.Diagnostics.Add(new Diagnostic("Debug?", runtimeState.Debug)); section.Diagnostics.Add(new Diagnostic("Is Main Dom?", runtimeState.IsMainDom)); section.Diagnostics.Add(new Diagnostic("Runtime Level", runtimeState.Level)); section.Diagnostics.Add(new Diagnostic("Runtime Reason", runtimeState.Reason)); section.Diagnostics.Add(new Diagnostic("Server Role", runtimeState.ServerRole)); section.Diagnostics.Add(new Diagnostic("Current Migration State", runtimeState.CurrentMigrationState)); section.Diagnostics.Add(new Diagnostic("Final Migration State", runtimeState.FinalMigrationState)); sections.Add(section); section = new DiagnosticSection("Umbraco Settings"); section.Diagnostics.Add(new Diagnostic("Debug Mode?", GlobalSettings.DebugMode)); section.AddDiagnostics(ConfigurationManager.AppSettings, false, key => key.StartsWith("umbraco", StringComparison.OrdinalIgnoreCase)); sections.Add(section); var configs = new Umbraco.Core.Configuration.Configs(); configs.AddCoreConfigs(); IUmbracoSettingsSection settings = configs.GetConfig <IUmbracoSettingsSection>(); sections.Add(DiagnosticSection.AddDiagnosticSectionFrom("Content Setting", settings.Content, true)); sections.Add(DiagnosticSection.AddDiagnosticSectionFrom("Request Handler Settings", settings.RequestHandler, true)); sections.Add(DiagnosticSection.AddDiagnosticSectionFrom("Tour Settings", settings.BackOffice.Tours, true)); sections.Add(DiagnosticSection.AddDiagnosticSectionFrom("Web Routing Settings", settings.WebRouting, true)); sections.Add(DiagnosticSection.AddDiagnosticSectionFrom("Security Settings", settings.Security, true)); sections.Add(DiagnosticSection.AddDiagnosticSectionFrom("Logging Settings", settings.Logging, true)); IHealthChecks health = configs.GetConfig <IHealthChecks>(); sections.Add(DiagnosticSection.AddDiagnosticSectionFrom("Health Checks", health.NotificationSettings, true)); IGridConfig grid = configs.GetConfig <IGridConfig>(); section = new DiagnosticSection("Grid Settings", grid.EditorsConfig.Editors.Select(e => new Diagnostic(e.Name, e.View))); sections.Add(section); section = new DiagnosticSection("Media File System"); section.Diagnostics.Add(new Diagnostic("Type", mediaFileSystem.GetType())); section.Diagnostics.Add(new Diagnostic("Can Add Physical?", mediaFileSystem.CanAddPhysical)); section.Diagnostics.Add(new Diagnostic("Full Root Path", mediaFileSystem.GetFullPath("~/"))); sections.Add(section); group.Add(sections); groups.Add(group); group = new DiagnosticGroup(id++, "Database Values"); sections = new List <DiagnosticSection>(); try { var conn = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName]; if (conn != null) { section = new DiagnosticSection("Database Settings"); section.Diagnostics.Add(new Diagnostic("Provider", conn.ProviderName)); section.Diagnostics.Add(new Diagnostic("Name", conn.Name)); section.Diagnostics.Add(new Diagnostic("Connection String", Regex.Replace(conn.ConnectionString, @"password(\W*)=(.+)(;|$)", "*******", RegexOptions.IgnorePatternWhitespace | RegexOptions.IgnoreCase))); sections.Add(section); } } catch { // deliberate } try { IEnumerable <ServerModel> servers = databaseService.GetRegistredServers(); if (servers != null && servers.Any()) { section = new DiagnosticSection("Server Registration"); foreach (ServerModel server in servers) { section.Diagnostics.Add(new Diagnostic(server.ComputerName, server.ToDiagnostic())); } sections.Add(section); } } catch { // deliberate } try { IEnumerable <UmbracoKeyValue> migrations = databaseService.GetKeyValues(); if (migrations != null && migrations.Any()) { section = new DiagnosticSection("Key Value Table"); foreach (UmbracoKeyValue migration in migrations) { section.Diagnostics.Add(new Diagnostic(migration.Value, migration.ToDiagnostic())); } sections.Add(section); } } catch { // deliberate } group.Add(sections); groups.Add(group); group = new DiagnosticGroup(id++, "Server Configuration"); sections = new List <DiagnosticSection>(); section = new DiagnosticSection("Server Settings"); section.Diagnostics.Add(new Diagnostic("Machine Name", Environment.MachineName)); section.Diagnostics.Add(new Diagnostic("OS Version", Environment.OSVersion)); section.Diagnostics.Add(new Diagnostic("64 Bit OS?", Environment.Is64BitOperatingSystem)); section.Diagnostics.Add(new Diagnostic("Processor Count", Environment.ProcessorCount)); section.Diagnostics.Add(new Diagnostic("Network Domain", Environment.UserDomainName)); section.Diagnostics.Add(new Diagnostic("ASP.NET Version", Environment.Version)); if (httpContext != null && httpContext.Request != null) { HttpRequestBase request = httpContext.Request; if (request != null) { section.Diagnostics.Add(new Diagnostic("Web Server", request["SERVER_SOFTWARE"])); section.Diagnostics.Add(new Diagnostic("Host", request["HTTP_HOST"])); section.Diagnostics.Add(new Diagnostic("App Pool ID", request["APP_POOL_ID"])); } } section.Diagnostics.Add(new Diagnostic("Current Directory", Environment.CurrentDirectory)); section.Diagnostics.Add(new Diagnostic("64 Bit Process?", Environment.Is64BitProcess)); section.Diagnostics.Add(new Diagnostic("Framework Bits", IntPtr.Size * 8)); section.Diagnostics.Add(new Diagnostic("Process Physical Memory", string.Format("{0:n} MB", Environment.WorkingSet / 1048576))); section.Diagnostics.Add(new Diagnostic("System Up Time", TimeSpan.FromTicks(Environment.TickCount))); try { object currentProcess = typeof(Process).GetMethod("GetCurrentProcess", Type.EmptyTypes).Invoke(null, null); if (currentProcess != null) { object processModule = typeof(Process).GetProperty("MainModule").GetValue(currentProcess, null); section.Diagnostics.Add(new Diagnostic("Current Process", (string)typeof(ProcessModule).GetProperty("ModuleName").GetValue(processModule, null))); } } catch { // deliberate } section.Diagnostics.Add(new Diagnostic("Current Culture", System.Threading.Thread.CurrentThread.CurrentCulture)); section.Diagnostics.Add(new Diagnostic("Current Thread State", System.Threading.Thread.CurrentThread.ThreadState)); sections.Add(section); section = new DiagnosticSection("Application Settings"); section.Diagnostics.Add(new Diagnostic("Application ID", HostingEnvironment.ApplicationID)); section.Diagnostics.Add(new Diagnostic("Site Name", HostingEnvironment.SiteName)); section.Diagnostics.Add(new Diagnostic("Development Env?", HostingEnvironment.IsDevelopmentEnvironment)); section.Diagnostics.Add(new Diagnostic("On UNC Share?", HttpRuntime.IsOnUNCShare)); section.Diagnostics.Add(new Diagnostic("Bin Directory", HttpRuntime.BinDirectory)); section.Diagnostics.Add(new Diagnostic("Code Gen Dir", HttpRuntime.CodegenDir)); section.Diagnostics.Add(new Diagnostic("Target Framework", HttpRuntime.TargetFramework)); section.Diagnostics.Add(new Diagnostic("App Domain ID", HttpRuntime.AppDomainId)); section.Diagnostics.Add(new Diagnostic("App Domain Path", HttpRuntime.AppDomainAppPath)); if (HostingEnvironment.Cache != null) { section.Diagnostics.Add(new Diagnostic("Cached Items", HostingEnvironment.Cache.Count.ToString())); section.Diagnostics.Add(new Diagnostic("Cache Memory Limit ", HostingEnvironment.Cache.EffectivePercentagePhysicalMemoryLimit + "%")); } section.Diagnostics.Add(new Diagnostic("Max Requests per CPU", HostingEnvironment.MaxConcurrentRequestsPerCPU)); section.Diagnostics.Add(new Diagnostic("Max Threads per CPU", HostingEnvironment.MaxConcurrentThreadsPerCPU)); section.Diagnostics.Add(new Diagnostic("Current Server Time", DateTime.Now)); sections.Add(section); if (httpContext != null && httpContext.Request != null) { section = new DiagnosticSection("Server Variables"); section.AddDiagnostics(httpContext.Request.ServerVariables, true, key => !ServerVarsToSkip.Contains(key)); } sections.Add(section); section = new DiagnosticSection("None Umbraco App Settings"); section.AddDiagnostics(ConfigurationManager.AppSettings, false, key => !key.StartsWith("umbraco", StringComparison.OrdinalIgnoreCase)); sections.Add(section); try { section = new DiagnosticSection("Mail Settings"); var smtp = new System.Net.Mail.SmtpClient(); section.Diagnostics.Add(new Diagnostic("SMTP Host", smtp.Host)); section.Diagnostics.Add(new Diagnostic("SMTP Delivery Method", smtp.DeliveryMethod)); section.Diagnostics.Add(new Diagnostic("SMTP Port", smtp.Port)); section.Diagnostics.Add(new Diagnostic("SMTP Service Point", smtp.ServicePoint.ConnectionName)); section.Diagnostics.Add(new Diagnostic("SMTP Delivery Format", smtp.DeliveryFormat)); sections.Add(section); } catch { // deliberate } group.Add(sections); groups.Add(group); group = new DiagnosticGroup(id++, "Umbraco Constants"); sections = new List <DiagnosticSection> { DiagnosticSection.AddDiagnosticSectionFromConstant("Applications", typeof(Constants.Applications)), DiagnosticSection.AddDiagnosticSectionFromConstant("Composing", typeof(Constants.Composing)), DiagnosticSection.AddDiagnosticSectionFromConstant("Conventions", typeof(Constants.Conventions)), DiagnosticSection.AddDiagnosticSectionFromConstant("Icons", typeof(Constants.Icons)), DiagnosticSection.AddDiagnosticSectionFromConstant("Object Types", typeof(Constants.ObjectTypes)), DiagnosticSection.AddDiagnosticSectionFromConstant("Property Editors", typeof(Constants.PropertyEditors)), DiagnosticSection.AddDiagnosticSectionFromConstant("Property Type Groups", typeof(Constants.PropertyTypeGroups)), DiagnosticSection.AddDiagnosticSectionFromConstant("Security", typeof(Constants.Security)), DiagnosticSection.AddDiagnosticSectionFromConstant("System", typeof(Constants.System)), DiagnosticSection.AddDiagnosticSectionFromConstant("Trees", typeof(Constants.Trees)), DiagnosticSection.AddDiagnosticSectionFromConstant("UDI Entity Type", typeof(Constants.UdiEntityType)), DiagnosticSection.AddDiagnosticSectionFromConstant("Umbraco Indexes", typeof(Constants.UmbracoIndexes)), DiagnosticSection.AddDiagnosticSectionFromConstant("Web", typeof(Constants.Web)) }; group.Add(sections); groups.Add(group); group = new DiagnosticGroup(id++, "MVC Configuration"); sections = new List <DiagnosticSection>(); try { var mvc = Assembly.Load(new AssemblyName("System.Web.Mvc")); AssemblyName name = mvc.GetName(); section = new DiagnosticSection("MVC Version"); section.Diagnostics.Add(new Diagnostic("MVC Version", name.Version)); section.Diagnostics.Add(new Diagnostic("Full Name", mvc.FullName)); section.Diagnostics.Add(new Diagnostic("Architecture", name.ProcessorArchitecture)); sections.Add(section); } catch { // deliberate } section = new DiagnosticSection("MVC Routes"); section.Diagnostics.AddRange(RouteTable.Routes.Select(r => (Route)r).Select(r => new Diagnostic(r.RouteHandler.GetType().Name, r.Url))); sections.Add(section); section = new DiagnosticSection("MVC Action Filters"); section.AddDiagnosticsFrom(typeof(IActionFilter)); sections.Add(section); section = new DiagnosticSection("MVC Authorization Filters"); section.AddDiagnosticsFrom(typeof(IAuthorizationFilter)); sections.Add(section); section = new DiagnosticSection("MVC Model Binders"); section.AddDiagnosticsFrom(typeof(IModelBinder)); sections.Add(section); section = new DiagnosticSection("MVC Controller Factories"); section.AddDiagnosticsFrom(typeof(IControllerFactory)); sections.Add(section); section = new DiagnosticSection("MVC Controllers"); section.AddDiagnosticsFrom(typeof(IController)); sections.Add(section); group.Add(sections); groups.Add(group); return(groups); }
public static IGrid ToGrid(this IGridConfig gridCfg) { return(new Grid(gridCfg.GridDim.AssertValue(), gridCfg.BlockDim.AssertValue())); }
/// <summary> /// Deserializes the specified <paramref name="json"/> string into an instance of <see cref="GridDataModel"/>. /// </summary> /// <param name="json">The JSON string to be deserialized.</param> /// <param name="propertyTypeAlias">The alias of the property the Grid model is representing.</param> /// <param name="config">The Grid configuration to be used.</param> public static GridDataModel Deserialize(string json, string propertyTypeAlias, IGridConfig config) { // Validate the JSON if (json == null || !json.StartsWith("{") || !json.EndsWith("}")) { return(null); } // Deserialize the JSON JObject obj = JObject.Parse(json); // Parse basic properties GridDataModel model = new GridDataModel(obj) { Raw = json, Name = obj.GetString("name"), PropertyAlias = propertyTypeAlias }; // Parse the sections model.Sections = obj.GetArray("sections", x => GridSection.Parse(model, x)) ?? new GridSection[0]; // Return the model return(model); }
public GridPropertyValueConverter(IGridConfig config) { _config = config; }
/// <summary> /// Configure a DataGrid column at the given position, /// using the IGridConfig settings. /// </summary> /// <param name="pos">Position to insert column</param> /// <param name="config">Column settings</param> /// <returns>The next column pos</returns> protected int BindColumn(int pos, IGridConfig config) { BoundColumn column = new BoundColumn(); column.HeaderText = config.HeaderText; column.DataField = config.DataField; // column.SortExpression = config.sortExpression; // See DataGridColumn.SortExpression Property // column.DataFormatString = config.dataFormat; // See Formatting Types in .NET Dev Guide Grid.Columns.AddAt(pos, column); return pos + 1; }