本文整理汇总了C#中System.Windows.Forms.FolderBrowserDialog.ShowDialog方法的典型用法代码示例。如果您正苦于以下问题:C# FolderBrowserDialog.ShowDialog方法的具体用法?C# FolderBrowserDialog.ShowDialog怎么用?C# FolderBrowserDialog.ShowDialog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.FolderBrowserDialog
的用法示例。
在下文中一共展示了FolderBrowserDialog.ShowDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnChooseDir_Click
private void btnChooseDir_Click(object sender, RoutedEventArgs e)
{
var dialog = new FolderBrowserDialog();
dialog.ShowDialog();
if (dialog.SelectedPath.IsNullOrEmpty()) return;
MainData.Path = dialog.SelectedPath;
}
示例2: btnBrowser_Click
private void btnBrowser_Click(object sender, EventArgs e)
{
FolderBrowserDialog path = new FolderBrowserDialog();
//path.RootFolder = Environment.SpecialFolder.;
path.ShowDialog();
txtFrom.Text = path.SelectedPath;
}
示例3: btnBrowseDir_Click
private void btnBrowseDir_Click(object sender, RoutedEventArgs e) {
var dialog = new FolderBrowserDialog {
Description = "Select the directory containing PCSX2"
};
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
tbPcsx2Dir.Text = dialog.SelectedPath;
}
示例4: button10_Click
private void button10_Click(object sender, EventArgs e)
{
FolderBrowserDialog dlg = new FolderBrowserDialog();
dlg.SelectedPath = Application.StartupPath + "\\Output";
dlg.ShowDialog();
textBox8.Text = dlg.SelectedPath;
}
示例5: BrowseButtonOnClick
private void BrowseButtonOnClick(object sender, EventArgs eventArgs)
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
if (fbd.ShowDialog() == DialogResult.OK){
textBox1.Text = fbd.SelectedPath;
}
}
示例6: btnInputFolder_Click
private void btnInputFolder_Click(object sender, RoutedEventArgs e)
{
var fbd = new FolderBrowserDialog
{
SelectedPath =
Directory.Exists(txtInputFolder.Text)
? txtInputFolder.Text
: VariousFunctions.GetApplicationLocation()
};
if (fbd.ShowDialog() != DialogResult.OK) return;
SelectedPlugins.Clear();
txtInputFolder.Text = fbd.SelectedPath;
var di = new DirectoryInfo(txtInputFolder.Text);
FileInfo[] fis = di.GetFiles();
foreach (
FileInfo fi in
fis.Where(
fi =>
(fi.Name.EndsWith(".asc") || fi.Name.EndsWith(".alt") || fi.Name.EndsWith(".ent") || fi.Name.EndsWith(".xml")) &&
Path.GetFileNameWithoutExtension(fi.Name).Length == 4))
{
SelectedPlugins.Add(new PluginEntry
{
IsSelected = true,
LocalMapPath = fi.FullName,
PluginClassMagic = fi.Name.Remove(fi.Name.Length - 3)
});
}
}
示例7: cmdBatch_Click
private void cmdBatch_Click(object sender, EventArgs e)
{
try
{
FolderBrowserDialog dlgFolder = new FolderBrowserDialog();
dlgFolder.Description = "Batch files all image files from this folder.";
if (dlgFolder.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
DirectoryInfo dirInfo = new DirectoryInfo(dlgFolder.SelectedPath.ToString());
FileInfo[] ImageFiles = dirInfo.GetFiles("*.jpg").Concat(dirInfo.GetFiles("*.jpeg")).Concat(dirInfo.GetFiles("*.png")).ToArray();
for (int i = 0; i < ImageFiles.Length; ++i)
{
FileInfo ImageFile = ImageFiles[i];
Bitmap ImageBitmap = new Bitmap(ImageFile.FullName);
ProcessImage(ImageBitmap);
}
MessageBox.Show("Image Files Process Completed", "Process Completed", MessageBoxButtons.OK);
}
}
catch (Exception ex)
{
LogException(ex);
}
}
示例8: btnPackInputBrowse_Click
private void btnPackInputBrowse_Click(object sender, System.EventArgs e)
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
tbPackInput.Text = fbd.SelectedPath;
}
示例9: Execute
public void Execute(IMenuCommand command)
{
IDiagram diagram = this.DiagramContext.CurrentDiagram;
IModelStore modelStore = diagram.ModelStore;
string SqlFile = @"C:\MyLoStore\MyLoStorePostgres.sql";
string PythonFile = @"C:\MyLoStore\MyLoStore.py";
FolderBrowserDialog openFolderDialog1 = new FolderBrowserDialog();
openFolderDialog1.RootFolder = Environment.SpecialFolder.MyComputer;
openFolderDialog1.Description =
"Select the directory that you want to use for generated output";
if (openFolderDialog1.ShowDialog() == DialogResult.OK)
{
string folderName = openFolderDialog1.SelectedPath;
SqlFile = folderName + @"\MyLoStorePostgres.sql";
PythonFile = folderName + @"\MyLoStore.py";
using (StreamWriter fsSql = new StreamWriter(SqlFile, false))
{
using (StreamWriter fsPy = new StreamWriter(PythonFile, false))
{
SQLWriter mySql = new SQLWriter(SQLGenerateRun.Postgres);
PythonClassWriter py = new PythonClassWriter();
SQLGenerator sqlGen = new SQLGenerator(fsSql, mySql, fsPy, py, modelStore);
sqlGen.GenerateMySQL();
}
}
}
}
示例10: btnExport_Click
private void btnExport_Click(object sender, EventArgs e)
{
FolderBrowserDialog fbd = new FolderBrowserDialog();
DialogResult result = fbd.ShowDialog();
if (result == DialogResult.Cancel) {
//do nothing, cancel was clicked
} else if (fbd.SelectedPath != null) {
if (Directory.GetFiles(fbd.SelectedPath).Length == 0) {
int count = 0;
foreach (ListViewItem item in lvExport.Items) {
try {
string source = item.ImageKey + @"\" + item.SubItems[3].Text + ".jpg";
string destination = fbd.SelectedPath + @"\"
+ item.SubItems[1].Text + "-" //firstname
+ item.Text + "-" //last name
+ item.SubItems[2].Text + "-" //grade
+ item.SubItems[3].Text //ID
+ ".jpg";
File.Copy(source, destination);
count++;
} catch (Exception) {
//skip that one, probably an IOException due to file exists already
//HOWEVER, 2013-14 missed 1 file
}
}
MessageBox.Show("Copied " + count + " picture" + (count == 1 ? "." : "s."));
} else {
string error = "Files exist in the folder you selected.\n\nPlease create or select an empty folder and try again.";
string caption = "Choose an Empty Folder";
MessageBox.Show(error, caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
示例11: BrowseClick
private void BrowseClick(object sender, EventArgs e)
{
var browseDialog = new FolderBrowserDialog();
if (browseDialog.ShowDialog() == DialogResult.OK)
Directory.Text = browseDialog.SelectedPath;
}
示例12: BtnExportAll_Click
private void BtnExportAll_Click(object sender, System.EventArgs e)
{
using (FolderBrowserDialog browserDlg = new FolderBrowserDialog())
{
browserDlg.Description = "Export all files";
if (browserDlg.ShowDialog() == DialogResult.OK)
{
foreach (OContainer.fileEntry file in container.content)
{
string fileName = Path.Combine(browserDlg.SelectedPath, file.name);
string dir = Path.GetDirectoryName(fileName);
if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
if (file.loadFromDisk)
{
byte[] buffer = new byte[file.fileLength];
container.data.Seek(file.fileOffset, SeekOrigin.Begin);
container.data.Read(buffer, 0, buffer.Length);
File.WriteAllBytes(fileName, buffer);
}
else
File.WriteAllBytes(fileName, file.data);
}
}
}
}
示例13: FolderStore_Click
private void FolderStore_Click(object sender, RoutedEventArgs e)
{
FolderBrowserDialog FolderDialog = new FolderBrowserDialog();
FolderDialog.ShowDialog();
FolderSave = FolderDialog.SelectedPath;
}
示例14: OpenFolderDialog
public List<string> OpenFolderDialog(DataSet dataSet, string contractNbr)
{
List<string> returnPaths = new List<string>();
List<string> listOfSuppliers = UniqueSupplierInDataSet(dataSet);
FolderBrowserDialog fbd = new FolderBrowserDialog();
fbd.Description = String.Format("Välj mapp för avtal\nAvtalsnr: {0}", contractNbr);
if(fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK){
returnPaths.Add(fbd.SelectedPath);
}
foreach (string supplierNbr in listOfSuppliers)
{
Leverantör supplier = db.GetSupplier(supplierNbr);
if (supplier != null)
{
fbd.Description = String.Format("Välj mapp för leverantörsavtal\nLevnr: {0}\nLevnamn: {1}", supplier.Leverantörnr, supplier.Leverantörsnamn);
}
else
{
fbd.Description = String.Format("Välj mapp för leverantörsavtal\nLevnr: {0}\nLevnamn: {1}", supplierNbr, "{namn saknas}");
}
if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
returnPaths.Add(fbd.SelectedPath);
}
}
return returnPaths;
}
示例15: button1_Click
private void button1_Click(object sender, EventArgs e)
{
FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();
folderBrowserDialog1.ShowDialog();
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
textBox1.Text = folderBrowserDialog1.SelectedPath;
}