mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 08:50:25 +01:00
ComboBox hand pick @BDisp changes:-
Test dir more robust "\Windows" Use ListViewItemEventArgs
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user