private void FunctionOnClick()
        {
            if (thisModel.ChosenUnitEqualsSelected(SelectedUnit) && SelectedUnit != null)
            {
                Name              = SelectedUnit.Name;
                SelectedNation    = NationsList.Where(x => x.ID == SelectedUnit.NationID).FirstOrDefault();
                Type              = SelectedUnit.Type;
                Composition       = SelectedUnit.Composition;
                WeaponDescription = SelectedUnit.WeaponDescription;
                ArmourClass       = SelectedUnit.ArmourClass;
                Inexperienced     = SelectedUnit.Inexperienced;
                Regular           = SelectedUnit.Regular;
                Veteran           = SelectedUnit.Veteran;
                PointsInexp       = SelectedUnit.PointsInexp;
                PointsReg         = SelectedUnit.PointsReg;
                PointsVet         = SelectedUnit.PointsVet;
                BaseSize          = SelectedUnit.BaseSize;
                MaxSize           = SelectedUnit.MaxSize;

                thisModel.CheckActiveRules(SelectedUnit);
                thisModel.CheckActiveWeapons(SelectedUnit);

                ConfirmButtonText = "Update";
            }
        }
        private void ConfirmChanges()
        {
            ObservableCollection <GameRule> SelectedRulesList   = new ObservableCollection <GameRule>(RulesList.Where(w => (w.IsSelected == true)));
            ObservableCollection <Weapon>   SelectedWeaponsList = new ObservableCollection <Weapon>(WeaponsList.Where(w => (w.IsSelected == true)));
            int SelectedNationID = (SelectedNation != null) ? SelectedNation.ID : 0;

            thisModel.ConfirmChanges(Name, SelectedNationID, Type, Composition, WeaponDescription, ArmourClass, Inexperienced, Regular, Veteran, PointsInexp, PointsReg, PointsVet, BaseSize, MaxSize, SelectedUnit, UnitsList, SelectedRulesList, SelectedWeaponsList);
            if (SelectedUnit != null)
            {
                Name              = SelectedUnit.Name;
                SelectedNation    = NationsList.Where(x => x.ID == SelectedUnit.NationID).FirstOrDefault();
                Type              = SelectedUnit.Type;
                Composition       = SelectedUnit.Composition;
                WeaponDescription = SelectedUnit.WeaponDescription;
                ArmourClass       = SelectedUnit.ArmourClass;
                Inexperienced     = SelectedUnit.Inexperienced;
                Regular           = SelectedUnit.Regular;
                Veteran           = SelectedUnit.Veteran;
                PointsInexp       = SelectedUnit.PointsInexp;
                PointsReg         = SelectedUnit.PointsReg;
                PointsVet         = SelectedUnit.PointsVet;
                BaseSize          = SelectedUnit.BaseSize;
                MaxSize           = SelectedUnit.MaxSize;
            }
            else
            {
                PrepareToAddNew();
            }
        }
Beispiel #3
0
 private void PrepareToAddNew()
 {
     Year                = null;
     SelectedNation      = null;
     SelectorName        = null;
     MandatoryEntries    = null;
     HeadquaetersEntries = null;
     InfantryEntries     = null;
     ArtilleryEntries    = null;
     ArmouredCarsEntries = null;
     TanksEntries        = null;
     TransportsEntries   = null;
     SelectedSelector    = null;
     NationsList.Clear();
     SelectorsList.Clear();
     RulesList.Clear();
     thisModel.EmptySelector.ResetData();
     FunctionOnLoad();
 }