Ejemplo n.º 1
0
        private void OpenFileBrowserDialog(string path = null)
        {
            string defaultPath;

            if (path != null && Directory.Exists(path))
            {
                defaultPath = path;
            }
            else
            {
                defaultPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            }

            FolderBrowserDialogEx folderBrowse = new FolderBrowserDialogEx()
            {
                Description           = "Choose a directory",
                ShowNewFolderButton   = true,
                SelectedPath          = Directory.Exists(defaultPath) ? defaultPath : textBoxInput.Text,
                ShowEditBox           = true,
                ShowFullPathInEditBox = true,
            };

            folderBrowse.ShowDialog();
            if (Directory.Exists(folderBrowse.SelectedPath) || File.Exists(folderBrowse.SelectedPath) /*|| folderBrowse.SelectedPath != (Directory.Exists(path) ? path : defaultPath)*/)
            {
                textBoxInput.Text = folderBrowse.SelectedPath;
            }
        }
Ejemplo n.º 2
0
        // Factory Methods
        public static FolderBrowserDialogEx PrinterBrowser()
        {
            FolderBrowserDialogEx x = new FolderBrowserDialogEx();

            // avoid MBRO comppiler warning when passing _rootFolderLocation as a ref:
            x.BecomePrinterBrowser();
            return(x);
        }