예제 #1
0
        private void ExecuteBoundToResidentEventHandler(object obj)
        {
            var tuple = (Tuple <object, object>)obj;

            if (!(tuple.Item2 is BoundToResidentEventArgs e))
            {
                return;
            }

            e.Handled = true;

            if (e.Action == "Increase")
            {
                SoldierModel soldierModel = e.SoldierModel;

                soldierModel.Id = _armyService.GetPeopleId(Index);

                if (soldierModel.Position == "KnightTemplars")
                {
                    soldierModel.Position = "Tempelriddare";
                    DataModel.TemplarKnightsList.Add(soldierModel);
                }
                else if (soldierModel.Position == "Knights")
                {
                    soldierModel.Position = "Riddare";
                    DataModel.KnightsList.Add(soldierModel);
                }
                else if (soldierModel.Position == "CavalryTemplarKnights")
                {
                    soldierModel.Position = "Tempelriddare";
                    DataModel.CavalryTemplarKnightsList.Add(soldierModel);
                }
                else if (soldierModel.Position == "OfficerCorporals")
                {
                    soldierModel.Position = "Korpral";
                    DataModel.OfficerCorporalsList.Add(soldierModel);
                }
                else if (soldierModel.Position == "OfficerSergeants")
                {
                    soldierModel.Position = "Sergeant";
                    DataModel.OfficerSergeantsList.Add(soldierModel);
                }
                else if (soldierModel.Position == "OfficerCaptains")
                {
                    soldierModel.Position = "Kapten";
                    DataModel.OfficerCaptainsList.Add(soldierModel);
                }
            }
            else if (e.Action == "Decrease")
            {
                SoldierModel soldierModel = e.SoldierModel;

                if (soldierModel.Position == "KnightTemplars")
                {
                    DataModel.TemplarKnightsList.RemoveAt(DataModel.TemplarKnightsList.Count - 1);
                }
                else if (soldierModel.Position == "Knights")
                {
                    DataModel.KnightsList.RemoveAt(DataModel.KnightsList.Count - 1);
                }
                else if (soldierModel.Position == "CavalryTemplarKnights")
                {
                    DataModel.CavalryTemplarKnightsList.RemoveAt(DataModel.CavalryTemplarKnightsList.Count - 1);
                }
                else if (soldierModel.Position == "OfficerCorporals")
                {
                    DataModel.OfficerCorporalsList.RemoveAt(DataModel.OfficerCorporalsList.Count - 1);
                }
                else if (soldierModel.Position == "OfficerSergeants")
                {
                    DataModel.OfficerSergeantsList.RemoveAt(DataModel.OfficerSergeantsList.Count - 1);
                }
                else if (soldierModel.Position == "OfficerCaptains")
                {
                    DataModel.OfficerCaptainsList.RemoveAt(DataModel.OfficerCaptainsList.Count - 1);
                }
            }
        }