/// <summary> /// Initializes the store of zone items with data /// </summary> public void InitializeStore() { this.zoneService.Initialize(); var continents = this.zoneService.GetContinents(); foreach (var continent in continents) { this.Data.Add(continent.Id, new ContinentZoneItems(continent.Id)); } foreach (var continent in this.Data) { var zoneItems = this.zoneService.GetZoneItemsByContinent(continent.Key); Threading.InvokeOnUI(() => continent.Value.Clear()); foreach (var entity in zoneItems) { var zoneItem = new ZoneItemViewModel(entity, this.playerService, this.zoneUserData); Threading.InvokeOnUI(() => { continent.Value.Add(zoneItem); }); } } Threading.BeginInvokeOnUI(() => this.RaiseDataLoadedEvent()); }
/// <summary> /// Initializes the store of zone items with data /// </summary> public void InitializeStore() { this.zoneService.Initialize(); foreach (var continent in this.Data) { var zoneItems = this.zoneService.GetZoneItemsByContinent(continent.Key); Threading.BeginInvokeOnUI(() => { continent.Value.Dungeons.Clear(); continent.Value.HeartQuests.Clear(); continent.Value.HeroPoints.Clear(); continent.Value.POIs.Clear(); continent.Value.Vistas.Clear(); continent.Value.Waypoints.Clear(); }); foreach (var entity in zoneItems) { var vm = new ZoneItemViewModel(entity, this.playerService, this.zoneUserData); Threading.BeginInvokeOnUI(() => { switch (entity.Type) { case API.Data.Enums.ZoneItemType.Dungeon: continent.Value.Dungeons.Add(vm); break; case API.Data.Enums.ZoneItemType.HeartQuest: continent.Value.HeartQuests.Add(vm); break; case API.Data.Enums.ZoneItemType.HeroPoint: continent.Value.HeroPoints.Add(vm); break; case API.Data.Enums.ZoneItemType.PointOfInterest: continent.Value.POIs.Add(vm); break; case API.Data.Enums.ZoneItemType.Vista: continent.Value.Vistas.Add(vm); break; case API.Data.Enums.ZoneItemType.Waypoint: continent.Value.Waypoints.Add(vm); break; default: break; } }); } } }
/// <summary> /// Adds a new zone item/objective various collections /// </summary> /// <param name="zoneItem">The zone item/objective to add</param> public void Add(ZoneItemViewModel zoneItem) { var mapId = zoneItem.ItemModel.MapId; if (!this.ZoneItemsByMap.ContainsKey(mapId)) { this.ZoneItemsByMap.Add(mapId, new ZoneItems(mapId)); } switch (zoneItem.ItemType) { case API.Data.Enums.ZoneItemType.Dungeon: this.Dungeons.Add(zoneItem); this.ZoneItemsByMap[mapId].Dungeons.Add(zoneItem); break; case API.Data.Enums.ZoneItemType.HeartQuest: this.HeartQuests.Add(zoneItem); this.ZoneItemsByMap[mapId].HeartQuests.Add(zoneItem); break; case API.Data.Enums.ZoneItemType.HeroPoint: this.HeroPoints.Add(zoneItem); this.ZoneItemsByMap[mapId].HeroPoints.Add(zoneItem); break; case API.Data.Enums.ZoneItemType.PointOfInterest: this.POIs.Add(zoneItem); this.ZoneItemsByMap[mapId].POIs.Add(zoneItem); break; case API.Data.Enums.ZoneItemType.Vista: this.Vistas.Add(zoneItem); this.ZoneItemsByMap[mapId].Vistas.Add(zoneItem); break; case API.Data.Enums.ZoneItemType.Waypoint: this.Waypoints.Add(zoneItem); this.ZoneItemsByMap[mapId].Waypoints.Add(zoneItem); break; default: break; } }