using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace JeuHoy_WPF { /// /// Auteur: Hugo St-Louis /// Description: Fenêtre princiaple de l'application. Montre les choix à l'utilisateur /// Date: 2023-04-13 /// public partial class wEntree : Window { private JouerMp3 _wmpIntro = new JouerMp3(); /// /// Constructeur /// public wEntree() { InitializeComponent(); _wmpIntro.Open(@"./HoyContent/intro.mp3"); _wmpIntro.Play(true); } /// /// Ouverture de la fenêtre de jeu. /// /// /// private void picJouer_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { _wmpIntro.Close(); wJeu f = new wJeu(); this.Hide(); f.ShowDialog(); f.Close(); this.Show(); _wmpIntro.Open(@"./HoyContent/intro.mp3"); _wmpIntro.Play(true); } /// /// Ouverture de la fenêtre d'entrainement /// /// /// private void picEntrainement_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { _wmpIntro.Close(); wEntrainement f = new wEntrainement(); this.Hide(); f.ShowDialog(); f.Close(); this.Show(); _wmpIntro.Open(@"./HoyContent/intro.mp3"); _wmpIntro.Play(true); } /// /// Fermeture de la form. /// /// /// private void picQuitter_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { this.Close(); _wmpIntro.Close(); } /// /// Ouverture de la fenêtre d'aide. /// /// /// private void picAide_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { wAide f = new wAide(); this.Hide(); f.ShowDialog(); f.Close(); this.Show(); } /// /// Comportement lorsque curseur est au dessus d'une image(modifier le curseur) /// /// /// private void pic_MouseHover(object sender, MouseEventArgs e) { this.Cursor = Cursors.Hand; Image p = (Image)sender; if (p.Name == "picJouer") { Uri uriSource = new Uri(AppDomain.CurrentDomain.BaseDirectory + @"Resources/JouerDessus.png", UriKind.Absolute); picJouer.Source = new BitmapImage(uriSource); } else if (p.Name == "picEntrainement") { Uri uriSource = new Uri(AppDomain.CurrentDomain.BaseDirectory + @"\Resources\EntrainementDessus.png", UriKind.Absolute); picEntrainement.Source = new BitmapImage(uriSource); } else if (p.Name == "picAide") { Uri uriSource = new Uri(AppDomain.CurrentDomain.BaseDirectory + @"./Resources/AideDessus.png", UriKind.Absolute); picAide.Source = new BitmapImage(uriSource); } } /// /// Comportement lorsque curseur quitte l'image(modifier le curseur) /// /// /// private void pic_MouseLeave(object sender, MouseEventArgs e) { this.Cursor = Cursors.Arrow; Image p = (Image)sender; if (p.Name == "picJouer") { Uri uriSource = new Uri(AppDomain.CurrentDomain.BaseDirectory + @"Resources/JouerHoy.png", UriKind.Absolute); picJouer.Source = new BitmapImage(uriSource); } else if (p.Name == "picEntrainement") { Uri uriSource = new Uri(AppDomain.CurrentDomain.BaseDirectory + @"\Resources\Entrainement.png", UriKind.Absolute); picEntrainement.Source = new BitmapImage(uriSource); } else if (p.Name == "picAide") { Uri uriSource = new Uri(AppDomain.CurrentDomain.BaseDirectory + @"./Resources/Aide.png", UriKind.Absolute); picAide.Source = new BitmapImage(uriSource); } } /// /// Fermeture de la form /// /// /// private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { _wmpIntro.Close(); } } }