Exemplo n.º 1
0
        /// <summary>
        /// Returns the display name of the ShellFolder object. DisplayNameType represents one of the
        /// values that indicates how the name should look.
        /// See <see cref="Microsoft.WindowsAPICodePack.Shell.DisplayNameType"/>for a list of possible values.
        /// </summary>
        /// <param name="displayNameType">A disaply name type.</param>
        /// <returns>A string.</returns>
        virtual public string GetDisplayName(DisplayNameType displayNameType)
        {
            string returnValue = null;

            HRESULT hr = HRESULT.S_OK;

            if (NativeShellItem2 != null)
            {
                hr = NativeShellItem2.GetDisplayName((ShellNativeMethods.SIGDN)displayNameType, out returnValue);
            }

            if (hr != HRESULT.S_OK)
            {
                throw new COMException("Can't get the display name", (int)hr);
            }

            return(returnValue);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns the display name of the ShellFolder object. DisplayNameType represents one of the
        /// values that indicates how the name should look.
        /// See <see cref="Microsoft.WindowsAPI.Shell.DisplayNameType"/>for a list of possible values.
        /// </summary>
        /// <param name="displayNameType">A disaply name type.</param>
        /// <returns>A string.</returns>
        public virtual string GetDisplayName(DisplayNameType displayNameType)
        {
            string returnValue = null;

            HResult hr = HResult.Ok;

            if (NativeShellItem2 != null)
            {
                hr = NativeShellItem2.GetDisplayName((ShellNativeMethods.ShellItemDesignNameOptions)displayNameType, out returnValue);
            }

            if (hr != HResult.Ok)
            {
                throw new ShellException(LocalizedMessages.ShellObjectCannotGetDisplayName, hr);
            }

            return(returnValue);
        }