Skip to content
This repository was archived by the owner on Aug 23, 2025. It is now read-only.

Commit 9a99224

Browse files
committed
Use the stock FolderBrowserDialog with .NET Core
1 parent c4473af commit 9a99224

File tree

3 files changed

+62
-2
lines changed

3 files changed

+62
-2
lines changed

86BoxManager/FolderSelectDialog.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System;
1+
#if !NETCOREAPP
2+
using System;
23
using System.Reflection;
34
using System.Windows.Forms;
45

@@ -107,4 +108,5 @@ private class WindowWrapper : IWin32Window
107108
public IntPtr Handle { get { return _handle; } }
108109
}
109110
}
110-
}
111+
}
112+
#endif

86BoxManager/dlgAddVM.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,23 @@ private void txtName_TextChanged(object sender, EventArgs e)
7474
}
7575
}
7676

77+
#if NETCOREAPP
78+
private void btnBrowse_Click(object sender, EventArgs e)
79+
{
80+
FolderBrowserDialog dialog = new FolderBrowserDialog
81+
{
82+
RootFolder = Environment.SpecialFolder.MyComputer,
83+
Description = "Select a folder where your virtual machines (configs, nvr folders, etc.) will be located",
84+
UseDescriptionForTitle = true
85+
};
86+
87+
if (dialog.ShowDialog() == DialogResult.OK)
88+
{
89+
txtImportPath.Text = dialog.SelectedPath;
90+
txtName.Text = Path.GetFileName(dialog.SelectedPath);
91+
}
92+
}
93+
#else
7794
private void btnBrowse_Click(object sender, EventArgs e)
7895
{
7996
FolderSelectDialog dialog = new FolderSelectDialog
@@ -88,6 +105,7 @@ private void btnBrowse_Click(object sender, EventArgs e)
88105
txtName.Text = Path.GetFileName(dialog.FileName);
89106
}
90107
}
108+
#endif
91109

92110
private void cbxImport_CheckedChanged(object sender, EventArgs e)
93111
{

86BoxManager/dlgSettings.cs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,45 @@ private void LoadSettings()
235235
}
236236
}
237237

238+
#if NETCOREAPP
239+
private void btnBrowse1_Click(object sender, EventArgs e)
240+
{
241+
FolderBrowserDialog dialog = new FolderBrowserDialog
242+
{
243+
RootFolder = Environment.SpecialFolder.MyComputer,
244+
Description = "Select a folder where 86Box program files and the roms folder are located",
245+
UseDescriptionForTitle = true
246+
};
247+
248+
if (dialog.ShowDialog() == DialogResult.OK)
249+
{
250+
txtEXEdir.Text = dialog.SelectedPath;
251+
if (!txtEXEdir.Text.EndsWith(@"\")) //Just in case
252+
{
253+
txtEXEdir.Text += @"\";
254+
}
255+
}
256+
}
257+
258+
private void btnBrowse2_Click(object sender, EventArgs e)
259+
{
260+
FolderBrowserDialog dialog = new FolderBrowserDialog
261+
{
262+
RootFolder = Environment.SpecialFolder.MyComputer,
263+
Description = "Select a folder where your virtual machines (configs, nvr folders, etc.) will be located",
264+
UseDescriptionForTitle = true
265+
};
266+
267+
if (dialog.ShowDialog() == DialogResult.OK)
268+
{
269+
txtCFGdir.Text = dialog.SelectedPath;
270+
if (!txtCFGdir.Text.EndsWith(@"\")) //Just in case
271+
{
272+
txtCFGdir.Text += @"\";
273+
}
274+
}
275+
}
276+
#else
238277
private void btnBrowse1_Click(object sender, EventArgs e)
239278
{
240279
FolderSelectDialog dialog = new FolderSelectDialog
@@ -270,6 +309,7 @@ private void btnBrowse2_Click(object sender, EventArgs e)
270309
}
271310
}
272311
}
312+
#endif
273313

274314
private void btnDefaults_Click(object sender, EventArgs e)
275315
{

0 commit comments

Comments
 (0)