mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-02 01:03:29 +01:00
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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user