Exemplo n.º 1
0
 private void ActionSelectorSkills_Click(object sender, EventArgs e)
 {
     using (SingleSelectorEditorForm actionSelectorForm = new SingleSelectorEditorForm(SelectorTypes.ActionsCustom, Unit.SkillsIds))
     {
         actionSelectorForm.Text = "Выберите навык";
         if (actionSelectorForm.ShowDialog() == DialogResult.OK)
         {
             actionSelectorSkills.Set(_repWkr.GetAction(actionSelectorForm.SelectedId));
             SetCurrentAction(actionSelectorForm.SelectedId);
         }
     }
 }
Exemplo n.º 2
0
        public SingleSelectorEditorForm(SelectorTypes selectorType, int[] ids)
        {
            InitializeComponent();
            if (ids == null || ids.Length == 0)
            {
                return;
            }
            _repWkr = RepositoryWorker.Instance();
            ItemSelector item;

            flp_items.Controls.Clear();
            switch (selectorType)
            {
            case SelectorTypes.ActionsCustom:
                for (int i = 0; i < ids.Length; i++)
                {
                    var act = _repWkr.GetAction(ids[i]);
                    item        = new ItemSelector(act.Id, act.Icon, act.Name);
                    item.Click += Item_Click;
                    flp_items.Controls.Add(item);
                }
                break;

            default:
                break;
            }
            item = null;
        }