Inheritance: System.Windows.Forms.CommonDialog
 // Factory Methods
 public static FolderBrowserDialogEx PrinterBrowser()
 {
     FolderBrowserDialogEx x = new FolderBrowserDialogEx();
     // avoid MBRO comppiler warning when passing _rootFolderLocation as a ref:
     x.BecomePrinterBrowser();
     return x;
 }
Exemple #2
0
        public static FolderBrowserDialogEx ComputerBrowser()
        {
            FolderBrowserDialogEx ex = new FolderBrowserDialogEx();

            ex.BecomeComputerBrowser();
            return(ex);
        }
        private void AddSongsButtonClick(object sender, RoutedEventArgs e)
        {
            var dialog = new FolderBrowserDialogEx
            {
                Description = "Choose a folder containing the music that you want to add to the library"
            };

            dialog.ShowDialog();

            string selectedPath = dialog.SelectedPath;

            if (!String.IsNullOrEmpty(selectedPath))
            {
                this.mainViewModel.LocalViewModel.AddSongs(selectedPath);
            }
        }
        //To display the browse dialog window (for selecting file/folder)
        private void browseSource_Click(object sender, EventArgs e)
        {
            var dlg1 = new FolderBrowserDialogEx();     //dlg1 is the object of 'FolderBrowserDialogEx.cs' file
            dlg1.Description = "Select a File or Folder";
            dlg1.ShowNewFolderButton = true;
            dlg1.ShowEditBox = false;
            dlg1.ShowBothFilesAndFolders = true;
            dlg1.ShowFullPathInEditBox = true;
            dlg1.RootFolder = System.Environment.SpecialFolder.MyComputer;

            // Show the FolderBrowserDialog.
            DialogResult result = dlg1.ShowDialog();
            if (result == DialogResult.OK)
            {
                Source.Text = dlg1.SelectedPath;
            }
        }
 // Factory Methods
 public static FolderBrowserDialogEx PrinterBrowser()
 {
     FolderBrowserDialogEx x = new FolderBrowserDialogEx();
     // avoid MBRO comppiler warning when passing _rootFolderLocation as a ref:
     x.BecomePrinterBrowser();
     return x;
 }
        private void OpenFileBrowser(object sender, RoutedEventArgs e)
        {
            Button b = sender as Button;

            TextBox tb = null;
            if (b.Name.Contains("Dest"))
                tb = DestBox;
            else if (b.Name.Contains("Source"))
                tb = SourceBox;

            var dlg = new FolderBrowserDialogEx
                          {
                              ShowNewFolderButton = true,
                              ShowEditBox = true,
                              RootFolder = Environment.SpecialFolder.MyComputer,
                              SelectedPath = tb.Text != String.Empty ? tb.Text : Environment.SpecialFolder.MyComputer.ToString(),
                          };

            var result = dlg.ShowDialog();

            tb.Text = result == System.Windows.Forms.DialogResult.OK ? dlg.SelectedPath : tb.Text;
        }
        private void outputDirectoryDialogButton_Click(object sender, EventArgs e)
        {
            // 3rd party code, taken from:
            // http://stackoverflow.com/a/580706
            // http://dotnetzip.codeplex.com/SourceControl/changeset/view/29499#432677

            var folderDialog = new FolderBrowserDialogEx
            {
                Description = "Select output directory",
                ShowNewFolderButton = true,
                ShowEditBox = true,
                SelectedPath = outputDirectory.Text,
                ShowFullPathInEditBox = true,
                RootFolder = Environment.SpecialFolder.MyComputer
            };

            if (folderDialog.ShowDialog() == DialogResult.OK)
            {
                outputDirectory.Text = folderDialog.SelectedPath;
            }
        }