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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ProjetTheAlone"
StartupUri="/View/DashBoard.xaml">
StartupUri="/View/Accueil.xaml">
<Application.Resources>
<ResourceDictionary>
<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_typePlat.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_T_beneficiaire.cs" />
<Compile Include="Model\G_T_equipe.cs" />
@ -103,7 +103,7 @@
<Compile Include="Model\G_T_typeEvenement.cs" />
<Compile Include="Model\G_T_typePlat.cs" />
<Compile Include="Model\G_T_typeRepa.cs" />
<Compile Include="Model\RepaModel.cs" />
<Compile Include="ViewModel\RepaModel.cs" />
<Compile Include="UserControlDIY\EventFutur.xaml.cs">
<DependentUpon>EventFutur.xaml</DependentUpon>
</Compile>
@ -117,9 +117,25 @@
<DependentUpon>Repa.xaml</DependentUpon>
</Compile>
<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">
<DependentUpon>DashBoard.xaml</DependentUpon>
</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">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@ -148,10 +164,30 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\Accueil.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\DashBoard.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</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>
<Compile Include="Properties\AssemblyInfo.cs">

View File

@ -28,6 +28,5 @@
</Grid.ColumnDefinitions>
<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"/>
</Grid>
</UserControl>

View File

@ -21,14 +21,10 @@
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<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" />
<TextBlock Text="{Binding Quand}" />
<local:Plat x:Name="Plat1XML" Grid.Row="1"></local:Plat>
<local:Plat x:Name="Plat2XML" Grid.Row="2"></local:Plat>
<local:Plat x:Name="Plat3XML" Grid.Row="3"></local:Plat>
</Grid>
</UserControl>

View File

@ -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<C_T_plat> ListPlat
public RepaModel RM
{
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()
{
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"
Background="{DynamicResource MaterialDesignPaper}"
FontFamily="{DynamicResource MaterialDesignFont}"
Name="wnd">
Name="wnd" Closing="wnd_Closing">
<Window.Resources>
<local:DebugDummyConverter x:Key="DebugDummyConverter" />
</Window.Resources>
@ -32,11 +32,11 @@
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<!--<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
µ
</Grid.RowDefinitions>
<TextBlock ></TextBlock>
<DockPanel>
<ListView x:Name="RepasMatin">
<ListView.ItemContainerStyle>
@ -51,10 +51,11 @@
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</DockPanel>
</DockPanel>-->
<control:Repa x:Name="RepasMatin"></control:Repa>
<materialDesign:PackIcon Kind="Build" Grid.Column="2" HorizontalAlignment="Right" Cursor="Hand"/>
</Grid>
<Grid Grid.Row="1" >
<Grid.ColumnDefinitions>
@ -63,15 +64,19 @@
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<control:EventPasse x:Name="EventPasse1" Classement="{Binding Classement}"></control:EventPasse>
<control:EventPasse x:Name="EventPasse1" Classement="{Binding Classement}" ></control:EventPasse>
<control:EventPasse x:Name="EventPasse2" Classement="{Binding Classement}" Grid.Column="1"></control:EventPasse>
<control:EventFutur Grid.Column="2"></control:EventFutur>
<control:EventFutur Grid.Column="3"></control:EventFutur>
</Grid>
<Grid Grid.Row="2" Visibility="Visible">
<Border>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="356*"/>
<ColumnDefinition Width="147*"/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2">
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="OrangeRed" Offset="0" />
@ -79,8 +84,8 @@
</LinearGradientBrush>
</Border.Background>
</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>
</Window>

View File

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