• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Forms.FolderBrowserDialog类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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


示例2: 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


示例3: 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


示例4: 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


示例5: 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


示例6: btnInputFolder_Click

        private void btnInputFolder_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
            if (Directory.Exists(txtInputFolder.Text))
                fbd.SelectedPath = txtInputFolder.Text;
            else
                fbd.SelectedPath = Helpers.VariousFunctions.GetApplicationLocation();
            if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                GeneratorMaps.Clear();
                txtInputFolder.Text = fbd.SelectedPath;

                DirectoryInfo di = new DirectoryInfo(txtInputFolder.Text);
                FileInfo[] fis = di.GetFiles("*.map");
                foreach (FileInfo fi in fis)
                {
                    GeneratorMaps.Add(new MapEntry()
                    {
                        IsSelected = true,
                        LocalMapPath = fi.FullName,
                        MapName = fi.Name
                    });
                }
            }
        }
开发者ID:YxCREATURExY,项目名称:Assembly,代码行数:25,代码来源:HaloPluginGenerator.xaml.cs


示例7: addSavePath

 public bool addSavePath(AWindow window)
 {
     string new_path;
     System.Windows.Forms.FolderBrowserDialog folderBrowser = new System.Windows.Forms.FolderBrowserDialog();
     folderBrowser.ShowNewFolderButton = true;
     folderBrowser.Description = Strings.GetLabelString("SelectAltPath");
     bool try_again = false;
     do {
         if (folderBrowser.ShowDialog(window.GetIWin32Window()) == System.Windows.Forms.DialogResult.OK) {
             new_path = folderBrowser.SelectedPath;
             if (PermissionsHelper.isReadable(new_path)) {
                 if (Core.settings.addSavePath(new_path)) {
                     try_again = false;
                     return true;
                 } else {
                     this.showTranslatedError("SelectAltPathDuplicate");
                     try_again = true;
                 }
             } else {
                 this.showTranslatedError("SelectAltPathDuplicate");
                 try_again = true;
             }
         } else {
             try_again = false;
         }
     } while (try_again);
     return false;
 }
开发者ID:Korn1699,项目名称:MASGAU,代码行数:28,代码来源:NewWindow.cs


示例8: BrowseForFolder

        public static string BrowseForFolder(string startingPath)
        {
            string initialDirectory = _lastDirectory ?? startingPath;
            string ret = null;

            try
            {
                var cfd = new CommonOpenFileDialog
                {
                    InitialDirectory = initialDirectory,
                    IsFolderPicker = true
                };

                if (cfd.ShowDialog() == CommonFileDialogResult.Ok)
                {
                    ret = cfd.FileName;
                }
            }
            catch (System.PlatformNotSupportedException)
            {
                var fd = new System.Windows.Forms.FolderBrowserDialog
                {
                    SelectedPath = initialDirectory
                };

                if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    ret = fd.SelectedPath;
                }
            }

            _lastDirectory = ret;
            return ret;
        }
开发者ID:Haacked,项目名称:SeeGit,代码行数:34,代码来源:WindowsExtensions.cs


示例9: InitializeComponent

		/// <summary>
		/// This method is required for Windows Forms designer support.
		/// Do not change the method contents inside the source code editor. The Forms designer might
		/// not be able to load this method if it was changed manually.
		/// </summary>
		private void InitializeComponent()
		{
			this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
			this.button1 = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// folderBrowserDialog1
			// 
			this.folderBrowserDialog1.Description = "Chose monitor fodler";
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(100, 54);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(186, 78);
			this.button1.TabIndex = 0;
			this.button1.Text = "chose monitor folder";
			this.button1.UseVisualStyleBackColor = true;
			this.button1.Click += new System.EventHandler(this.Button1Click);
			// 
			// MainForm
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.ClientSize = new System.Drawing.Size(396, 264);
			this.Controls.Add(this.button1);
			this.Name = "MainForm";
			this.Text = "LoseAV";
			this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainFormFormClosing);
			this.ResumeLayout(false);

		}
开发者ID:droidwolf,项目名称:Win32-Inline-API-hook,代码行数:37,代码来源:MainForm.Designer.cs


示例10: SetMode

 private void SetMode()
 {
     if(IsFileSelector)
     {
         ButtonText = "\uF15C";
         ButtonCommand = new RelayCommand(() => 
         {
             var dlg = new OpenFileDialog();
             if (dlg.ShowDialog() == true)
             {
                 ConfigItemValue = dlg.FileName;
             }
         }, true);
     }
     else
     {
         ButtonText = "\uF07C";
         ButtonCommand = new RelayCommand(() =>
         {
             var dlg = new System.Windows.Forms.FolderBrowserDialog();
             dlg.ShowNewFolderButton = true;
             dlg.ShowDialog();
             if (!String.IsNullOrEmpty(dlg.SelectedPath))
             {
                 ConfigItemValue = dlg.SelectedPath;
             }
         }, true);
     }
 }
开发者ID:llenroc,项目名称:sharpDox,代码行数:29,代码来源:ConfigFileSystemControl.xaml.cs


示例11: brouse_Click

 private void brouse_Click(object sender, RoutedEventArgs e)
 {
     dlg = new System.Windows.Forms.FolderBrowserDialog();
     result = dlg.ShowDialog(this.GetIWin32Window());
     if (result == System.Windows.Forms.DialogResult.OK)
         pathLabel.Content = dlg.SelectedPath;
 }
开发者ID:klyuchnikov,项目名称:UtilityFor4Sync,代码行数:7,代码来源:MainWindow.xaml.cs


示例12: 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


示例13: 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


示例14: btnNewBase_Click

 private void btnNewBase_Click(object sender, RoutedEventArgs e)
 {
     string path;
     var dialog = new System.Windows.Forms.FolderBrowserDialog();
     System.Windows.Forms.DialogResult result = dialog.ShowDialog();
     if (result.ToString() == "OK")
     {
         path = dialog.SelectedPath;
     }
     else
         path = null;
     if (path != null)
     {
         try
         {
             DataBaseConfig.CreateNewDB(path);
         }
         catch (Exception ex)
         {
             MessageBox.Show("Ошибка создания базы!\n\n" + ex.Message);
             return;
         }
         MessageBox.Show("База успешно создана и подключена!!");
     }
 }
开发者ID:Pitlis,项目名称:KUDIR,代码行数:25,代码来源:Administrator.xaml.cs


示例15: FolderBrowserEditor_Loaded

        private void FolderBrowserEditor_Loaded(object sender, RoutedEventArgs e)
        {
            FolderBrowserDialog folderBrowser;
            Popup parentPopup;

            Dictionary<string, string> settings;
            string setting;

            // Set up folder browser
            folderBrowser = new FolderBrowserDialog();
            folderBrowser.SelectedPath = GetCurrentParameterValue();

            // Parse folder browser parameters if they have been defined
            if ((object)m_connectionString != null)
            {
                settings = m_connectionString.ParseKeyValuePairs();

                if (settings.TryGetValue("description", out setting))
                    folderBrowser.Description = setting;

                if (settings.TryGetValue("showNewFolderButton", out setting))
                    folderBrowser.ShowNewFolderButton = setting.ParseBoolean();
            }

            // Show the browser and update the parameter
            if (folderBrowser.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                UpdateParameterValue(folderBrowser.SelectedPath);

            // Close the popup that contains this control
            parentPopup = GetParentPopup();

            if ((object)parentPopup != null)
                parentPopup.IsOpen = false;
        }
开发者ID:rmc00,项目名称:gsf,代码行数:34,代码来源:FolderBrowserEditor.xaml.cs


示例16: 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


示例17: 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:Korn1699,项目名称:MASGAU,代码行数:32,代码来源:NewWindow.cs


示例18: 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


示例19: ButtonBrowse_Click

 private void ButtonBrowse_Click(object sender, RoutedEventArgs e)
 {
     IntPtr mainWindowPtr = new System.Windows.Interop.WindowInteropHelper(this).Handle; // 'this' means WPF Window
     var folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
     if (folderBrowserDialog.ShowDialog(new OldWindow(mainWindowPtr)) == System.Windows.Forms.DialogResult.OK)
         FolderPath.Text = folderBrowserDialog.SelectedPath;
 }
开发者ID:atesio,项目名称:MyMusicTagger,代码行数:7,代码来源:MainWindow.xaml.cs


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forms.Form类代码示例发布时间:2022-05-24
下一篇:
C# Forms.FlowLayoutPanel类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap