public void MakeSelection(int id)
 {
     if (OnItemSelected != null)
     {
         OnItemSelected.Invoke(id);
     }
 }
Example #2
0
 void OnWeaponSlot(object value)
 {
     SelectedItemIndex = -1;
     SelectedItemData  = PW.WeaponData;
     OnItemSelected?.Invoke(-1);
     RefreshInfo();
 }
        /// <summary>
        ///     Populates the list of products that will actually be shown, using the current filters.
        /// </summary>
        public void PopulateProducts()
        {
            Products.RemoveAllChildren();

            var search = _searchBar.Text.Trim().ToLowerInvariant();

            foreach (var prototype in Owner.Market.Products)
            {
                // if no search or category
                // else if search
                // else if category and not search
                if ((search.Length == 0 && _category == null) ||
                    (search.Length != 0 && prototype.Name.ToLowerInvariant().Contains(search)) ||
                    (search.Length == 0 && _category != null && prototype.Category.Equals(_category)))
                {
                    var button = new CargoProductRow();
                    button.Product               = prototype;
                    button.ProductName.Text      = prototype.Name;
                    button.PointCost.Text        = prototype.PointCost.ToString();
                    button.Icon.Texture          = prototype.Icon.Frame0();
                    button.MainButton.OnPressed += (args) =>
                    {
                        OnItemSelected?.Invoke(args);
                    };
                    Products.AddChild(button);
                }
            }
        }
Example #4
0
 public void MakeSelection(ClickMenuItem item)
 {
     if (OnItemSelected != null)
     {
         OnItemSelected.Invoke(item);
     }
 }
Example #5
0
        /// <summary>
        /// Set the selected radio button index in child.
        /// </summary>
        /// <param name="index">send the message with index.</param>
        /// <param name="val">Value if true or false.</param>
        /// <param name="currentSelectedButton"> action for callback.</param>
        public void SetCurrentButtonSelected(int index, bool val, Action currentSelectedButton)
        {
            if (this.j_CurrentSelectedButton != null)
            {
                this.j_CurrentSelectedButton.Invoke();
                for (int i = 0; i < onItemDeselected.GetPersistentEventCount(); i++)
                {
                    ((MonoBehaviour)onItemDeselected.GetPersistentTarget(i)).SendMessage(onItemDeselected.GetPersistentMethodName(i), j_CurrentSelectedIndex);
                }
                OnItemDeselected?.Invoke(j_CurrentSelectedIndex);
                j_RadioButtons[j_CurrentSelectedIndex].SetDynamicValueChange(false);
            }

            this.j_CurrentSelectedButton = currentSelectedButton;
            j_CurrentSelectedIndex       = index;
            if (this.j_CurrentSelectedButton != null)
            {
                for (int i = 0; i < onItemSelected.GetPersistentEventCount(); i++)
                {
                    ((MonoBehaviour)onItemSelected.GetPersistentTarget(i)).SendMessage(onItemSelected.GetPersistentMethodName(i), j_CurrentSelectedIndex);
                }
                OnItemSelected?.Invoke(j_CurrentSelectedIndex);
            }
            j_RadioButtons[index].SetDynamicValueChange(val);
        }
        private async Task GetData()
        {
            SantaTeclaService sevice = new SantaTeclaService();

            if (_quien == 0)
            {
                ListPacientes.ItemsSource = await sevice.GetPacientes();
            }
            else
            {
                ListPacientes.ItemsSource = await sevice.GetPersonal();
            }
            Ok.Click += (sender, args) =>
            {
                if (ListPacientes.SelectedItem != null)
                {
                    OnItemSelected?.Invoke(this, new ItemSelectedEventArgs
                    {
                        Objecto = ListPacientes.SelectedItem
                    });
                    this.Close();
                }
                else
                {
                    Xceed.Wpf.Toolkit.MessageBox.Show("Selecciones una opcion", "Informacion de ayuda", MessageBoxButton.OK,
                                                      MessageBoxImage.Stop);
                }
            };
        }
Example #7
0
 protected override void ItemSelected(AdvancedDropdownItem item)
 {
     base.ItemSelected(item);
     if (item is AdvancedTypePopupItem typePopupItem)
     {
         OnItemSelected?.Invoke(typePopupItem);
     }
 }
Example #8
0
        private void initButtonListener(Transform buttonTransform)
        {
            int index = buttonTransform.GetComponent <ElementIndexer>().StaticIndex;

            if (mStaticSlotItemMapping.TryGetValue(index, out ItemView view))
            {
                OnItemSelected?.Invoke(view.ItemId);
            }
        }
Example #9
0
        public void CheckItemSelection()
        {
            var selected = CompletionListBox.SelectedItem as WordCompletion;

            if (selected != null && OnItemSelected != null)
            {
                OnItemSelected.Invoke(selected.ToString());
            }
        }
        public void SelectItem(T item)
        {
            T previousItem = Item;

            Item = item;
            UpdateSelectedItem();
            UpdateItems();
            OnItemSelected?.Invoke(previousItem, item, Group.Items.Values.IndexOf(item));
        }
        public void SelectItem(T item, int index)
        {
            T previousItem = Item;

            Item = item;
            UpdateSelectedItem();
            UpdateItems();
            OnItemSelected?.Invoke(previousItem, item, index);
        }
Example #12
0
 private void SelectItem(ICustomListItem item)
 {
     if (CurrentSelectedItem == item)
     {
         return;
     }
     CurrentSelectedItem = item;
     OnItemSelected?.Invoke(item);
 }
Example #13
0
        /// <summary>
        /// Invoked when the user selects a completion option.
        /// Removes the intellisense popup, and displays the method completion popup
        /// if the selected item is a method.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="args">Event Arguments.</param>
        private void ContextItemSelected(object sender, NeedContextItemsArgs.ContextItem args)
        {
            IntellisenseItemSelectedArgs itemSelectedArgs = new IntellisenseItemSelectedArgs()
            {
                TriggerWord  = triggerWord,
                ItemSelected = args.Name + (args.IsMethod ? "(" : ""),
                IsMethod     = args.IsMethod
            };

            OnItemSelected?.Invoke(this, itemSelectedArgs);
        }
Example #14
0
    //////////////
    public void OnPointerClick(PointerEventData eventData)
    {
        OnItemSelected?.Invoke(m_Item);

        if (m_Item == null)
        {
            return;
        }

        m_EquipButton.gameObject.SetActive(!m_EquipButton.gameObject.activeSelf);
    }
 private void PlaylistSelected(object sender, SelectionChangedEventArgs e)
 {
     if (e.AddedItems.Count > 0)
     {
         var flyout = (Windows.UI.Xaml.Controls.FlyoutPresenter) this.Parent;
         OnItemSelected.Invoke(flyout, new PlaylistSelectedEventArgs()
         {
             SelectedPlaylist = (ViewPlaylistMetadata)e.AddedItems[0]
         });
     }
 }
        protected void HandleSelect(int index)
        {
            if (selectedIndex != -1 && selectedIndex != index)
            {
                transform.GetChild(selectedIndex).GetComponent <IListEntry>().Deselect();
            }
            int oldIndex = index;

            selectedIndex = index;
            SubHandleSelect(oldIndex);
            OnItemSelected?.Invoke(oldIndex);
        }
Example #17
0
        protected internal override void MouseDown(GUIMouseButtonEventArgs args)
        {
            base.MouseDown(args);

            var item = _tryFindItemAtPosition(args.RelativePosition);

            if (item != null && item.Selectable)
            {
                _selectedIndex = item.Index;
                OnItemSelected?.Invoke();
            }
        }
Example #18
0
        private void ItemSelected(TableView _, int row)
        {
            var obj = _listObjects[row];

            if (obj is ListDirectory dir)
            {
                OnCategorySelected?.Invoke(dir.ListName);
                return;
            }

            _currentIdx = row;
            OnItemSelected?.Invoke(obj);
        }
Example #19
0
 private void ItemRow_OnSelected(UCEItemRow itemRow)
 {
     if (itemRow.Selected)
     {
         SelectedItemRow?.Deselect();
         SelectedItemRow = itemRow;
         OnItemSelected?.Invoke(itemRow);
     }
     else
     {
         SelectedItemRow = null;
         OnItemSelected?.Invoke(null);
     }
 }
Example #20
0
        private void ButtonAddClicked(object sender, RoutedEventArgs e)
        {
            if (!ElementButtonEnabled)
            {
                return;
            }

            OnAddButtonClick?.Invoke(this, e);

            if (InputText.Length > 0)
            {
                OnItemSelected?.Invoke(this, InputText);
            }
        }
Example #21
0
        private void ButtonOnPressed(ButtonEventArgs obj)
        {
            obj.Button.Pressed = false;
            _popup.Visible     = false;
            foreach (var buttonData in _buttonData)
            {
                if (buttonData.Button == obj.Button)
                {
                    OnItemSelected?.Invoke(new ItemSelectedEventArgs(buttonData.Id, this));
                    return;
                }
            }

            // Not reachable.
            throw new InvalidOperationException();
        }
Example #22
0
        protected internal override void KeyBindDown(GUIBoundKeyEventArgs args)
        {
            base.KeyBindDown(args);

            if (!args.CanFocus)
            {
                return;
            }

            var item = _tryFindItemAtPosition(args.RelativePosition);

            if (item != null && item.Selectable)
            {
                _selectedIndex = item.Index;
                OnItemSelected?.Invoke();
            }
        }
Example #23
0
        private void CollectionView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var collectionView = sender as CollectionView;

            collectionView.SelectionChanged -= CollectionView_SelectionChanged;
            var footerButton = collectionView.SelectedItem as FooterButton;

            if (footerButton != null && footerButton.IsEnable)
            {
                OnItemSelected?.Invoke(footerButton.Name);
            }
            //App.Current.Dispatcher.BeginInvokeOnMainThread(() =>
            //{
            //    collectionView.SelectedItem = null;
            //    collectionView.SelectionChanged += CollectionView_SelectionChanged;
            //});
        }
Example #24
0
    void OnItemSelect(object value)
    {
        var i = (int)value;

        if (SwapMode)
        {
            StopSwap();
            IC.SwapItem(SelectedItemIndex, i);
        }
        SelectedItemData = IC.GetItemInfo(i);

        SelectedItemIndex = i;

        OnItemSelected?.Invoke(i);

        RefreshInfo();
    }
Example #25
0
        private void ComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (comboBox.SelectedIndex != -1)
            {
                string item = comboBox.SelectedItem as string;
                comboBox.SelectedIndex = -1;
                if (!string.IsNullOrEmpty(item))
                {
                    OnItemSelected?.Invoke(this, item);

                    if (AddOnSelection)
                    {
                        txt_Item.Text = item;
                    }
                }
            }
        }
Example #26
0
        public void Select(int idx, bool single = true)
        {
            if (single)
            {
                for (var jdx = 0; jdx < _itemList.Count; jdx++)
                {
                    Unselect(jdx);
                }
            }

            var i = _itemList[idx];

            if (i.Selectable)
            {
                i.Selected = true;
                OnItemSelected?.Invoke(new ItemListSelectedEventArgs(idx, this));
            }
        }
Example #27
0
        protected internal override void KeyBindDown(GUIBoundKeyEventArgs args)
        {
            base.KeyBindDown(args);

            if (args.Function != EngineKeyFunctions.UIClick)
            {
                return;
            }

            var item = _tryFindItemAtPosition(args.RelativePosition);

            if (item != null && item.Selectable)
            {
                _selectedIndex = item.Index;
                OnItemSelected?.Invoke();
                args.Handle();
            }
        }
Example #28
0
        private void ButtonActorBase_OnClick(object sender, RoutedEventArgs e)
        {
            var btn = sender as Button;

            if (btn == null)
            {
                return;
            }
            ActorModel data = btn.DataContext as ActorModel;

            if (data != null)
            {
                TopDataModel model = new TopDataModel();
                model.ImgaeUrl      = data.FrontIcon;
                model.SourceId      = data.Id;
                model.SourceType    = "艺人";
                model.SourceTypeInt = 1;
                model.Title         = data.ActorName;
                OnItemSelected?.Invoke(null, model);
            }
        }
        /// <summary>
        /// Set the selected checkbox button.
        /// </summary>
        /// <param name="index"> int index of selected checkbox.</param>
        /// <param name="val">value of selected checkbox.</param>
        public void SetCurrentButtonSelected(int index, bool val)
        {
            j_CurrentSelectedIndex = index;

            if (val)
            {
                for (int i = 0; i < onItemSelected.GetPersistentEventCount(); i++)
                {
                    ((MonoBehaviour)onItemSelected.GetPersistentTarget(i)).SendMessage(onItemSelected.GetPersistentMethodName(i), j_CurrentSelectedIndex);
                }
                OnItemSelected?.Invoke(j_CurrentSelectedIndex);
            }
            else
            {
                for (int i = 0; i < onItemDeselected.GetPersistentEventCount(); i++)
                {
                    ((MonoBehaviour)onItemDeselected.GetPersistentTarget(i)).SendMessage(onItemDeselected.GetPersistentMethodName(i), j_CurrentSelectedIndex);
                }
                OnItemDeselected?.Invoke(j_CurrentSelectedIndex);
            }
            j_CheckboxButtons[index].SetDynamicValueChange(val);
        }
Example #30
0
        public void SendOnItemSelected(int position)
        {
            if (ItemSelectedPosition != position)
            {
                ItemSelectedPosition = position;
            }

            ChangeSelectionValue(position);

            var paramete = new IntegerEventArgs(position);

            OnItemSelected?.Invoke(this, paramete);
            if (OnItemSelectedCommand != null)
            {
                OnItemSelectedCommand.Execute(paramete);
            }

            if (IsAllowMultiSelect)
            {
                SendOnMultiItemSelected(GetItemPositionSelected());
            }
        }