private void Populate(string?search = null) { _lastSearch = search; EntryItemList.ClearSelected(); EntryItemList.Clear(); AddButton.Disabled = true; foreach (var component in _entries) { if (!string.IsNullOrEmpty(search) && !component.Contains(search, StringComparison.InvariantCultureIgnoreCase)) { continue; } EntryItemList.AddItem(component); } }
private void OnAddButtonPressed(BaseButton.ButtonEventArgs obj) { var selected = EntryItemList.GetSelected().ToArray(); // Nothing to do here! if (selected.Length == 0) { return; } var comp = selected[0]; // This shouldn't really happen. if (comp.Text == null) { return; } AddButtonPressed?.Invoke(new AddButtonPressedEventArgs(comp.Text)); }
private void RefreshAddButton() { AddButton.Disabled = !EntryItemList.GetSelected().Any(); }