public ZooPage(ZooPark zooPark) { InitializeComponent(); zooPark.AddObserver(this); AnimalsList.ItemsSource = zooPark.animals; UsernameBox.Text += zooPark.user.Username; DisplayLevel(zooPark.user.Level); DisplayMoney(zooPark.user.Money); }
private void Profile_Click(object sender, RoutedEventArgs e) { var zooPark = ZooPark.GetInstance(); MessageBox.Show($"Username: {zooPark.user.Username}\n" + $"Level: {zooPark.user.Level}\n" + $"All animals: {zooPark.animals.Count}\n" + $"Mammals fed: {zooPark.user.MammalsFed}\n" + $"Fishes fed: {zooPark.user.FishesFed}\n" + $"Birds fed: {zooPark.user.BirdsFed}", "Profile"); }
private void Feed_Click(object sender, RoutedEventArgs e) { try { var zooPark = ZooPark.GetInstance(); MessageBox.Show(zooPark.FeedAnimal(selectedAnimal), "Hoooray!"); } catch (Exception exception) { MessageBox.Show(exception.Message, "Error"); } }
private void Decent_Click(object sender, RoutedEventArgs e) { try { string name = this.NameBox.Text; Animal animal = ZooPark.GetInstance().BuyRandomAnimal(name, new DecentStore()); this.NameBox.Text = ""; ShowCreatedAnimal(animal.AnimalType, animal.Name, animal.Color); } catch (Exception exception) { MessageBox.Show(exception.Message, "Exception"); } }
public void TestZooParkConsructorNullArguments() { try { ZooPark zoo = new ZooPark(null, null, 0, 0); } catch (ArgumentException e) { Assert.AreSame(e.Message, "Name or adress is null"); return; } Assert.Fail("No exception was throwed"); }
private void Login_Click(object sender, RoutedEventArgs e) { try { string username = this.LoginBox.Text; string password = this.PasswordBox.Password; IZooLoader loader = new ProtectedZooLoader(); ZooPark park = loader.GetZoo(username, password); ZooPage zooPage = new ZooPage(park); this.NavigationService.Navigate(zooPage); } catch (Exception exception) { MessageBox.Show(exception.Message, "Exception"); } }
protected CommandBase(ZooPark zoo) { _zoo = zoo; }
protected NotifyCommandBase(ZooPark zoo, INotifyService notifyService, IGetService getService) : base(zoo) { _notifyService = notifyService; _getService = getService; }
private void Collect_Click(object sender, RoutedEventArgs e) { int amount = ZooPark.GetInstance().AddMoney(); MessageBox.Show($"You got {amount}$. Raise your level to get more. +10$ for each new level", "Hurray!"); }
public AddAnimalCommand(ZooPark zoo, AnimalFabric animalFabric) : base(zoo) { _animalFabric = animalFabric; }
public DeleteCommand(ZooPark zoo, INotifyService notifyService, IGetService getService) : base(zoo, notifyService, getService) { }
public void TestZooParkConsructor() { ZooPark zoo = new ZooPark(); Assert.AreSame(zoo.zooName, "KievZoo"); }
public InfoAllComand(ZooPark zoo) : base(zoo) { }
public GetZooCommand(ZooPark zoo, IReaderService readerService) : base(zoo) { _readerService = readerService; }
public ZooPark GetZoo(string username, string password) { return(ZooPark.GetInstance(username)); }
public SaveCommand(ZooPark zoo, IWriterService writerService) : base(zoo) { _writerService = writerService; }
public SoundAllCommand(ZooPark zoo) : base(zoo) { }