Exemple #1
0
        internal FileDialogNative.IShellItem GetNativePath()
        {
            string folderLocation = "";

            if (!string.IsNullOrEmpty(this._path))
            {
                folderLocation = this._path;
            }
            else
            {
                folderLocation = GetFolderLocation(this._knownFolderGuid);
            }
            if (string.IsNullOrEmpty(folderLocation))
            {
                return(null);
            }
            return(FileDialog.GetShellItemForPath(folderLocation));
        }
        internal FileDialogNative.IShellItem GetNativePath()
        {
            // This can throw in a multitude of ways if the path or Guid doesn't correspond
            // to an actual filesystem directory.
            // The Caller is responsible for handling these situations.
            string filePathString;

            if (!string.IsNullOrEmpty(_path))
            {
                filePathString = _path;
            }
            else
            {
                int result = Interop.Shell32.SHGetKnownFolderPath(ref _knownFolderGuid, 0, IntPtr.Zero, out filePathString);
                if (result == 0)
                {
                    return(null);
                }
            }

            return(FileDialog.GetShellItemForPath(filePathString));
        }
Exemple #3
0
        internal FileDialogNative.IShellItem GetNativePath()
        {
            //This can throw in a multitude of ways if the path or Guid doesn't correspond
            //to an actual filesystem directory.  Caller is responsible for handling these situations.
            string filePathString = "";

            if (!string.IsNullOrEmpty(this._path))
            {
                filePathString = this._path;
            }
            else
            {
                filePathString = GetFolderLocation(this._knownFolderGuid);
            }

            if (string.IsNullOrEmpty(filePathString))
            {
                return(null);
            }
            else
            {
                return(FileDialog.GetShellItemForPath(filePathString));
            }
        }