From 9a422d476046548105a9d49cd1f534768be419a9 Mon Sep 17 00:00:00 2001 From: adri Date: Fri, 25 Jan 2019 16:23:52 +0100 Subject: [PATCH] Add somme litle features --- ProjetTheAlone/View/Accueil.xaml | 2 +- ProjetTheAlone/View/Accueil.xaml.cs | 6 ++++++ ProjetTheAlone/View/DashBoard.xaml | 4 ++-- ProjetTheAlone/View/DashBoard.xaml.cs | 11 +++++++++++ ProjetTheAlone/View/FicEncodePlat.xaml | 8 ++++---- ProjetTheAlone/View/FicEncodePlat.xaml.cs | 5 +++-- ProjetTheAlone/View/FicRepasEncode.xaml | 2 +- ProjetTheAlone/View/FicRepasEncode.xaml.cs | 10 ++++++++-- ProjetTheAlone/ViewModel/EncodePlats.cs | 8 +++++--- 9 files changed, 41 insertions(+), 15 deletions(-) diff --git a/ProjetTheAlone/View/Accueil.xaml b/ProjetTheAlone/View/Accueil.xaml index 2ceb809..b0d9548 100644 --- a/ProjetTheAlone/View/Accueil.xaml +++ b/ProjetTheAlone/View/Accueil.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:ProjetTheAlone.View" mc:Ignorable="d" - Title="Accueil" Height="376.232" Width="816.438" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" WindowStyle="None"> + Title="Accueil" Height="376.232" Width="816.438" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" WindowStyle="None" MouseDown="Window_MouseDown"> diff --git a/ProjetTheAlone/View/Accueil.xaml.cs b/ProjetTheAlone/View/Accueil.xaml.cs index 81cbb58..a201c0c 100644 --- a/ProjetTheAlone/View/Accueil.xaml.cs +++ b/ProjetTheAlone/View/Accueil.xaml.cs @@ -64,5 +64,11 @@ namespace ProjetTheAlone.View { Close(); } + + private void Window_MouseDown(object sender, MouseButtonEventArgs e) + { + if (e.ChangedButton == MouseButton.Left) + this.DragMove(); + } } } diff --git a/ProjetTheAlone/View/DashBoard.xaml b/ProjetTheAlone/View/DashBoard.xaml index 365a771..9b56e5a 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" Closing="wnd_Closing"> + Name="wnd" Closing="wnd_Closing" WindowStyle="None" MouseDown="wnd_MouseDown"> @@ -29,7 +29,7 @@ - + diff --git a/ProjetTheAlone/View/DashBoard.xaml.cs b/ProjetTheAlone/View/DashBoard.xaml.cs index 2380ad9..4b2ec0d 100644 --- a/ProjetTheAlone/View/DashBoard.xaml.cs +++ b/ProjetTheAlone/View/DashBoard.xaml.cs @@ -75,6 +75,17 @@ namespace ProjetTheAlone.View { } + + private void wnd_MouseDown(object sender, MouseButtonEventArgs e) + { + if (e.ChangedButton == MouseButton.Left) + this.DragMove(); + } + + private void PackIcon_MouseDown(object sender, MouseButtonEventArgs e) + { + this.Close(); + } } public class DebugDummyConverter : IValueConverter { diff --git a/ProjetTheAlone/View/FicEncodePlat.xaml b/ProjetTheAlone/View/FicEncodePlat.xaml index 9aa96cd..62b7299 100644 --- a/ProjetTheAlone/View/FicEncodePlat.xaml +++ b/ProjetTheAlone/View/FicEncodePlat.xaml @@ -4,6 +4,8 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:ProjetTheAlone" + xmlns:System="clr-namespace:System;assembly=mscorlib" + xmlns:StyleAlias="clr-namespace:ProjetTheAlone.Classes" xmlns:convert="clr-namespace:ProjetTheAlone.Converter" mc:Ignorable="d" Title="Plats" Height="482.167" Width="955.5" WindowStartupLocation="CenterScreen" WindowStyle="None"> @@ -41,10 +43,8 @@ - - Soupe - Plat - Dessert + + diff --git a/ProjetTheAlone/View/FicEncodePlat.xaml.cs b/ProjetTheAlone/View/FicEncodePlat.xaml.cs index f537a7f..76cf3e4 100644 --- a/ProjetTheAlone/View/FicEncodePlat.xaml.cs +++ b/ProjetTheAlone/View/FicEncodePlat.xaml.cs @@ -26,6 +26,7 @@ namespace ProjetTheAlone public FicEncodePlat() { InitializeComponent(); + this.TypePlat.ItemsSource = Enum.GetValues(typeof(Classes.C_T_plat.TypePlat_E)).Cast(); DataContext = new ViewModel.VM_Plat(); } @@ -54,8 +55,8 @@ namespace ProjetTheAlone private void TypePlat_SelectionChanged(object sender, SelectionChangedEventArgs e) { - if (DataContext != null) - ((ViewModel.VM_Plat)DataContext).UnPlat.TypePlat = (C_T_plat.TypePlat_E)Enum.Parse(typeof(C_T_plat.TypePlat_E), this.TypePlat.Text); + if (DataContext != null && this.TypePlat.Text != "") + ((ViewModel.VM_Plat)DataContext).UnPlat.TypePlat = (C_T_plat.TypePlat_E)Enum.Parse(typeof(C_T_plat.TypePlat_E), this.TypePlat.SelectedValue.ToString()); } } } diff --git a/ProjetTheAlone/View/FicRepasEncode.xaml b/ProjetTheAlone/View/FicRepasEncode.xaml index eeeaa2a..dc86f0a 100644 --- a/ProjetTheAlone/View/FicRepasEncode.xaml +++ b/ProjetTheAlone/View/FicRepasEncode.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:ProjetTheAlone.View" mc:Ignorable="d" - Title="FicRepas" Height="491.666" Width="1137.834" WindowStartupLocation="CenterScreen" WindowStyle="None"> + Title="FicRepas" Height="491.666" Width="1137.834" WindowStartupLocation="CenterScreen" MouseDown="Window_MouseDown" WindowStyle="None"> diff --git a/ProjetTheAlone/View/FicRepasEncode.xaml.cs b/ProjetTheAlone/View/FicRepasEncode.xaml.cs index 23c9efc..df0d0ee 100644 --- a/ProjetTheAlone/View/FicRepasEncode.xaml.cs +++ b/ProjetTheAlone/View/FicRepasEncode.xaml.cs @@ -53,14 +53,14 @@ namespace ProjetTheAlone.View { FicEncodePlat w = new FicEncodePlat(); w.ShowDialog(); - dgPlat.DataContext = new ViewModel.VM_Plat(); + this.DataContext = new ViewModel.VM_Repa(); } private void btnAddPlat_Click(object sender, RoutedEventArgs e) { - if (dgPlat.SelectedItems.Count > 0 && DateV.SelectedDate.HasValue) + if (dgPlat.SelectedItems.Count > 0 && dgLPS.Items.Count < 3 &&DateV.SelectedDate.HasValue) { @@ -113,5 +113,11 @@ namespace ProjetTheAlone.View } } + + private void Window_MouseDown(object sender, MouseButtonEventArgs e) + { + if (e.ChangedButton == MouseButton.Left) + this.DragMove(); + } } } diff --git a/ProjetTheAlone/ViewModel/EncodePlats.cs b/ProjetTheAlone/ViewModel/EncodePlats.cs index a6f02d1..e6ee702 100644 --- a/ProjetTheAlone/ViewModel/EncodePlats.cs +++ b/ProjetTheAlone/ViewModel/EncodePlats.cs @@ -18,7 +18,7 @@ namespace ProjetTheAlone.ViewModel private string chConnexion = Settings2.Default.schCon /*@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename='C:\Users\Hugues\Haute Ecole de la ville de Liège\Adrien VAN DAMME - ProjetTheAlone\ProjetTheAlone\ProjetThe.mdf';Integrated Security = True"*/; private int nAjout; - private int typeplat=0; + private C_T_plat.TypePlat_E typeplat=0; private bool _ActiverUneFiche; public bool ActiverUneFiche { @@ -64,6 +64,7 @@ namespace ProjetTheAlone.ViewModel UnPlat.Nom = "Nom du plat"; BcpPlats = ChargerPersonnes(chConnexion); ActiverUneFiche = false; + Typeplat = C_T_plat.TypePlat_E.Soupe; cConfirmer = new BaseCommande(Confirmer); cAnnuler = new BaseCommande(Annuler); cAjouter = new BaseCommande(Ajouter); @@ -77,9 +78,10 @@ namespace ProjetTheAlone.ViewModel public BaseCommande cAjouter { get; set; } public BaseCommande cModifier { get; set; } public BaseCommande cSupprimer { get; set; } - #endregion + public C_T_plat.TypePlat_E Typeplat { get => typeplat; set =>AssignerChamp(ref typeplat, value, System.Reflection.MethodBase.GetCurrentMethod().Name); } + #endregion - private ObservableCollection ChargerPersonnes(string chConn) + private ObservableCollection ChargerPersonnes(string chConn) { ObservableCollection rep = new ObservableCollection(); List lTmp = new G_T_plat(chConn).Lire("P_nom");