async Task ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { Pets.Clear(); var pets = await _petClient.GetPetsAsync(); foreach (var item in pets) { Pets.Add(item); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
public override void Clear() { Items.Clear(); Pets.Clear(); Skills.Clear(); Spells.Clear(); }
protected void FromWorldMap(Stream dat) { log.InfoFormat("Loading map for world {0}({1})...", Id, Name); Map = new Wmap(Manager.GameData); entityInc = 0; entityInc += Map.Load(dat, 0); int w = Map.Width, h = Map.Height; EnemiesCollision = new CollisionMap <Entity>(0, w, h); PlayersCollision = new CollisionMap <Entity>(1, w, h); PetsCollision = new CollisionMap <Entity>(1, w, h); Projectiles.Clear(); StaticObjects.Clear(); Enemies.Clear(); Players.Clear(); Pets.Clear(); foreach (Entity i in Map.InstantiateEntities(Manager)) { EnterWorld(i); } CheckDisposable(); }
public void Dispose() { Players.Clear(); Enemies.Clear(); Quests.Clear(); Pets.Clear(); Projectiles.Clear(); StaticObjects.Clear(); Timers.Clear(); }
public virtual void Dispose() { Map.Dispose(); Players.Clear(); Enemies.Clear(); Quests.Clear(); Pets.Clear(); Projectiles.Clear(); StaticObjects.Clear(); Timers.Clear(); EnemiesCollision = null; PlayersCollision = null; }
private void LoadData() { Pets.Clear(); var petModels = petsData.GetPets(); foreach (var model in petModels) { var petDescription = new PetDescription { Id = model.Id, IsSelected = false, Name = model.Name, Image = model.Image }; Pets.Add(petDescription); } }
public override async Task LoadAsync() { IsRefreshing = true; var pets = await _petsInLoveApiService.GetTagsAsync(); //System.Diagnostics.Debug.WriteLine("FOUND {0} PETS", pets.Count); Pets.Clear(); foreach (var pet in pets) { Pets.Add(pet); } OnPropertyChanged(nameof(Pets)); IsRefreshing = false; }
async Task ExecuteLoadPetsCommand() { IsBusy = true; try { Pets.Clear(); var pets = await DataStore.GetPetsAsync(true); foreach (var pet in pets) { Pets.Add(pet); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
public void Test_Query_Join_Outer_Left_Compound__Right_Clear() { // Example of a left outer join, using query expression // and anonymous types, of People to Pets, and // because there are no pets, all 4 people // will be without a pet. Pets.Clear(); var owners = from person in People join pet in Pets on new { person.Id, person.Age, } equals new { pet.Id, Age = pet.Age * 2, // when owner is twice age of pet } into pets from pet in pets.DefaultIfEmpty() select new PetOwner { Person = person, Pet = pet, }; var countOfOwnersWithoutPets = owners.Count(o => o.Pet is null); var petNameOfOwnerJoe = owners.FirstOrDefault(o => o.Person.Name == "Joe").Pet?.Name; Assert.AreEqual(countOfOwnersWithoutPets, 4); Assert.IsNull(petNameOfOwnerJoe); }