Exemplo n.º 1
0
        /// <summary>
        /// Sets the location (KNOWNFOLDERID) from which to begin browsing a namespace in the navigation pane.
        /// </summary>
        /// <exception cref="FileNotFoundException">navigationRoot KNOWNFOLDERID not found.</exception>
        /// <exception cref="COMException">See HRESULT value for more details.</exception>
        public void SetNavigationRoot(Guid navigationRoot)
        {
            var shellItem   = ComHelper.ShellItemFromKnownFolder(navigationRoot);
            var fileDialog2 = MarshalHelper.QueryInterface <IFileDialog2>(_dialog);

            fileDialog2.SetNavigationRoot(shellItem);
            Marshal.ReleaseComObject(fileDialog2);
            Marshal.ReleaseComObject(shellItem);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sets the text of the Cancel button.
        /// </summary>
        /// <exception cref="ArgumentException">cancelButtonLabel cannot be null, empty or only white-space characters.</exception>
        /// <exception cref="COMException">See HRESULT value for more details.</exception>
        public void SetCancelButtonLabel(string cancelButtonLabel)
        {
            if (string.IsNullOrWhiteSpace(cancelButtonLabel))
            {
                throw new ArgumentException(NullOrWhiteSpaceExceptionMessage, nameof(cancelButtonLabel));
            }

            var fileDialog2 = MarshalHelper.QueryInterface <IFileDialog2>(_dialog);

            fileDialog2.SetCancelButtonLabel(cancelButtonLabel);
            Marshal.ReleaseComObject(fileDialog2);
        }