HResult IShellBrowser.BrowseObject(IntPtr pidl, SBSP wFlags)
 {
     if ((wFlags & SBSP.SBSP_RELATIVE) != 0)
     {
         // ReSharper disable once UnusedVariable
         var shellItem = new ShellItem(MShellView.CurrentFolder, pidl);
     }
     else if ((wFlags & SBSP.SBSP_PARENT) != 0)
     {
         MShellView.NavigateParent();
     }
     else if ((wFlags & SBSP.SBSP_NAVIGATEBACK) != 0)
     {
         MShellView.NavigateBack();
     }
     else if ((wFlags & SBSP.SBSP_NAVIGATEFORWARD) != 0)
     {
         MShellView.NavigateForward();
     }
     else
     {
         MShellView.Navigate(new ShellItem(ShellItem.Desktop, pidl));
     }
     return(HResult.S_OK);
 }
        private bool Open(string path)
        {
            var result = false;

            if (File.Exists(path))
            {
                FileNameEntered?.Invoke(this, EventArgs.Empty);
                result = true;
            }
            else if (Directory.Exists(path))
            {
                if (_mShellView != null)
                {
                    _mShellView.Navigate(path);
                    Text   = string.Empty;
                    result = true;
                }
            }
            else
            {
                OpenParentOf(path);
                Text = Path.GetFileName(path);
            }

            if (_mShellView != null && !Path.IsPathRooted(path) && _mShellView.CurrentFolder.IsFileSystem)
            {
                result = Open(Path.Combine(_mShellView.CurrentFolder.FileSystemPath,
                                           path));
            }

            return(result);
        }
Exemple #3
0
 private void button_Click(object sender, EventArgs e)
 {
     if (ShellView != null)
     {
         var folder = (ShellItem)((ToolStripButton)sender).Tag;
         ShellView.Navigate(folder);
     }
 }
        private void OpenParentOf(string path)
        {
            var parent = Path.GetDirectoryName(path);

            if (!string.IsNullOrEmpty(parent) &&
                Directory.Exists(parent))
            {
                _mShellView?.Navigate(parent);
            }
        }