Пример #1
0
        private void txtAmount_TextChanged(object sender, EventArgs e)
        {
            if (_selectedIndex == -1 || _selectedIndex > _affects.Count || lstModifiers.SelectedIndex == -1 ||
                lstModifiers.SelectedIndex >= lstModifiers.Items.Count)
            {
                return;
            }

            AffectApplyType apply = lstModifiers.Items[lstModifiers.SelectedIndex] as AffectApplyType;

            if (apply != null)
            {
                int val;
                if (Int32.TryParse(txtAmount.Text, out val))
                {
                    apply.Amount = val;
                    lstModifiers.Items[lstModifiers.SelectedIndex] = apply;
                }
            }
        }
Пример #2
0
        private void cbApplyType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (_selectedIndex == -1 || _selectedIndex > _affects.Count || lstModifiers.SelectedIndex == -1 ||
                lstModifiers.SelectedIndex >= lstModifiers.Items.Count)
            {
                return;
            }

            if (cbApplyType.SelectedIndex != -1)
            {
                AffectApplyType apply = lstModifiers.Items[lstModifiers.SelectedIndex] as AffectApplyType;
                if (apply != null)
                {
                    apply.Location = (Affect.Apply)Enum.Parse(typeof(Affect.Apply), cbApplyType.Text);
                    lstModifiers.Items[lstModifiers.SelectedIndex] = apply;
                }
            }

            // TODO: Replace selected item data in list box with new item data.
        }