26 lines
560 B
C#
26 lines
560 B
C#
using System.Windows;
|
|
using Microsoft.Win32;
|
|
|
|
namespace Explorer.App.Settings;
|
|
|
|
internal static class SettingsPathBrowse
|
|
{
|
|
public static bool TryPick(Window? owner, string title, string filter, string? current, out string path)
|
|
{
|
|
var dlg = new OpenFileDialog
|
|
{
|
|
Title = title,
|
|
Filter = filter,
|
|
FileName = current ?? ""
|
|
};
|
|
if (dlg.ShowDialog(owner) == true)
|
|
{
|
|
path = dlg.FileName;
|
|
return true;
|
|
}
|
|
|
|
path = "";
|
|
return false;
|
|
}
|
|
}
|