예제 #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;
        }