Пример #1
0
        internal void RemoveArmy()
        {
            _armies.Remove(SelectedArmy);
            SelectedArmy = null;

            OnPropertyChanged(nameof(Armies));
        }
Пример #2
0
        internal void CopyArmy()
        {
            PlanArmy army = SelectedArmy.PlanArmy;

            army.PlanUnits.Clear();

            var armyItems = new List <PlanUnit>();

            foreach (PlanUnitViewModel armyItemVM in SelectedArmy.PlanUnits)
            {
                PlanUnit armyItem = armyItemVM.PlanUnit;

                armyItem.Options = armyItemVM.Options.Select(option => option.Option).ToList();

                army.PlanUnits.Add(armyItemVM.PlanUnit);
            }

            var copiedArmy = new PlanArmyViewModel()
            {
                PlanArmy = StaticHelper.DeepClone(army)
            };

            Armies.Add(copiedArmy);

            SelectedArmy = copiedArmy;
        }
Пример #3
0
        public void CreateNewArmy()
        {
            var newArmy = new PlanArmyViewModel()
            {
                PlanArmy = new PlanArmy()
            };

            Armies.Add(newArmy);

            SelectedArmy = newArmy;
        }