ComboBox hand pick @BDisp changes:-

Test dir more robust "\Windows"
Use ListViewItemEventArgs
This commit is contained in:
Ross Ferguson
2020-07-03 05:22:00 +01:00
parent f722f96688
commit de5a30bb90
3 changed files with 6 additions and 6 deletions

View File

@@ -451,7 +451,7 @@ static class Demo {
static void ComboBoxDemo ()
{
List<ustring> items = new List<ustring> ();
foreach (var dir in new [] { "/etc", @"\windows\System32" }) {
foreach (var dir in new [] { "/etc", @$"{Environment.GetEnvironmentVariable ("SystemRoot")}\System32" }) {
if (Directory.Exists (dir)) {
items = Directory.GetFiles (dir).Union (Directory.GetDirectories (dir))
.Select (Path.GetFileName)
@@ -461,7 +461,7 @@ static class Demo {
}
var list = new ComboBox () { Width = Dim.Fill(), Height = Dim.Fill() };
list.SetSource(items.ToList());
list.SelectedItemChanged += (object sender, ustring text) => { Application.RequestStop (); };
list.SelectedItemChanged += (object sender, ListViewItemEventArgs text) => { Application.RequestStop (); };
var d = new Dialog () { Title = "Select source file", Width = Dim.Percent (50), Height = Dim.Percent (50) };
d.Add (list);