/// <summary> /// Init GUI at start /// </summary> private void Init() { animalController = new AnimalHandler(); lboxCategory.ItemsSource = animalController.getListCategories(); lboxCategory.SelectedIndex = 0; lboxSpecies.ItemsSource = animalController.getListSpecies(lboxCategory.SelectedIndex); lboxSpecies.SelectedIndex = 0; lboxGender.ItemsSource = animalController.getListGender(); lboxGender.SelectedIndex = 0; }
/// <summary> /// Fires when the user changes category. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lboxCategory_SelectionChanged(object sender, SelectionChangedEventArgs e) { lboxSpecies.ItemsSource = animalController.getListSpecies(lboxCategory.SelectedIndex); lboxSpecies.SelectedIndex = 0; try { lblOutputInfo.Content = ""; lbGetDataAnimSpec.Content = ""; string picString = lboxCategory.SelectedValue.ToString(); pictureBox.Source = animalController.fetchCatPic(picString); } catch (PictrureLibrary.CategoryNotFoundExcetion ex) { pictureBox.Source = null; lblOutputInfo.Content = "Pictures error! " + ex.Message; } }
/// <summary> /// Init GUI at start /// </summary> private void Init() { animalController = new AnimalHandler(); lboxCategory.ItemsSource = animalController.getListCategories(); lboxCategory.SelectedIndex = 0; lboxSpecies.ItemsSource = animalController.getListSpecies(lboxCategory.SelectedIndex); lboxSpecies.SelectedIndex = 0; lboxGender.ItemsSource = animalController.getListGender(); lboxGender.SelectedIndex = 0; }