private void UpdateMatchesForGroup() { int?groupId = SelectedGroup?.GroupID; MatchsOfGroup.Clear(); Matchs.Where(x => x.Group.GroupID == groupId).ForEach(MatchsOfGroup.Add); }
internal void InitBaseData(Arma3TacMapLibrary.TacMaps.IApiTacMaps apiTacMaps, Arma3TacMapLibrary.Arma3.IMapInfosService mapInfosService) { if (!Factions.Any()) { Factions.Add(new Faction() { Name = "OTAN", UsualSide = GameSide.BLUFOR, Flag = "/img/flags/nato.png", GameMarker = GameMarkerType.flag_nato }); Factions.Add(new Faction() { Name = "CSAT", UsualSide = GameSide.OPFOR, Flag = "/img/flags/csat.png", GameMarker = GameMarkerType.flag_csat }); Factions.Add(new Faction() { Name = "AAF", UsualSide = GameSide.Independant, Flag = "/img/flags/aaf.png", GameMarker = GameMarkerType.flag_aaf }); Factions.Add(new Faction() { Name = "USA", UsualSide = GameSide.BLUFOR, Flag = "/img/flags/us.png", GameMarker = GameMarkerType.flag_usa }); Factions.Add(new Faction() { Name = "UK", UsualSide = GameSide.BLUFOR, Flag = "/img/flags/uk.png", GameMarker = GameMarkerType.flag_uk }); Factions.Add(new Faction() { Name = "FIA", UsualSide = GameSide.Independant, Flag = "/img/flags/fia.png", GameMarker = GameMarkerType.flag_fia }); Factions.Add(new Faction() { Name = "France", UsualSide = GameSide.BLUFOR, Flag = "/img/flags/fr.png", GameMarker = GameMarkerType.flag_france }); SaveChanges(); } var oldMissionBrief = Matchs.Where(m => !string.IsNullOrEmpty(m.MissionBriefLink)).ToList(); if (oldMissionBrief.Any()) { foreach (var match in oldMissionBrief) { Documents.Add(new Document() { Date = DateTime.Now, MatchID = match.MatchID, Link = match.MissionBriefLink, Type = DocumentType.MissionBrief, Title = "Mission brief" }); match.MissionBriefLink = null; Update(match); } SaveChanges(); } var oldMaps = Matchs.Where(m => m.GameMapID != null && m.TacMapId == null).Include(m => m.GameMap).ToList(); if (oldMaps.Any()) { var worlds = mapInfosService.GetMapsInfos().Result; foreach (var match in oldMaps) { var world = worlds.FirstOrDefault(w => string.Equals(w.worldName, match.GameMap.WebMap, StringComparison.OrdinalIgnoreCase)) ?? worlds.FirstOrDefault(w => w.worldName.EndsWith(match.GameMap.WebMap, StringComparison.OrdinalIgnoreCase)) ?? worlds.FirstOrDefault(w => w.worldName.StartsWith(match.GameMap.WebMap, StringComparison.OrdinalIgnoreCase)); if (world != null) { match.WorldName = world.worldName; match.TacMapId = apiTacMaps.Create(new Arma3TacMapLibrary.TacMaps.ApiTacMapCreate() { WorldName = world.worldName, Label = match.Name, EventHref = new Uri("https://plan-ops.fr/Events/Details/" + match.MatchID), Markers = MapMarkers.Where(m => m.MatchID == match.MatchID && m.RoundSideID == null && m.RoundSquadID == null).Select(m => new Arma3TacMapLibrary.Maps.StoredMarker() { MarkerData = m.MarkerData }).ToList() }).Result.Id; Update(match); } } SaveChanges(); } }