Пример #1
0
        /// <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;
        }
Пример #2
0
		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;
		}
Пример #3
0
 /// <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);
 }
Пример #4
0
		/// <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);
			}
		}
Пример #5
0
		/// <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);
		}
Пример #6
0
		/// <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);
		}
Пример #7
0
		/// <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);
		}