예제 #1
0
        private void ConfirmChanges()
        {
            int WeaponID = (SelectedPossibleWeapon != null) ? SelectedPossibleWeapon.ID : 0;
            int RuleID   = (SelectedPossibleRule != null) ? SelectedPossibleRule.ID : 0;

            thisModel.ConfirmChanges(Description, Count, Cost, WeaponID, RuleID, UnitID, SelectedOption, OptionsList);
            if (SelectedOption != null)
            {
                if (SelectedOption.WeaponID != 0)
                {
                    SelectedPossibleWeapon = PossibleWeaponsList.Where(x => x.ID == SelectedOption.WeaponID).FirstOrDefault();
                }
                if (SelectedOption.RuleID != 0)
                {
                    SelectedPossibleRule = PossibleRulesList.Where(x => x.ID == SelectedOption.RuleID).FirstOrDefault();
                }
                Description = SelectedOption.Description;
                Cost        = SelectedOption.Cost;
                Count       = SelectedOption.Count;
            }
            else
            {
                PrepareToAddNew();
            }
        }
예제 #2
0
        private void FunctionOnClick()
        {
            if (thisModel.ChosenEqualsSelected(SelectedOption) && SelectedOption != null)
            {
                Description = SelectedOption.Description;
                Cost        = SelectedOption.Cost;
                Count       = SelectedOption.Count;

                if (SelectedOption.WeaponID != 0)
                {
                    SelectedPossibleWeapon = PossibleWeaponsList.Where(x => x.ID == SelectedOption.WeaponID).FirstOrDefault();
                }
                else if (SelectedOption.RuleID != 0)
                {
                    SelectedPossibleRule = PossibleRulesList.Where(x => x.ID == SelectedOption.RuleID).FirstOrDefault();
                }
                else
                {
                    SelectedAddition = null;
                }

                ConfirmButtonText = "Update";
            }
        }