Fixed bug in scenario where hitting ENTER to start worker crashed listview

This commit is contained in:
Tig
2024-03-26 08:19:32 -06:00
parent 35d78fd985
commit 253fd2b7b2

View File

@@ -14,10 +14,11 @@ namespace UICatalog.Scenarios;
[ScenarioCategory ("Controls")]
public class BackgroundWorkerCollection : Scenario
{
public override void Init ()
public override void Main ()
{
Application.Run<OverlappedMain> ().Dispose ();
Application.Top?.Dispose ();
Application.Shutdown ();
#if DEBUG_IDISPOSABLE
if (Application.OverlappedChildren is { })
@@ -27,8 +28,6 @@ public class BackgroundWorkerCollection : Scenario
#endif
}
public override void Run () { }
private class OverlappedMain : Toplevel
{
private readonly MenuBar _menu;
@@ -257,6 +256,7 @@ public class BackgroundWorkerCollection : Scenario
{
Staging = staging;
_label.Text = "Work list:";
_listView.Enabled = true;
_listView.SetSource (list);
_start.Visible = false;
Id = "";
@@ -282,7 +282,7 @@ public class BackgroundWorkerCollection : Scenario
};
Add (_label);
_listView = new ListView { X = 0, Y = 2, Width = Dim.Fill (), Height = Dim.Fill (2) };
_listView = new ListView { X = 0, Y = 2, Width = Dim.Fill (), Height = Dim.Fill (2), Enabled = false };
Add (_listView);
_start = new Button { Text = "Start", IsDefault = true, ClearOnVisibleFalse = false };