public KeyBindingsDialog() : base("Keybindings", 50, 10) { if (ViewTracker.Instance == null) { ViewTracker.Initialize(); } // known commands that views can support commands = Enum.GetValues(typeof(Command)).Cast <Command>().ToArray(); commandsListView = new ListView(commands) { Width = Dim.Percent(50), Height = Dim.Percent(100) - 1, }; commandsListView.SelectedItemChanged += CommandsListView_SelectedItemChanged; Add(commandsListView); keyLabel = new Label() { Text = "Key: None", Width = Dim.Fill(), X = Pos.Percent(50), Y = 0 }; Add(keyLabel); var btnChange = new Button("Change") { X = Pos.Percent(50), Y = 1, }; Add(btnChange); btnChange.Clicked += RemapKey; var close = new Button("Ok"); close.Clicked += () => { Application.RequestStop(); ViewTracker.Instance.StartUsingNewKeyMap(CurrentBindings); }; AddButton(close); var cancel = new Button("Cancel"); cancel.Clicked += () => Application.RequestStop(); AddButton(cancel); }
internal static void Initialize() { Instance = new ViewTracker(Application.Top); }