From 660f5d385590495ae91eac09592832a477a9198c Mon Sep 17 00:00:00 2001 From: adri Date: Sat, 19 Jan 2019 10:58:20 +0100 Subject: [PATCH] Gros UC avec 3 petit UC Ok (3xPlat=>Repa) --- ProjetTheAlone/App.xaml | 2 +- ProjetTheAlone/Model/EventPasseModel.cs | 32 ----------------- ProjetTheAlone/Model/RepaModel.cs | 32 ----------------- ProjetTheAlone/ProjetTheAlone.csproj | 40 ++++++++++++++++++++-- ProjetTheAlone/UserControlDIY/Plat.xaml | 1 - ProjetTheAlone/UserControlDIY/Repa.xaml | 12 +++---- ProjetTheAlone/UserControlDIY/Repa.xaml.cs | 19 ++++++++-- ProjetTheAlone/View/DashBoard.xaml | 25 ++++++++------ ProjetTheAlone/View/DashBoard.xaml.cs | 14 +++++--- 9 files changed, 83 insertions(+), 94 deletions(-) delete mode 100644 ProjetTheAlone/Model/EventPasseModel.cs delete mode 100644 ProjetTheAlone/Model/RepaModel.cs diff --git a/ProjetTheAlone/App.xaml b/ProjetTheAlone/App.xaml index d66f507..e5efce0 100644 --- a/ProjetTheAlone/App.xaml +++ b/ProjetTheAlone/App.xaml @@ -2,7 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:ProjetTheAlone" - StartupUri="/View/DashBoard.xaml"> + StartupUri="/View/Accueil.xaml"> diff --git a/ProjetTheAlone/Model/EventPasseModel.cs b/ProjetTheAlone/Model/EventPasseModel.cs deleted file mode 100644 index 18e018e..0000000 --- a/ProjetTheAlone/Model/EventPasseModel.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProjetTheAlone.Model -{ - public class EventPasseModel : INotifyPropertyChanged - { - public event PropertyChangedEventHandler PropertyChanged; - ObservableCollection classement; - - public ObservableCollection Classement { get => classement; set { classement = value; OnPropertyChanged("Classement"); } } - - public EventPasseModel(ObservableCollection classement) - { - Classement = classement; - } - - protected void OnPropertyChanged(string name) - { - PropertyChangedEventHandler handler = PropertyChanged; - if (handler != null) - { - handler(this, new PropertyChangedEventArgs(name)); - } - } - } -} diff --git a/ProjetTheAlone/Model/RepaModel.cs b/ProjetTheAlone/Model/RepaModel.cs deleted file mode 100644 index cb75244..0000000 --- a/ProjetTheAlone/Model/RepaModel.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.ComponentModel; -using ProjetTheAlone.Classes; -using System.Collections.ObjectModel; - -namespace ProjetTheAlone.Model -{ - public class RepaModel : INotifyPropertyChanged - { - private ObservableCollection listPlat = new ObservableCollection(); - - public ObservableCollection ListPlat { get => listPlat; set { listPlat = value; OnPropertyChanged("ListPlat"); } } - - public event PropertyChangedEventHandler PropertyChanged; - protected void OnPropertyChanged(string name) - { - PropertyChangedEventHandler handler = PropertyChanged; - if (handler != null) - { - handler(this, new PropertyChangedEventArgs(name)); - } - } - public RepaModel() - { - - } - } -} diff --git a/ProjetTheAlone/ProjetTheAlone.csproj b/ProjetTheAlone/ProjetTheAlone.csproj index 68bf636..0dfeb02 100644 --- a/ProjetTheAlone/ProjetTheAlone.csproj +++ b/ProjetTheAlone/ProjetTheAlone.csproj @@ -90,7 +90,7 @@ - + @@ -103,7 +103,7 @@ - + EventFutur.xaml @@ -117,9 +117,25 @@ Repa.xaml + + + Accueil.xaml + DashBoard.xaml + + FicBeneficiaireEncode.xaml + + + FicEncodage.xaml + + + FicEvenementEncode.xaml + + + FicRepasEncode.xaml + MSBuild:Compile Designer @@ -148,10 +164,30 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + diff --git a/ProjetTheAlone/UserControlDIY/Plat.xaml b/ProjetTheAlone/UserControlDIY/Plat.xaml index 5478df2..707fcf4 100644 --- a/ProjetTheAlone/UserControlDIY/Plat.xaml +++ b/ProjetTheAlone/UserControlDIY/Plat.xaml @@ -28,6 +28,5 @@ - diff --git a/ProjetTheAlone/UserControlDIY/Repa.xaml b/ProjetTheAlone/UserControlDIY/Repa.xaml index 75dca68..e011511 100644 --- a/ProjetTheAlone/UserControlDIY/Repa.xaml +++ b/ProjetTheAlone/UserControlDIY/Repa.xaml @@ -21,14 +21,10 @@ - - - - - - - - + + + + diff --git a/ProjetTheAlone/UserControlDIY/Repa.xaml.cs b/ProjetTheAlone/UserControlDIY/Repa.xaml.cs index 5c8346f..0696acf 100644 --- a/ProjetTheAlone/UserControlDIY/Repa.xaml.cs +++ b/ProjetTheAlone/UserControlDIY/Repa.xaml.cs @@ -15,6 +15,7 @@ using System.Windows.Navigation; using System.Windows.Shapes; using ProjetTheAlone.Classes; using ProjetTheAlone.Model; +using ProjetTheAlone.ViewModel; namespace ProjetTheAlone.UserControlDIY { @@ -24,17 +25,29 @@ namespace ProjetTheAlone.UserControlDIY public partial class Repa : UserControl { - public ObservableCollection ListPlat + public RepaModel RM { get { - return this.DataContext as ObservableCollection; + return this.DataContext as RepaModel; } } - + public C_T_plat Plat1 { get => ((RM==null)?new C_T_plat():RM.Plat1 ?? new C_T_plat()); } + public C_T_plat Plat2 { get => ((RM == null) ? new C_T_plat() : RM.Plat2 ?? new C_T_plat()); } + public C_T_plat Plat3 { get => ((RM == null) ? new C_T_plat() : RM.Plat3 ?? new C_T_plat()); } public Repa() { InitializeComponent(); + GridPrinc.DataContext = RM; + Plat1XML.DataContext = Plat1; + this.DataContextChanged += new DependencyPropertyChangedEventHandler(updateDataContext); + } + public void updateDataContext(object o, DependencyPropertyChangedEventArgs e) + { + GridPrinc.DataContext = RM; + Plat1XML.DataContext = Plat1; + Plat2XML.DataContext = Plat2; + Plat3XML.DataContext = Plat3; } } } diff --git a/ProjetTheAlone/View/DashBoard.xaml b/ProjetTheAlone/View/DashBoard.xaml index dbc1569..38ec60e 100644 --- a/ProjetTheAlone/View/DashBoard.xaml +++ b/ProjetTheAlone/View/DashBoard.xaml @@ -16,7 +16,7 @@ TextOptions.TextRenderingMode="Auto" Background="{DynamicResource MaterialDesignPaper}" FontFamily="{DynamicResource MaterialDesignFont}" - Name="wnd"> + Name="wnd" Closing="wnd_Closing"> @@ -32,11 +32,11 @@ - + + - + @@ -63,15 +64,19 @@ - + - + - + + + + + @@ -79,8 +84,8 @@ - + - + diff --git a/ProjetTheAlone/View/DashBoard.xaml.cs b/ProjetTheAlone/View/DashBoard.xaml.cs index f56cae3..353e5a4 100644 --- a/ProjetTheAlone/View/DashBoard.xaml.cs +++ b/ProjetTheAlone/View/DashBoard.xaml.cs @@ -16,6 +16,7 @@ using System.Windows.Media.Imaging; using System.Windows.Shapes; using ProjetTheAlone.Model; using ProjetTheAlone.Classes; +using ProjetTheAlone.ViewModel; namespace ProjetTheAlone.View { @@ -58,7 +59,7 @@ namespace ProjetTheAlone.View EventPasse2.DataContext = EventPasse1.DataContext = Epm; Epm.Classement = Cl; - FileStream fs = new System.IO.FileStream(@"C:\Users\adrie\Nextcloud\ecole\3IS\POO\ProjetTheAlone\ProjetTheAlone\img\desert.jpg", FileMode.Open, FileAccess.Read); + FileStream fs = new System.IO.FileStream(@".\desert.jpg", FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); byte[] result = br.ReadBytes((int)fs.Length); br.Close(); @@ -66,15 +67,18 @@ namespace ProjetTheAlone.View Rm.ListPlat.Add(new C_T_plat("Entrée", result, null)); Rm.ListPlat.Add(new C_T_plat("Plat", result, null)); Rm.ListPlat.Add(new C_T_plat("Desert", result, null)); + Rm.Quand = "Matin"; Console.WriteLine($"~~~~~~{Rm.ListPlat[0].P_nom}~~~~~~"); - RepasMatin.ItemsSource = Rm.ListPlat; - //Test.DataContext = Rm.ListPlat[0]; - //Test1.DataContext = Rm.ListPlat[1]; - //Test2.DataContext = Rm.ListPlat[2]; + RepasMatin.DataContext = Rm; } + + private void wnd_Closing(object sender, System.ComponentModel.CancelEventArgs e) + { + Accueil.Openaffichage = false; + } } public class DebugDummyConverter : IValueConverter {