Exemplo n.º 1
0
        private static string GetTagName(DicomTag dicomTag)
        {
            var lookup   = string.Format(@"Name{0}", dicomTag.VariableName);
            var resolved = _resolver.LocalizeString(lookup);

            return(lookup == resolved ? dicomTag.Name : resolved);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Gets a user friendly display name.
 /// </summary>
 public string GetDisplayName()
 {
     if (_annotationResourceResolver != null)
     {
         return(_annotationResourceResolver.ResolveDisplayName(_identifier));
     }
     return(_standardResourceResolver != null?_standardResourceResolver.LocalizeString(_displayName) : _displayName);
 }
Exemplo n.º 3
0
            internal Item(ImageComparer imageComparer, bool reverse)
            {
                _resourceResolver = new ResourceResolver(imageComparer.GetType(), false);
                _description      = imageComparer.Description;
                Name             = imageComparer.Name;
                IsReverse        = reverse;
                _realDescription = !IsReverse
                                       ? _resourceResolver.LocalizeString(_description)
                                       : string.Format(SR.FormatSortByReverse, _resourceResolver.LocalizeString(_description));

                Comparer = imageComparer.GetComparer(reverse);
            }
Exemplo n.º 4
0
        /// <summary>
        /// Attempts to localize the specified unqualified string resource key
        /// by searching the set of assemblies associated with this <see cref="ResourceResolver"/> in order.
        /// </summary>
        /// <remarks>
        /// Searches the assemblies for resources ending in "SR.resources", and searches those resources
        /// for a string matching the specified key.
        /// </remarks>
        /// <param name="unqualifiedStringKey">The string resource key to search for.  Must not be qualified.</param>
        /// <returns>The localized string, or the argument unchanged if the key could not be found.</returns>
        public string LocalizeString(string unqualifiedStringKey)
        {
            if (string.IsNullOrEmpty(unqualifiedStringKey))
            {
                return(unqualifiedStringKey);
            }

            // search the assemblies in order
            foreach (Assembly asm in _assemblies)
            {
                try
                {
                    string localized = LocalizeString(unqualifiedStringKey, asm);
                    if (localized != null)
                    {
                        return(localized);
                    }
                }
                catch (Exception)
                {
                    // failed to resolve in the specified assembly
                }
            }

            // try the fallback
            if (_fallbackResolver != null)
            {
                return(_fallbackResolver.LocalizeString(unqualifiedStringKey));
            }

            // return the unresolved string if not resolved
            return(unqualifiedStringKey);
        }
Exemplo n.º 5
0
        private static PathSegment[] ParsePathString(string pathString, IResourceResolver resolver)
        {
            // replace any escaped separators with some weird temporary string
            pathString = StringUtilities.EmptyIfNull(pathString).Replace(ESCAPED_SEPARATOR, TEMP);

            // split string by separator
            string[] parts = pathString.Split(new string[] { SEPARATOR }, StringSplitOptions.None);
            int      n     = parts.Length;

            PathSegment[] segments = new PathSegment[n];
            for (int i = 0; i < n; i++)
            {
                // replace the temp string with the unescaped separator
                parts[i]    = parts[i].Replace(TEMP, SEPARATOR);
                segments[i] = new PathSegment(parts[i], resolver != null ? resolver.LocalizeString(parts[i]) : parts[i]);
            }
            return(segments);
        }
        private static string LookupCategory(string category)
        {
            if (String.IsNullOrEmpty(category))
            {
                return("");
            }

            string lookup   = String.Format("Category{0}", category);
            string resolved = _resolver.LocalizeString(lookup);

            if (lookup == resolved)
            {
                return(category);
            }
            else
            {
                return(resolved);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Constructor
        /// </summary>
        protected Folder()
        {
            _resourceResolver = new ResourceResolver(this.GetType(), true);

            // 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)
            {
                this.Tooltip = _resourceResolver.LocalizeString(attrib.Description);
            }
        }
Exemplo n.º 8
0
		/// <summary>
		/// Gets the custom message localized according to the specified resource resolver.
		/// </summary>
		protected string GetLocalizedCustomMessage(IResourceResolver resourceResolver)
		{
			return string.IsNullOrEmpty(_message) ? null : resourceResolver.LocalizeString(_message);
		}
Exemplo n.º 9
0
 /// <summary>
 /// Creates a <see cref="PathSegment"/> from the specified string, which may be either a resource key or a literal.
 /// </summary>
 /// <param name="p"></param>
 /// <param name="resolver"></param>
 public PathSegment(string p, IResourceResolver resolver)
     : this(p, resolver != null ? resolver.LocalizeString(p) : p)
 {
 }
Exemplo n.º 10
0
 internal Item(ImageComparer imageComparer, bool reverse)
 {
     _resourceResolver = new ResourceResolver(imageComparer.GetType(), false);
     _description = imageComparer.Description;
     Name = imageComparer.Name;
     IsReverse = reverse;
     _realDescription = !IsReverse
                            ? _resourceResolver.LocalizeString(_description)
                            : string.Format(SR.FormatSortByReverse, _resourceResolver.LocalizeString(_description));
     
     Comparer = imageComparer.GetComparer(reverse);
 }
Exemplo n.º 11
0
		/// <summary>
		/// Constructor
		/// </summary>
		protected Folder()
		{
			_resourceResolver = new ResourceResolver(this.GetType(), true);
			
			// 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)
			{
				this.Tooltip = _resourceResolver.LocalizeString(attrib.Description);
			}
		}
Exemplo n.º 12
0
 /// <summary>
 /// Gets the custom message localized according to the specified resource resolver.
 /// </summary>
 protected string GetLocalizedCustomMessage(IResourceResolver resourceResolver)
 {
     return(string.IsNullOrEmpty(_message) ? null : resourceResolver.LocalizeString(_message));
 }