internal static ICustomDataEditor CreateTypeEditorFromDisplayName(string displayName) { Type type = TypeEditors.FirstOrDefault(t => InformationAttribute.GetDisplayName(t) == displayName); if (type != null) { return((ICustomDataEditor)Activator.CreateInstance(type)); } return(null); }
private static ExportEntryViewModel GetEntryViewModel(ExportedType export) { ExportEntryViewModel vm = new ExportEntryViewModel(); vm.Name = export.Attribute.Alias; vm.DisplayName = InformationAttribute.GetDisplayName(export.Type); vm.Description = InformationAttribute.GetDescription(export.Type); if (string.IsNullOrWhiteSpace(vm.Description)) { // If there is no useful description, set it to null to make TargetNullValue in binding effective. vm.Description = null; } return(vm); }
private static ExportEntryViewModel GetEntryViewModel(ExportConfiguration.ExportEntry entry, IList <ExportedType> validExports) { Type myType = validExports.Single(e => e.Attribute.Alias == entry.Name).Type; ExportEntryViewModel vm = new ExportEntryViewModel(); vm.IsEnabled = entry.IsEnabled; vm.Name = entry.Name; vm.DisplayName = InformationAttribute.GetDisplayName(myType); vm.Description = InformationAttribute.GetDescription(myType); if (string.IsNullOrWhiteSpace(vm.Description)) { // If there is no useful description, set it to null to make TargetNullValue in binding effective. vm.Description = null; } return(vm); }