public InvasionViewModel(Invasion invasion, FiltersEvent filtersEvent, IItemStore itemStore) { this.invasion = invasion; Id = invasion.Id; isDefenderFactionInfestation = invasion.DefenderMissionInfo.Faction == "FC_INFESTATION"; AttackerFaction = FactionViewModel.ById(invasion.AttackerMissionInfo.Faction); DefenderFaction = FactionViewModel.ById(invasion.DefenderMissionInfo.Faction); Faction = FactionViewModel.ById(invasion.Faction); Sector = SectorViewModel.FromSector(invasion.Node); LocTag = Model.Filters.ExpandMission(invasion.LocTag)?.Name ?? invasion.LocTag; DefenderReward = new InvasionRewardViewModel(invasion.DefenderReward, itemStore); AttackerReward = new InvasionRewardViewModel(invasion.AttackerReward, itemStore); Update(); SectorsUpdatedWeakEventManager.AddHandler(filtersEvent, OnSectorsFilterUpdated); MissionsUpdatedWeakEventManager.AddHandler(filtersEvent, OnMissionsFilterUpdated); }
private void OnSectorsFilterUpdated(object sender, EventArgs eventArgs) => Sector = SectorViewModel.FromSector(invasion.Node);