Add somme litle features

This commit is contained in:
adri 2019-01-25 16:23:52 +01:00
parent 0ad72dcee7
commit 9a422d4760
9 changed files with 41 additions and 15 deletions

View File

@ -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">
<Grid Margin="0,0,0,10">
<Grid.ColumnDefinitions>

View File

@ -64,5 +64,11 @@ namespace ProjetTheAlone.View
{
Close();
}
private void Window_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left)
this.DragMove();
}
}
}

View File

@ -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">
<Window.Resources>
<local:DebugDummyConverter x:Key="DebugDummyConverter" />
</Window.Resources>
@ -29,7 +29,7 @@
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<materialDesign:PackIcon Kind="Build" Grid.Column="2" HorizontalAlignment="Right" Cursor="Hand"/>
<materialDesign:PackIcon Kind="Close" Grid.Column="2" HorizontalAlignment="Right" Cursor="Hand" MouseDown="PackIcon_MouseDown"/>
<Grid Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition />

View File

@ -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
{

View File

@ -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 @@
</DockPanel>
<DockPanel Grid.Row="5" Grid.ColumnSpan="2">
<ComboBox x:Name="TypePlat" SelectionChanged="TypePlat_SelectionChanged">
<ComboBoxItem>Soupe</ComboBoxItem>
<ComboBoxItem IsSelected="True">Plat</ComboBoxItem>
<ComboBoxItem>Dessert</ComboBoxItem>
<ComboBox x:Name="TypePlat" SelectionChanged="TypePlat_SelectionChanged" SelectedValue="{Binding Typeplat, Mode=TwoWay}">
</ComboBox>
</DockPanel>
</Grid>

View File

@ -26,6 +26,7 @@ namespace ProjetTheAlone
public FicEncodePlat()
{
InitializeComponent();
this.TypePlat.ItemsSource = Enum.GetValues(typeof(Classes.C_T_plat.TypePlat_E)).Cast<Classes.C_T_plat.TypePlat_E>();
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());
}
}
}

View File

@ -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">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>

View File

@ -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();
}
}
}

View File

@ -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<C_T_plat.TypePlat_E>(ref typeplat, value, System.Reflection.MethodBase.GetCurrentMethod().Name); }
#endregion
private ObservableCollection<C_T_plat> ChargerPersonnes(string chConn)
private ObservableCollection<C_T_plat> ChargerPersonnes(string chConn)
{
ObservableCollection<C_T_plat> rep = new ObservableCollection<C_T_plat>();
List<C_T_plat> lTmp = new G_T_plat(chConn).Lire("P_nom");