classes pour mvp

This commit is contained in:
Merlin Gélinas 2023-05-03 10:55:18 -04:00
parent be9041cd6f
commit 9fa5393254
6 changed files with 92 additions and 13 deletions

View File

@ -60,12 +60,15 @@
</ApplicationDefinition>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Model\CstApplication.cs" />
<Compile Include="Model\GestionWEntrainement.cs" />
<Compile Include="Presenter\JouerMp3.cs" />
<Compile Include="Presenter\JouerSon.cs" />
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Presenter\PresentateurWEntrainement.cs" />
<Compile Include="View\IwEntrainement.cs" />
<Compile Include="View\wAide.xaml.cs">
<DependentUpon>wAide.xaml</DependentUpon>
</Compile>

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JeuHoy_WPF_Natif.Model
{
/// <summary>
/// Description: Logique pour la vue Entrainement
/// </summary>
public class GestionWEntrainement
{
}
}

View File

@ -0,0 +1,34 @@
using JeuHoy_WPF_Natif.Model;
using JeuHoy_WPF_Natif.View;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JeuHoy_WPF_Natif.Presenter
{
/// <summary>
/// Description: Permet de gérer les événements de la vue Entrainement et de les aiguiller
/// </summary>
public class PresentateurWEntrainement
{
private IwEntrainement _vue;
private GestionWEntrainement _gestionnaire;
public PresentateurWEntrainement(IwEntrainement vue)
{
_vue = vue;
_gestionnaire = new GestionWEntrainement();
_vue.EntrainementEvt += _vue_EntrainementEvt;
}
private void _vue_EntrainementEvt(object sender, EventArgs e)
{
// Perceptron!!!
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
namespace JeuHoy_WPF_Natif.View
{
/// <summary>
/// Description: Interface pour la fenêtre d'entrainement
/// </summary>
public interface IwEntrainement
{
Image Image { get; set; }
string Console { get; set; }
Canvas Canvas { get; set; }
event EventHandler EntrainementEvt;
}
}

View File

@ -26,7 +26,7 @@
<TextBox x:Name="txtConsole" HorizontalAlignment="Center" Margin="0,0,0,0" Grid.Row="2" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="300" Height="300" Grid.RowSpan="2"/>
<Image x:Name="picPositionAFaire" Grid.Column="1" HorizontalAlignment="Left" Height="822" VerticalAlignment="Top" Width="828" Grid.RowSpan="3"/>
<Grid Grid.Column="0" Grid.Row="3" >
<Grid Grid.Column="1" Margin="758,10,10,190" >
<Grid.RowDefinitions>
<RowDefinition Height="45"/>
@ -44,9 +44,6 @@
<Label x:Name="lblFigureEnCours" Grid.Column="1" Grid.Row="1" Content="1" HorizontalAlignment="Right" VerticalAlignment="Top" FontFamily="Matura MT Script Capitals" FontSize="50" />
<Label x:Name="lblNbPositions" Grid.Column="2" Grid.Row="1" Content=" / 10" HorizontalAlignment="Right" VerticalAlignment="Top" FontFamily="Matura MT Script Capitals" FontSize="50" />
</Grid>
</Grid>

View File

@ -1,4 +1,6 @@
using Microsoft.Kinect;
using JeuHoy_WPF_Natif.Presenter;
using JeuHoy_WPF_Natif.View;
using Microsoft.Kinect;
using System;
using System.Collections.Generic;
using System.Linq;
@ -17,19 +19,27 @@ namespace JeuHoy_WPF.View
/// Description: Permet de faire l'entrainement des différentes figures de danse.
/// Date: 2023-04-17
/// </summary>
public partial class wEntrainement : Window
public partial class wEntrainement : Window, IwEntrainement
{
private Dictionary<string, BitmapImage> _dicImgFigure = new Dictionary<string, BitmapImage>();
private JouerSon _son = new JouerSon();
private int _positionEnCours = 1;
private PresentateurWEntrainement _presentateur;
public event EventHandler EntrainementEvt;
public Image Image { get => picKinect; set => picKinect = value; }
public string Console { get => txtConsole.Text; set => txtConsole.Text = value; }
public Canvas Canvas { get => pDessinSquelette; set => pDessinSquelette = value; }
/// <summary>
/// Constructeur
/// </summary>
public wEntrainement()
{
_presentateur = new PresentateurWEntrainement(this);
InitializeComponent();
for (int i = 1; i <= CstApplication.NBFIGURE; i++)
@ -199,7 +209,7 @@ namespace JeuHoy_WPF.View
private void btnApprendre_Click(object sender, RoutedEventArgs e)
{
//Ajouter du code ICI
EntrainementEvt(this, e);
}