当前位置: 首页>>代码示例>>C#>>正文


C# System.Windows.Forms.FolderBrowserDialog.ShowDialog方法代码示例

本文整理汇总了C#中System.Windows.Forms.FolderBrowserDialog.ShowDialog方法的典型用法代码示例。如果您正苦于以下问题:C# System.Windows.Forms.FolderBrowserDialog.ShowDialog方法的具体用法?C# System.Windows.Forms.FolderBrowserDialog.ShowDialog怎么用?C# System.Windows.Forms.FolderBrowserDialog.ShowDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.FolderBrowserDialog的用法示例。


在下文中一共展示了System.Windows.Forms.FolderBrowserDialog.ShowDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ChooseDirectory_Click

 /// <summary>
 /// Choosing directory handler
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ChooseDirectory_Click(object sender, RoutedEventArgs e)
 {
     var dialog = new System.Windows.Forms.FolderBrowserDialog();
     dialog.ShowDialog();
     dirBlock.Text = dialog.SelectedPath;
     if (dialog.SelectedPath != "")
     {
         while (!(Directory.EnumerateFiles(dialog.SelectedPath).Any() && Directory.EnumerateDirectories(dialog.SelectedPath).Any()) && dialog.SelectedPath != "")
         {
             System.Windows.MessageBox.Show("Please do not choose an empty folder for sharing");
             dialog.ShowDialog();
             dirBlock.Text = dialog.SelectedPath;
         }
     }
 }
开发者ID:adiarbel,项目名称:Co-Programmer,代码行数:20,代码来源:HostProjectWindow.xaml.cs

示例2: btnDir3_Click

        //pull up the modal box to select directory on click
        private void btnDir3_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new System.Windows.Forms.FolderBrowserDialog();

            System.Windows.Forms.DialogResult result = dialog.ShowDialog();
            txt3.Text = dialog.SelectedPath;
        }
开发者ID:mccoy85,项目名称:WPFapp,代码行数:8,代码来源:MainWindow.xaml.cs

示例3: viewFolderButton_Click

        // method adds a folder into the location box, 
        // then adds all the erfs in all subfolders into the list of erfs
        private void viewFolderButton_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog browser = new System.Windows.Forms.FolderBrowserDialog();
            browser.ShowNewFolderButton = false;
            System.Windows.Forms.DialogResult result = browser.ShowDialog();
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                //User clicked OK, add the path into the location box, try to add all the erfs in there too
                if (!ResourceManager.filePaths.Contains(browser.SelectedPath))
                {
                    ResourceManager.addFilePath(browser.SelectedPath);
                }
                locationListBox.Items.Add(browser.SelectedPath);

                foreach (String s in Directory.GetDirectories(browser.SelectedPath, "*", SearchOption.AllDirectories))
                {
                    if (!ResourceManager.filePaths.Contains(s))
                    {
                        //Add all the subdirectories
                        ResourceManager.addFilePath(s);
                    }
                }

                foreach (String t in Directory.GetFiles(browser.SelectedPath, "*.erf", SearchOption.AllDirectories))
                {
                    ResourceManager.addERF(t);
                }

            }
        }
开发者ID:ChewyGumball,项目名称:dragonage-lightmapper,代码行数:32,代码来源:DAToolWindow.xaml.cs

示例4: CreateContent

        public UIElement CreateContent(string directoryName)
        {
            Grid grid_main = new Grid();
            grid_main.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) });
            grid_main.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });

            m_textBox_directoryName = new TextBox();
            m_textBox_directoryName.TextChanged += (sender, args) => { DirectoryName = m_textBox_directoryName.Text; };
            m_textBox_directoryName.Text = directoryName;
            grid_main.SetGridRowColumn(m_textBox_directoryName, 0, 0);

            Button button_openFile = new Button() { Content = "Select directory ..." };
            button_openFile.Click += (x, y) =>
                {
                    System.Windows.Forms.FolderBrowserDialog selectDirectoryDialog =
                        new System.Windows.Forms.FolderBrowserDialog()
                        {
                            SelectedPath = directoryName
                        };
                    if (selectDirectoryDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        m_textBox_directoryName.Text = selectDirectoryDialog.SelectedPath;
                };
            grid_main.SetGridRowColumn(button_openFile, 0, 1);

            return grid_main;
        }
开发者ID:ianeller-romey,项目名称:GinTub_TLATEOTH,代码行数:26,代码来源:Window_SelectDirectory.cs

示例5: OnStartup

        protected override void OnStartup(StartupEventArgs e)
        {
            var prefs = IoC.Get<IAppPreferences>();

            prefs.Load();

            if (string.IsNullOrEmpty(prefs.DataStorePath))
            {
                System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
                fbd.Description = "Choose location for BrainLab data store.  The study database, subject files, and reports will be stored in this location.";

                // Show open file dialog box
                System.Windows.Forms.DialogResult result = fbd.ShowDialog();

                // Process open file dialog box results
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    prefs.DataStorePath = fbd.SelectedPath;
                }
                else
                    System.Windows.Application.Current.Shutdown();
            }

            base.OnStartup(e);
        }
开发者ID:digitalnelson,项目名称:BrainLab,代码行数:25,代码来源:App.xaml.cs

示例6: Run

        public void Run()
        {
            System.Windows.Forms.FolderBrowserDialog folderDialog = new System.Windows.Forms.FolderBrowserDialog();
            folderDialog.ShowNewFolderButton = true;
            if (folderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                WaitWindow waitWindow = new WaitWindow("Importing collection...");
                waitWindow.ShowDialog(this.ParentWindow, () =>
                {
                    try
                    {
                        using (DirectoryCollectionImporter importer = new DirectoryCollectionImporter(folderDialog.SelectedPath, this.CollectionManager))
                        {
                            importer.Import();
                        }
                    }
                    catch (Exception ex)
                    {
                        Utility.WriteToErrorLog("Error importing: " + ex.ToString());
                        MessageBox.Show("Error importing backup: " + ex.Message);
                    }

                    this.ParentWindow.Dispatcher.BeginInvokeAction(() =>
                    {
                        CollectionManagerGlobal.OnCollectionChanged();
                    });
                });
            }
        }
开发者ID:karamanolev,项目名称:MusicDatabase,代码行数:29,代码来源:DirectoryImportHelper.cs

示例7: btnSelectFiles_Click

        private void btnSelectFiles_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
            System.Windows.Forms.DialogResult result = fbd.ShowDialog();

            tbSelectedPath.Text = fbd.SelectedPath;
        }
开发者ID:Cara64,项目名称:pfeshabidi,代码行数:7,代码来源:ExtractWindow.xaml.cs

示例8: MediaPlayer_VlcLibDirectoryNeeded

        private void MediaPlayer_VlcLibDirectoryNeeded(object sender, Vlc.DotNet.Forms.VlcLibDirectoryNeededEventArgs e)
        {
            var currentAssembly = Assembly.GetEntryAssembly();
            var currentDirectory = new FileInfo(currentAssembly.Location).DirectoryName;
            if (currentDirectory == null)
                return;
            if (AssemblyName.GetAssemblyName(currentAssembly.Location).ProcessorArchitecture == ProcessorArchitecture.X86)
                e.VlcLibDirectory = new DirectoryInfo(System.IO.Path.Combine(currentDirectory, @"vlc\x86\"));
            //e.VlcLibDirectory = new DirectoryInfo(currentDirectory);
            else
                e.VlcLibDirectory = new DirectoryInfo(System.IO.Path.Combine(currentDirectory, @"vlc\x64\"));
            //e.VlcLibDirectory = new DirectoryInfo(currentDirectory);

            if (!e.VlcLibDirectory.Exists)
            {
                var folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
                folderBrowserDialog.Description = "Select Vlc libraries folder.";
                folderBrowserDialog.RootFolder = Environment.SpecialFolder.Desktop;
                folderBrowserDialog.ShowNewFolderButton = true;
                if (folderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    e.VlcLibDirectory = new DirectoryInfo(folderBrowserDialog.SelectedPath);
                }
            }
        }
开发者ID:LazizEx,项目名称:RTSP_Player,代码行数:25,代码来源:MainWindow.xaml.cs

示例9: Button_Click_1

 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     var dialog = new System.Windows.Forms.FolderBrowserDialog();
     dialog.SelectedPath = Environment.CurrentDirectory;
     if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         workFolderTB.Text = dialog.SelectedPath;
 }
开发者ID:klyuchnikov,项目名称:Miszki,代码行数:7,代码来源:MainWindow.xaml.cs

示例10: MainWindow

        public MainWindow()
        {
            Boolean bFirst = true;
            string sSelectedItem = "";

            InitializeComponent();

            //Open folder dialog
            System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
            fbd.Description = "Please, select the folder which contains your stock market data files.";
            System.Windows.Forms.DialogResult drResult = fbd.ShowDialog();
            sLocation = fbd.SelectedPath;

            while (fbd.SelectedPath == "")
            {
                fbd = new System.Windows.Forms.FolderBrowserDialog();
                fbd.Description = "You have to choose the folder which contains your stock market data files before you continue!";
                drResult = fbd.ShowDialog();
                sLocation = fbd.SelectedPath;
            }

            //Loading all .csv files into the combo box
            foreach (string stock in Directory.EnumerateFiles(fbd.SelectedPath, "*.csv"))
            {
                string stockName = stock.Substring(stock.LastIndexOf("\\") + 1, stock.Length - (stock.LastIndexOf("\\") + 1) - 4);
                cboStock.Items.Add(stockName);
                //Load the first file - optional...can work without setting the SelectedItem...everything below may be omitted
                if (bFirst)
                {
                    sSelectedItem = stockName;
                    bFirst = false;
                }
            }
            cboStock.SelectedItem = sSelectedItem;
        }
开发者ID:samardzicnenad,项目名称:TVA,代码行数:35,代码来源:MainWindow.xaml.cs

示例11: btnInputFolder_Click

        private void btnInputFolder_Click(object sender, RoutedEventArgs e)
        {
            var fbd = new System.Windows.Forms.FolderBrowserDialog
                          {
                              SelectedPath =
                                  Directory.Exists(txtInputFolder.Text)
                                      ? txtInputFolder.Text
                                      : Helpers.VariousFunctions.GetApplicationLocation()
                          };
            if (fbd.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;

            GeneratorMaps.Clear();
            txtInputFolder.Text = fbd.SelectedPath;

            var di = new DirectoryInfo(txtInputFolder.Text);
            var fis = di.GetFiles("*.map");
            foreach (var fi in fis.Where(fi => !fi.Name.ToLower().StartsWith("campaign") && !fi.Name.ToLower().StartsWith("shared") && !fi.Name.ToLower().StartsWith("single_player_shared")))
            {
                GeneratorMaps.Add(new MapEntry
                                      {
                                          IsSelected = true,
                                          LocalMapPath = fi.FullName,
                                          MapName = fi.Name
                                      });
            }
        }
开发者ID:Chrisco93,项目名称:Assembly,代码行数:26,代码来源:HaloPluginGenerator.xaml.cs

示例12: changeSyncPath

 public bool changeSyncPath()
 {
     string old_path = Core.settings.sync_path;
     string new_path = null;
     System.Windows.Forms.FolderBrowserDialog folderBrowser = new System.Windows.Forms.FolderBrowserDialog();
     folderBrowser.ShowNewFolderButton = true;
     folderBrowser.Description = "Choose where the saves will be synced.";
     folderBrowser.SelectedPath = old_path;
     bool try_again = false;
     do {
         if (folderBrowser.ShowDialog(this.GetIWin32Window()) == System.Windows.Forms.DialogResult.OK) {
             new_path = folderBrowser.SelectedPath;
             if (PermissionsHelper.isReadable(new_path)) {
                 if (PermissionsHelper.isWritable(new_path)) {
                     Core.settings.sync_path = new_path;
                     if (new_path != old_path)
                         Core.rebuild_sync = true;
                     return new_path != old_path;
                 } else {
                     this.displayError("Config File Error", "You don't have permission to write to the selected sync folder:" + Environment.NewLine + new_path);
                     try_again = true;
                 }
             } else {
                 this.displayError("Config File Error", "You don't have permission to read from the selected sync folder:" + Environment.NewLine + new_path);
                 try_again = true;
             }
         } else {
             try_again = false;
         }
     } while (try_again);
     return false;
 }
开发者ID:raven-ie,项目名称:MASGAU,代码行数:32,代码来源:NewWindow.cs

示例13: BrowseFolder_Button_Click

 private void BrowseFolder_Button_Click(object sender, RoutedEventArgs e)
 {
     var dialog = new System.Windows.Forms.FolderBrowserDialog();
     System.Windows.Forms.DialogResult result = dialog.ShowDialog();
     string FolderName = dialog.SelectedPath;
     SelectFolder(FolderName);
 }
开发者ID:Elinos,项目名称:TelerikAcademy,代码行数:7,代码来源:ImportFilesWindow.xaml.cs

示例14: changeConfigFolder

        public static bool changeConfigFolder(Window parent, ASettings settings, string setting_name,
            string description, string error_message, Permissions required_permissions) {
            string old_path = settings.get(setting_name);
            string new_path = null;
            System.Windows.Forms.FolderBrowserDialog folderBrowser = new System.Windows.Forms.FolderBrowserDialog();
            folderBrowser.ShowNewFolderButton = true;
            folderBrowser.Description = description;
            folderBrowser.SelectedPath = old_path;
            bool try_again = false;
            do {
                if (folderBrowser.ShowDialog(GetIWin32Window(parent)) == System.Windows.Forms.DialogResult.OK) {
                    new_path = folderBrowser.SelectedPath;
                    if (PermissionsHelper.isReadable(new_path)) {
                        if (required_permissions < Permissions.Write 
                            ||PermissionsHelper.isWritable(new_path)) {

                                settings.set(setting_name, new_path);

                            return new_path != old_path;
                        } else {
                            folderBrowser.Description = error_message;
                            try_again = true;
                        }
                    } else {
                        folderBrowser.Description = error_message;
                        try_again = true;
                    }
                } else {
                    try_again = false;
                }
            } while (try_again);
            return false;
        }
开发者ID:sanmadjack,项目名称:Config.WPF.CSharp,代码行数:33,代码来源:ConfigHelpers.cs

示例15: AskForInstallDirectory

        private string AskForInstallDirectory()
        {
            MessageBox.Show("Since this is the first time the Mod Manager has been run, you need to choose the directory that Cortex Command is installed to.", "First Time", MessageBoxButton.OK, MessageBoxImage.Information);

            while (true)
            {
                var browser = new System.Windows.Forms.FolderBrowserDialog();
                browser.Description = "Choose the install location for Cortex Command";
                browser.ShowNewFolderButton = false;
                browser.RootFolder = Environment.SpecialFolder.MyComputer;

                var result = browser.ShowDialog();

                if (result != System.Windows.Forms.DialogResult.OK)
                    return null; //The user cancelled the choosing.

                var installDirectory = browser.SelectedPath;

                if (CortexCommand.IsInstalledTo(installDirectory))
                    return installDirectory;

                MessageBox.Show("The directory you chose does not have a valid Cortex Command installation in it. Please choose the folder where Cortex Command is installed.",
                    "Incorrect Folder", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }
开发者ID:SneakyMax,项目名称:Cortex-Command-Mod-Manager,代码行数:25,代码来源:CCMMInitializer.cs


注:本文中的System.Windows.Forms.FolderBrowserDialog.ShowDialog方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。