Skip to content

Commit c689079

Browse files
author
tznind
committed
Fix MenuBar for new APIs, works for first level menus
1 parent ce8fb50 commit c689079

6 files changed

Lines changed: 54 additions & 1211 deletions

File tree

Showcase/Menus.Designer.cs

Lines changed: 31 additions & 197 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Showcase/Menus.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// You can make changes to this file and they will not be overwritten when saving.
88
// </auto-generated>
99
// -----------------------------------------------------------------------------
10-
namespace Showcase {
10+
namespace Showcase{
1111
using Terminal.Gui;
1212

1313

Showcase/Program.cs

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,15 @@
1-
using System.Collections.ObjectModel;
2-
using System.Runtime.InteropServices.ComTypes;
3-
using Terminal.Gui;
4-
using Terminal.Gui.App;
5-
using Terminal.Gui.Drivers;
6-
using Terminal.Gui.ViewBase;
7-
using Terminal.Gui.Views;
1+
using Terminal.Gui.App;
82

93
namespace Showcase
104
{
115
internal class Program
126
{
13-
private static Type[] views = new[]
14-
{
15-
typeof(Menus),
16-
typeof(Tabs)
17-
18-
};
197
static void Main(string[] args)
208
{
21-
Application.Init();
22-
23-
var w = new Window()
24-
{
25-
Title = "Showcase"
26-
};
27-
28-
var lv = new ListView()
29-
{
30-
Width = Dim.Fill(),
31-
Height = Dim.Fill(),
32-
};
33-
w.Add(lv);
34-
lv.SetSource(new ObservableCollection<Type>(views));
35-
36-
37-
lv.KeyDown += (_, e) =>
9+
using(var app = Application.Create())
3810
{
39-
if (e.KeyCode == KeyCode.Enter)
40-
{
41-
var v = (Toplevel)Activator.CreateInstance(views[lv.SelectedItem]);
42-
e.Handled = true;
43-
Application.Run(v);
44-
}
45-
};
46-
47-
Application.Run(w);
48-
Application.Shutdown();
11+
app.Run<Menus>();
12+
}
4913
}
5014
}
5115
}

0 commit comments

Comments
 (0)