/// <summary> /// Updates the native shell item that maps to this shell object. This is necessary when the shell item /// changes after the shell object has been created. Without this method call, the retrieval of properties will /// return stale data. /// </summary> /// <param name="bindContext">Bind context object</param> public void Update(IBindCtx bindContext) { HResult hr = HResult.Ok; if (NativeShellItem2 != null) { hr = NativeShellItem2.Update(bindContext); } if (CoreErrorHelper.Failed(hr)) { throw new ShellException(hr); } }
/// <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); }
/// <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); }