/// <summary> /// Translates the name of the specified property on the specified domain class. /// </summary> /// <param name="domainClass"></param> /// <param name="propertyName"></param> /// <returns></returns> public static string Translate(Type domainClass, string propertyName) { IResourceResolver resolver = new ResourceResolver(domainClass.Assembly); string key = domainClass.Name + propertyName; string localized = resolver.LocalizeString(key); if (localized == key) { localized = resolver.LocalizeString(propertyName); } return(localized); }
/// <summary> /// Returns the set of authority tokens defined by all plugins. /// </summary> /// <returns></returns> public static AuthorityTokenDefinition[] GetAuthorityTokens() { List <AuthorityTokenDefinition> tokens = new List <AuthorityTokenDefinition>(); // scan all plugins for token definitions foreach (PluginInfo plugin in Platform.PluginManager.Plugins) { IResourceResolver resolver = new ResourceResolver(plugin.Assembly); foreach (Type type in plugin.Assembly.GetTypes()) { // look at public fields foreach (FieldInfo field in type.GetFields()) { AuthorityTokenAttribute attr = AttributeUtils.GetAttribute <AuthorityTokenAttribute>(field, false); if (attr != null) { string token = (string)field.GetValue(null); string description = resolver.LocalizeString(attr.Description); tokens.Add(new AuthorityTokenDefinition(token, description)); } } } } return(tokens.ToArray()); }
/// <summary> /// Returns the set of authority tokens defined by all plugins. /// </summary> /// <returns></returns> public static AuthorityTokenDefinition[] GetAuthorityTokens() { var tokens = new List <AuthorityTokenDefinition>(); // scan all plugins for token definitions foreach (var plugin in Platform.PluginManager.Plugins) { var assembly = plugin.Assembly.Resolve(); var resolver = new ResourceResolver(assembly); foreach (var type in plugin.Assembly.Resolve().GetTypes()) { // look at public fields foreach (var field in type.GetFields()) { var attr = AttributeUtils.GetAttribute <AuthorityTokenAttribute>(field, false); if (attr != null) { var token = (string)field.GetValue(null); var description = resolver.LocalizeString(attr.Description); var formerIdentities = (attr.Formerly ?? "").Split(';'); tokens.Add(new AuthorityTokenDefinition(token, assembly.FullName, description, formerIdentities)); } } } } return(tokens.ToArray()); }
/// <summary> /// Gets the description for the specified worklist class, as specified by /// the <see cref="WorklistCategoryAttribute"/>, or null if not specified. /// </summary> /// <param name="worklistClass"></param> /// <returns></returns> public static string GetDescription(Type worklistClass) { var a = AttributeUtils.GetAttribute <WorklistClassDescriptionAttribute>(worklistClass, true); if (a == null) { return(null); } var resolver = new ResourceResolver(worklistClass, true); return(resolver.LocalizeString(a.Description)); }
/// <summary> /// Gets the display name for the specified worklist class, obtained either from /// the <see cref="WorklistClassDisplayNameAttribute"/>, otherwise via the /// <see cref="TerminologyTranslator"/> class. /// </summary> /// <param name="worklistClass"></param> /// <returns></returns> public static string GetDisplayName(Type worklistClass) { var a = AttributeUtils.GetAttribute <WorklistClassDisplayNameAttribute>(worklistClass, true); if (a == null) { return(TerminologyTranslator.Translate(worklistClass)); } var resolver = new ResourceResolver(worklistClass, true); return(resolver.LocalizeString(a.DisplayName)); }
/// <summary> /// Gets the category for the specified worklist class, as specified by /// the <see cref="WorklistCategoryAttribute"/>, or null if not specified. /// </summary> /// <param name="worklistClass"></param> /// <returns></returns> public static string GetCategory(Type worklistClass) { var a = AttributeUtils.GetAttribute <WorklistCategoryAttribute>(worklistClass, true); if (a == null) { return(null); } var resolver = new ResourceResolver(worklistClass, true); return(resolver.LocalizeString(a.Category)); }
protected ImageExporter(string identifier, string description, string[] fileExtensions) { Platform.CheckForEmptyString(identifier, "identifier"); Platform.CheckForEmptyString(description, "description"); Platform.CheckForNullReference(fileExtensions, "fileExtension"); if (fileExtensions.Length == 0) { throw new ArgumentException("The exporter must have at least one associated file extension."); } IResourceResolver resolver = new ResourceResolver(this.GetType().Assembly); _identifier = identifier; _description = resolver.LocalizeString(description); _fileExtensions = fileExtensions; }
/// <summary> /// Constructor /// </summary> protected Folder() { // establish default resource resolver on this assembly (not the assembly of the derived class) _resourceResolver = new ResourceResolver(typeof(Folder).Assembly); // Initialize folder Path var pathAttrib = AttributeUtils.GetAttribute <FolderPathAttribute>(this.GetType()); if (pathAttrib != null) { _folderPath = new Path(pathAttrib.Path, _resourceResolver); _startExpanded = pathAttrib.StartExpanded; } // Initialize tooltip var attrib = AttributeUtils.GetAttribute <FolderDescriptionAttribute>(this.GetType()); if (attrib != null) { var resolver = new ResourceResolver(this.GetType(), true); this.Tooltip = resolver.LocalizeString(attrib.Description); } }
/// <summary> /// Translates the name of the specified domain class. /// </summary> /// <param name="domainClass"></param> /// <returns></returns> public static string Translate(Type domainClass) { IResourceResolver resolver = new ResourceResolver(domainClass.Assembly); return(resolver.LocalizeString(domainClass.Name)); }