diff --git a/StubLib/Stub.cs b/StubLib/Stub.cs index 7ed72d4..1d7759a 100644 --- a/StubLib/Stub.cs +++ b/StubLib/Stub.cs @@ -13,9 +13,10 @@ namespace StubLib public Stub() { List zone = new List { Zone.ATLANTIQUE }; + List zone2 = new List { Zone.PACIFIQUE }; requins.Add(new Requin("mon requin adoré", "trop cool ce requin", "wow il est trop bo", "Images/Dormeur-Mexicain.jpg", "Videos/Vid-dormeur-mexicain.mp4", "Images/rep_Heterodontus_mexicanus.png", Conservation.EW, zone, "(C'est pas un vrai requin)")); requins.Add(new Requin("Banane", "Le requin banal", "C'est un requin ultra banal", "Images/White_shark.png", "Videos/Vid-Requin-Blanc.mp4", "Images/rep_Heterodontus_mexicanus.png", Conservation.LC, zone, "Il est pas aussi banal qu'il en a l'air")); - requins.Add(new Requin("Req1", "Le requin pas banal", "C'est un requin pas ultra banal", "Images/White_shark.png", "Videos/Vid-dormeur-mexicain.mp4", "Images/rep_Heterodontus_mexicanus.png", Conservation.EX, zone, "Il est vraiment pas banal")); + requins.Add(new Requin("Req1", "Le requin pas banal", "C'est un requin pas ultra banal", "Images/White_shark.png", "Videos/Vid-dormeur-mexicain.mp4", "Images/rep_Heterodontus_mexicanus.png", Conservation.EX, zone2, "Il est vraiment pas banal")); } public List LoadRequins() diff --git a/WpfApp1/MainWindow.xaml b/WpfApp1/MainWindow.xaml index 60b2ac6..f63c937 100644 --- a/WpfApp1/MainWindow.xaml +++ b/WpfApp1/MainWindow.xaml @@ -10,7 +10,7 @@ - + Tous Arctique Atlantique diff --git a/WpfApp1/MainWindow.xaml.cs b/WpfApp1/MainWindow.xaml.cs index 3de2126..c3e9b49 100644 --- a/WpfApp1/MainWindow.xaml.cs +++ b/WpfApp1/MainWindow.xaml.cs @@ -24,7 +24,7 @@ namespace WpfApp1 /// - + public partial class MainWindow : Window { public Manager Mgr => (Application.Current as App).LeManager; @@ -43,13 +43,37 @@ namespace WpfApp1 // uc2.requin = new Requin("Requin Dormeur Mexdzdqzdicain", "Heterodontus Mexicanus", "*Ronflements*", "Images/Dormeur-Mexicain.jpg", "Videos/Vid-dormeur-Mexicain.mp4", "Images/rep_Heterodontus_mexicanus.png", Conservation.DD, zones, "Hé laissez moi je fais dodo!"); } - - // Requin requin { get; set; } - private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + // Requin requin { get; set; } + + + + private void Region_SelectionChanged(object sender, SelectionChangedEventArgs e) { - if (Tous.IsSelected) + if (Region.SelectedIndex == 0) + { + chargerUC(); + } + + else if (Region.SelectedIndex == 1) + { + chargerUC(); + changerListBox(Zone.ARCTIQUE); + } + else if (Region.SelectedIndex == 2) + { + chargerUC(); + changerListBox(Zone.ATLANTIQUE); + } + else if (Region.SelectedIndex == 3) + { + chargerUC(); + changerListBox(Zone.INDIEN); + } + else if (Region.SelectedIndex == 4) { + chargerUC(); + changerListBox(Zone.PACIFIQUE); } } @@ -88,13 +112,51 @@ namespace WpfApp1 } } + + public void chargerUC() { + viderListBox(); foreach(Requin req in Mgr.Requins) { laListe.Items.Add(new UserControlRequin { requin = req }); } } + public void changerListBox(Zone zone) + { + int test = 0; + int i = 0; + foreach (Requin req in Mgr.Requins) + { + foreach (Zone z in req.Repartition) + { + if (z == zone) + { + test++; + } + } + if (test == 0) + { + laListe.Items.RemoveAt(i); + } + else + { + i++; + } + test = 0; + } + } + + public void viderListBox() + { + if (laListe != null) + { + while (laListe.Items.Count > 0) + { + laListe.Items.RemoveAt(0); + } + } + } } } diff --git a/WpfApp1/Videos/requin_Asley.mp4 b/WpfApp1/Videos/requin_Asley.mp4 new file mode 100644 index 0000000..659c5c8 Binary files /dev/null and b/WpfApp1/Videos/requin_Asley.mp4 differ diff --git a/WpfApp1/userControlDescription.xaml b/WpfApp1/userControlDescription.xaml index f5b6e7d..b01ff4a 100644 --- a/WpfApp1/userControlDescription.xaml +++ b/WpfApp1/userControlDescription.xaml @@ -34,7 +34,7 @@ - +