public ListView GetClassListView <T>(Dictionary <string, string> displayItemList) { ListView classListView = null; if (displayItemList?.Keys.Count > 0) { classListView = new ListView(displayItemList.Values.ToList()) { X = 0, Y = 0, Width = Dim.Fill(0), Height = Dim.Fill(), // for status bar AllowsMarking = false, ColorScheme = Colors.TopLevel }; classListView.SelectedItemChanged += (args) => { try { SelectedItemIndex = classListView.SelectedItem; SelectedItem = _dataItemList.Values.ToArray()[SelectedItemIndex]; UpdateJsonView(SelectedItem.ToJson()); HostPane.Title = displayItemList.Keys.ToArray()[classListView.SelectedItem]; UpdateSettings <T>(SelectedItem); Top.BringSubviewToFront(StatusBar); } catch (Exception) { // eat // Troubleshooting: https://github.com/daltskin/SmartThingsTerminal/issues/8 } }; classListView.Enter += (args) => { DisableEditMode(); }; classListView.KeyDown += (args) => { if (!char.IsControl((char)args.KeyEvent.Key)) { SearchText += args.KeyEvent.ToString(); } if (SearchTimer == null) { SearchTimer = new System.Timers.Timer(500); SearchTimer.Elapsed += SearchTimer_Elapsed; } if (!SearchTimer.Enabled) { SearchTimer.Start(); } }; } ClassListView = classListView; return(classListView); }