Gros UC avec 3 petit UC Ok (3xPlat=>Repa)

This commit is contained in:
adri 2019-01-19 10:58:20 +01:00
parent 8c94a47456
commit 660f5d3855
9 changed files with 83 additions and 94 deletions

View File

@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ProjetTheAlone" xmlns:local="clr-namespace:ProjetTheAlone"
StartupUri="/View/DashBoard.xaml"> StartupUri="/View/Accueil.xaml">
<Application.Resources> <Application.Resources>
<ResourceDictionary> <ResourceDictionary>
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>

View File

@ -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<string> classement;
public ObservableCollection<string> Classement { get => classement; set { classement = value; OnPropertyChanged("Classement"); } }
public EventPasseModel(ObservableCollection<string> classement)
{
Classement = classement;
}
protected void OnPropertyChanged(string name)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(name));
}
}
}
}

View File

@ -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<C_T_plat> listPlat = new ObservableCollection<C_T_plat>();
public ObservableCollection<C_T_plat> 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()
{
}
}
}

View File

@ -90,7 +90,7 @@
<Compile Include="Model\C_T_typeEvenement.cs" /> <Compile Include="Model\C_T_typeEvenement.cs" />
<Compile Include="Model\C_T_typePlat.cs" /> <Compile Include="Model\C_T_typePlat.cs" />
<Compile Include="Model\C_T_typeRepa.cs" /> <Compile Include="Model\C_T_typeRepa.cs" />
<Compile Include="Model\EventPasseModel.cs" /> <Compile Include="ViewModel\EventPasseModel.cs" />
<Compile Include="Model\G_Base.cs" /> <Compile Include="Model\G_Base.cs" />
<Compile Include="Model\G_T_beneficiaire.cs" /> <Compile Include="Model\G_T_beneficiaire.cs" />
<Compile Include="Model\G_T_equipe.cs" /> <Compile Include="Model\G_T_equipe.cs" />
@ -103,7 +103,7 @@
<Compile Include="Model\G_T_typeEvenement.cs" /> <Compile Include="Model\G_T_typeEvenement.cs" />
<Compile Include="Model\G_T_typePlat.cs" /> <Compile Include="Model\G_T_typePlat.cs" />
<Compile Include="Model\G_T_typeRepa.cs" /> <Compile Include="Model\G_T_typeRepa.cs" />
<Compile Include="Model\RepaModel.cs" /> <Compile Include="ViewModel\RepaModel.cs" />
<Compile Include="UserControlDIY\EventFutur.xaml.cs"> <Compile Include="UserControlDIY\EventFutur.xaml.cs">
<DependentUpon>EventFutur.xaml</DependentUpon> <DependentUpon>EventFutur.xaml</DependentUpon>
</Compile> </Compile>
@ -117,9 +117,25 @@
<DependentUpon>Repa.xaml</DependentUpon> <DependentUpon>Repa.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="ViewModel\Base.cs" /> <Compile Include="ViewModel\Base.cs" />
<Compile Include="ViewModel\EvenementEncode.cs" />
<Compile Include="View\Accueil.xaml.cs">
<DependentUpon>Accueil.xaml</DependentUpon>
</Compile>
<Compile Include="View\DashBoard.xaml.cs"> <Compile Include="View\DashBoard.xaml.cs">
<DependentUpon>DashBoard.xaml</DependentUpon> <DependentUpon>DashBoard.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="View\FicBeneficiaireEncode.xaml.cs">
<DependentUpon>FicBeneficiaireEncode.xaml</DependentUpon>
</Compile>
<Compile Include="View\FicEncodage.xaml.cs">
<DependentUpon>FicEncodage.xaml</DependentUpon>
</Compile>
<Compile Include="View\FicEvenementEncode.xaml.cs">
<DependentUpon>FicEvenementEncode.xaml</DependentUpon>
</Compile>
<Compile Include="View\FicRepasEncode.xaml.cs">
<DependentUpon>FicRepasEncode.xaml</DependentUpon>
</Compile>
<Page Include="MainWindow.xaml"> <Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
@ -148,10 +164,30 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="View\Accueil.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\DashBoard.xaml"> <Page Include="View\DashBoard.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="View\FicBeneficiaireEncode.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\FicEncodage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\FicEvenementEncode.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\FicRepasEncode.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs"> <Compile Include="Properties\AssemblyInfo.cs">

View File

@ -28,6 +28,5 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock x:Name="FoodDesc" Style="{StaticResource MaterialDesignTitleTextBlock}" HorizontalAlignment="Center" Height="Auto" Text="{Binding PlatV.P_nom}" /> <TextBlock x:Name="FoodDesc" Style="{StaticResource MaterialDesignTitleTextBlock}" HorizontalAlignment="Center" Height="Auto" Text="{Binding PlatV.P_nom}" />
<Image x:Name="FoodPic" Source="{Binding PlatV.P_img, Converter={StaticResource imgConverter}}" Grid.Column="1" Stretch="Uniform"/> <Image x:Name="FoodPic" Source="{Binding PlatV.P_img, Converter={StaticResource imgConverter}}" Grid.Column="1" Stretch="Uniform"/>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -21,14 +21,10 @@
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <TextBlock Text="{Binding Quand}" />
<ColumnDefinition Width="2*" /> <local:Plat x:Name="Plat1XML" Grid.Row="1"></local:Plat>
<ColumnDefinition Width="*" /> <local:Plat x:Name="Plat2XML" Grid.Row="2"></local:Plat>
</Grid.ColumnDefinitions> <local:Plat x:Name="Plat3XML" Grid.Row="3"></local:Plat>
<TextBlock Style="{StaticResource MaterialDesignTitleTextBlock}" HorizontalAlignment="Center" Height="Auto" Text="Date Jour" Grid.ColumnSpan="2"/>
<TextBlock Grid.Row="1" Style="{StaticResource MaterialDesignTitleTextBlock}" HorizontalAlignment="Center" Height="Auto" Text="{Binding ListPlat[0].P_Nom}" />
<TextBlock Grid.Row="2" Style="{StaticResource MaterialDesignTitleTextBlock}" HorizontalAlignment="Center" Height="Auto" Text="Date Jour" />
<TextBlock Grid.Row="3" Style="{StaticResource MaterialDesignTitleTextBlock}" HorizontalAlignment="Center" Height="Auto" Text="Date Jour" />
</Grid> </Grid>
</UserControl> </UserControl>

View File

@ -15,6 +15,7 @@ using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using ProjetTheAlone.Classes; using ProjetTheAlone.Classes;
using ProjetTheAlone.Model; using ProjetTheAlone.Model;
using ProjetTheAlone.ViewModel;
namespace ProjetTheAlone.UserControlDIY namespace ProjetTheAlone.UserControlDIY
{ {
@ -24,17 +25,29 @@ namespace ProjetTheAlone.UserControlDIY
public partial class Repa : UserControl public partial class Repa : UserControl
{ {
public ObservableCollection<C_T_plat> ListPlat public RepaModel RM
{ {
get get
{ {
return this.DataContext as ObservableCollection<C_T_plat>; 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() public Repa()
{ {
InitializeComponent(); 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;
} }
} }
} }

View File

@ -16,7 +16,7 @@
TextOptions.TextRenderingMode="Auto" TextOptions.TextRenderingMode="Auto"
Background="{DynamicResource MaterialDesignPaper}" Background="{DynamicResource MaterialDesignPaper}"
FontFamily="{DynamicResource MaterialDesignFont}" FontFamily="{DynamicResource MaterialDesignFont}"
Name="wnd"> Name="wnd" Closing="wnd_Closing">
<Window.Resources> <Window.Resources>
<local:DebugDummyConverter x:Key="DebugDummyConverter" /> <local:DebugDummyConverter x:Key="DebugDummyConverter" />
</Window.Resources> </Window.Resources>
@ -32,11 +32,11 @@
<ColumnDefinition /> <ColumnDefinition />
<ColumnDefinition /> <ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <!--<Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
µ
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock ></TextBlock>
<DockPanel> <DockPanel>
<ListView x:Name="RepasMatin"> <ListView x:Name="RepasMatin">
<ListView.ItemContainerStyle> <ListView.ItemContainerStyle>
@ -51,7 +51,8 @@
</DataTemplate> </DataTemplate>
</ListView.ItemTemplate> </ListView.ItemTemplate>
</ListView> </ListView>
</DockPanel> </DockPanel>-->
<control:Repa x:Name="RepasMatin"></control:Repa>
<materialDesign:PackIcon Kind="Build" Grid.Column="2" HorizontalAlignment="Right" Cursor="Hand"/> <materialDesign:PackIcon Kind="Build" Grid.Column="2" HorizontalAlignment="Right" Cursor="Hand"/>
@ -71,7 +72,11 @@
<Grid Grid.Row="2" Visibility="Visible"> <Grid Grid.Row="2" Visibility="Visible">
<Border> <Grid.ColumnDefinitions>
<ColumnDefinition Width="356*"/>
<ColumnDefinition Width="147*"/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2">
<Border.Background> <Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="OrangeRed" Offset="0" /> <GradientStop Color="OrangeRed" Offset="0" />
@ -79,7 +84,7 @@
</LinearGradientBrush> </LinearGradientBrush>
</Border.Background> </Border.Background>
</Border> </Border>
<TextBlock Grid.Column="1" Style="{StaticResource MaterialDesignTitleTextBlock}" VerticalAlignment="Center" Height="Auto" Text="Absentéisme ou alerte" /> <TextBlock Style="{StaticResource MaterialDesignTitleTextBlock}" VerticalAlignment="Center" Height="Auto" Text="Absentéisme ou alerte" Grid.ColumnSpan="2" Margin="0,9" />
</Grid> </Grid>
</Grid> </Grid>

View File

@ -16,6 +16,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Shapes; using System.Windows.Shapes;
using ProjetTheAlone.Model; using ProjetTheAlone.Model;
using ProjetTheAlone.Classes; using ProjetTheAlone.Classes;
using ProjetTheAlone.ViewModel;
namespace ProjetTheAlone.View namespace ProjetTheAlone.View
{ {
@ -58,7 +59,7 @@ namespace ProjetTheAlone.View
EventPasse2.DataContext = EventPasse1.DataContext = Epm; EventPasse2.DataContext = EventPasse1.DataContext = Epm;
Epm.Classement = Cl; 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); BinaryReader br = new BinaryReader(fs);
byte[] result = br.ReadBytes((int)fs.Length); byte[] result = br.ReadBytes((int)fs.Length);
br.Close(); 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("Entrée", result, null));
Rm.ListPlat.Add(new C_T_plat("Plat", result, null)); Rm.ListPlat.Add(new C_T_plat("Plat", result, null));
Rm.ListPlat.Add(new C_T_plat("Desert", result, null)); Rm.ListPlat.Add(new C_T_plat("Desert", result, null));
Rm.Quand = "Matin";
Console.WriteLine($"~~~~~~{Rm.ListPlat[0].P_nom}~~~~~~"); Console.WriteLine($"~~~~~~{Rm.ListPlat[0].P_nom}~~~~~~");
RepasMatin.ItemsSource = Rm.ListPlat; RepasMatin.DataContext = Rm;
//Test.DataContext = Rm.ListPlat[0];
//Test1.DataContext = Rm.ListPlat[1];
//Test2.DataContext = Rm.ListPlat[2];
} }
private void wnd_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
Accueil.Openaffichage = false;
}
} }
public class DebugDummyConverter : IValueConverter public class DebugDummyConverter : IValueConverter
{ {