Merge pull request #815 from BDisp/filedialog-volume

Fixes #813. It's now possible choose the volume through the directory TextField.
This commit is contained in:
Charlie Kindel
2020-07-20 07:58:31 -06:00
committed by GitHub

View File

@@ -46,15 +46,21 @@ namespace Terminal.Gui {
internal void Reload ()
{
dirInfo = new DirectoryInfo (directory.ToString ());
infos = (from x in dirInfo.GetFileSystemInfos ()
where IsAllowed (x)
orderby (!x.Attributes.HasFlag (FileAttributes.Directory)) + x.Name
select (x.Name, x.Attributes.HasFlag (FileAttributes.Directory), false)).ToList ();
infos.Insert (0, ("..", true, false));
top = 0;
selected = 0;
SetNeedsDisplay ();
try {
dirInfo = new DirectoryInfo (directory.ToString ());
infos = (from x in dirInfo.GetFileSystemInfos ()
where IsAllowed (x)
orderby (!x.Attributes.HasFlag (FileAttributes.Directory)) + x.Name
select (x.Name, x.Attributes.HasFlag (FileAttributes.Directory), false)).ToList ();
infos.Insert (0, ("..", true, false));
top = 0;
selected = 0;
} catch (Exception) {
dirInfo = null;
infos.Clear ();
} finally {
SetNeedsDisplay ();
}
}
ustring directory;
@@ -454,7 +460,10 @@ namespace Terminal.Gui {
dirEntry = new TextField ("") {
X = Pos.Right (dirLabel),
Y = 1 + msgLines,
Width = Dim.Fill () - 1
Width = Dim.Fill () - 1,
TextChanged = (e) => {
DirectoryPath = dirEntry.Text;
}
};
Add (dirLabel, dirEntry);