コード例 #1
0
        private void Populate(string?search = null)
        {
            _lastSearch = search;
            ComponentItemList.ClearSelected();
            ComponentItemList.Clear();
            AddButton.Disabled = true;

            foreach (var component in _components)
            {
                if (!string.IsNullOrEmpty(search) && !component.Contains(search, StringComparison.InvariantCultureIgnoreCase))
                {
                    continue;
                }

                ComponentItemList.AddItem(component);
            }
        }
コード例 #2
0
        private void OnAddButtonPressed(BaseButton.ButtonEventArgs obj)
        {
            var selected = ComponentItemList.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;
            }

            AddComponentButtonPressed?.Invoke(new AddComponentButtonPressedEventArgs(comp.Text));
        }
コード例 #3
0
 private void RefreshAddButton()
 {
     AddButton.Disabled = !ComponentItemList.GetSelected().Any();
 }