From 43877415f9b4a312f004f3501942a4474793f81c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi?= Date: Fri, 31 May 2024 19:27:20 +0200 Subject: [PATCH] Binding du stub de plusieurs players via un datatemplate --- source/Trek-12/Stub/Stub.cs | 2 +- .../Components/ContentLeaderBoard.xaml.cs | 36 ------------------- .../Views/Components/viewsProfils.xaml.cs | 9 ----- .../Resources/Views/pageProfils.xaml.cs | 9 ----- source/Trek-12/Trek-12/Trek-12.csproj | 10 +++--- .../Views/Components/ContentLeaderBoard.xaml | 0 .../Components/ContentLeaderBoard.xaml.cs | 10 ++++++ .../Views/Components/viewsProfils.xaml | 7 ++-- .../Views/Components/viewsProfils.xaml.cs | 28 +++++++++++++++ .../Views/PageLeaderBoard.xaml | 9 +++-- .../Views/PageLeaderBoard.xaml.cs | 2 +- .../Views/PageMenuPrincipal.xaml | 0 .../Views/PageMenuPrincipal.xaml.cs | 0 .../{Resources => }/Views/pageProfils.xaml | 22 ++++++------ .../Trek-12/Trek-12/Views/pageProfils.xaml.cs | 13 +++++++ .../{Resources => }/Views/pageRegles.xaml | 0 .../{Resources => }/Views/pageRegles.xaml.cs | 0 17 files changed, 77 insertions(+), 80 deletions(-) delete mode 100644 source/Trek-12/Trek-12/Resources/Views/Components/ContentLeaderBoard.xaml.cs delete mode 100644 source/Trek-12/Trek-12/Resources/Views/Components/viewsProfils.xaml.cs delete mode 100644 source/Trek-12/Trek-12/Resources/Views/pageProfils.xaml.cs rename source/Trek-12/Trek-12/{Resources => }/Views/Components/ContentLeaderBoard.xaml (100%) create mode 100644 source/Trek-12/Trek-12/Views/Components/ContentLeaderBoard.xaml.cs rename source/Trek-12/Trek-12/{Resources => }/Views/Components/viewsProfils.xaml (68%) create mode 100644 source/Trek-12/Trek-12/Views/Components/viewsProfils.xaml.cs rename source/Trek-12/Trek-12/{Resources => }/Views/PageLeaderBoard.xaml (87%) rename source/Trek-12/Trek-12/{Resources => }/Views/PageLeaderBoard.xaml.cs (86%) rename source/Trek-12/Trek-12/{Resources => }/Views/PageMenuPrincipal.xaml (100%) rename source/Trek-12/Trek-12/{Resources => }/Views/PageMenuPrincipal.xaml.cs (100%) rename source/Trek-12/Trek-12/{Resources => }/Views/pageProfils.xaml (65%) create mode 100644 source/Trek-12/Trek-12/Views/pageProfils.xaml.cs rename source/Trek-12/Trek-12/{Resources => }/Views/pageRegles.xaml (100%) rename source/Trek-12/Trek-12/{Resources => }/Views/pageRegles.xaml.cs (100%) diff --git a/source/Trek-12/Stub/Stub.cs b/source/Trek-12/Stub/Stub.cs index 03b7013..2008dca 100644 --- a/source/Trek-12/Stub/Stub.cs +++ b/source/Trek-12/Stub/Stub.cs @@ -20,7 +20,7 @@ namespace Stub { listplayer.Add(new Player()); - listplayer.Add(new Player("Lucas")); + listplayer.Add(new Player("Lucas", "profile.jpg")); listplayer.Add(new Player("relavergne")); listplayer.Add(new Player("reneveu")); diff --git a/source/Trek-12/Trek-12/Resources/Views/Components/ContentLeaderBoard.xaml.cs b/source/Trek-12/Trek-12/Resources/Views/Components/ContentLeaderBoard.xaml.cs deleted file mode 100644 index 0328d08..0000000 --- a/source/Trek-12/Trek-12/Resources/Views/Components/ContentLeaderBoard.xaml.cs +++ /dev/null @@ -1,36 +0,0 @@ -namespace Trek_12.Views.Components; - -public partial class ContentLeaderBoard : ContentView -{ - public ContentLeaderBoard() - { - InitializeComponent(); - } - - public static readonly BindableProperty Pseudo = - BindableProperty.Create("Pseudo", typeof(string), typeof(ContentLeaderBoard), ""); - - public string Pseudo - { - get => (string)GetValue(Pseudo); - set => SetValue(Pseudo, value); - } - - public static readonly BindableProperty Pseudo = - BindableProperty.Create("Title", typeof(string), typeof(ContentLeaderBoard), "No Title"); - - public string Title - { - get => (string)GetValue(TitleProperty); - set => SetValue(TitleProperty, value); - } - - public static readonly BindableProperty SubTitleProperty = - BindableProperty.Create("SubTitle", typeof(string), typeof(ContentLeaderBoard), "Lorem Ipsum Dolor"); - - public string SubTitle - { - get => (string)GetValue(SubTitleProperty); - set => SetValue(SubTitleProperty, value); - } -} \ No newline at end of file diff --git a/source/Trek-12/Trek-12/Resources/Views/Components/viewsProfils.xaml.cs b/source/Trek-12/Trek-12/Resources/Views/Components/viewsProfils.xaml.cs deleted file mode 100644 index 330b631..0000000 --- a/source/Trek-12/Trek-12/Resources/Views/Components/viewsProfils.xaml.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Trek_12.Views.Components; - -public partial class viewsProfils : ContentView -{ - public viewsProfils() - { - InitializeComponent(); - } -} \ No newline at end of file diff --git a/source/Trek-12/Trek-12/Resources/Views/pageProfils.xaml.cs b/source/Trek-12/Trek-12/Resources/Views/pageProfils.xaml.cs deleted file mode 100644 index f312177..0000000 --- a/source/Trek-12/Trek-12/Resources/Views/pageProfils.xaml.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Trek_12.Views; - -public partial class PageProfils : ContentPage -{ - public PageProfils() - { - InitializeComponent(); - } -} \ No newline at end of file diff --git a/source/Trek-12/Trek-12/Trek-12.csproj b/source/Trek-12/Trek-12/Trek-12.csproj index beef780..6fa80dd 100644 --- a/source/Trek-12/Trek-12/Trek-12.csproj +++ b/source/Trek-12/Trek-12/Trek-12.csproj @@ -69,22 +69,22 @@ - + PageLeaderBoard.xaml - + PageProfils.xaml - + PageRegles.xaml - + MSBuild:Compile - + MSBuild:Compile diff --git a/source/Trek-12/Trek-12/Resources/Views/Components/ContentLeaderBoard.xaml b/source/Trek-12/Trek-12/Views/Components/ContentLeaderBoard.xaml similarity index 100% rename from source/Trek-12/Trek-12/Resources/Views/Components/ContentLeaderBoard.xaml rename to source/Trek-12/Trek-12/Views/Components/ContentLeaderBoard.xaml diff --git a/source/Trek-12/Trek-12/Views/Components/ContentLeaderBoard.xaml.cs b/source/Trek-12/Trek-12/Views/Components/ContentLeaderBoard.xaml.cs new file mode 100644 index 0000000..2f8d34a --- /dev/null +++ b/source/Trek-12/Trek-12/Views/Components/ContentLeaderBoard.xaml.cs @@ -0,0 +1,10 @@ +namespace Trek_12.Views.Components; + +public partial class ContentLeaderBoard : ContentView +{ + public ContentLeaderBoard() + { + InitializeComponent(); + } + +} \ No newline at end of file diff --git a/source/Trek-12/Trek-12/Resources/Views/Components/viewsProfils.xaml b/source/Trek-12/Trek-12/Views/Components/viewsProfils.xaml similarity index 68% rename from source/Trek-12/Trek-12/Resources/Views/Components/viewsProfils.xaml rename to source/Trek-12/Trek-12/Views/Components/viewsProfils.xaml index 3b15b2c..474f88c 100644 --- a/source/Trek-12/Trek-12/Resources/Views/Components/viewsProfils.xaml +++ b/source/Trek-12/Trek-12/Views/Components/viewsProfils.xaml @@ -1,7 +1,8 @@ + x:Class="Trek_12.Views.Components.viewsProfils" + x:Name="this"> - - diff --git a/source/Trek-12/Trek-12/Views/Components/viewsProfils.xaml.cs b/source/Trek-12/Trek-12/Views/Components/viewsProfils.xaml.cs new file mode 100644 index 0000000..a203e56 --- /dev/null +++ b/source/Trek-12/Trek-12/Views/Components/viewsProfils.xaml.cs @@ -0,0 +1,28 @@ +namespace Trek_12.Views.Components; + +public partial class viewsProfils : ContentView +{ + public viewsProfils() + { + InitializeComponent(); + } + + public static readonly BindableProperty PseudoProperty = + BindableProperty.Create("Pseudo", typeof(string), typeof(ContentLeaderBoard), "Profile n°*"); + + public string Pseudo + { + get => (string)GetValue(PseudoProperty); + set => SetValue(PseudoProperty, value); + } + + + public static readonly BindableProperty ProfilePictureProperty = + BindableProperty.Create("ProfilePicture", typeof(string), typeof(ContentLeaderBoard), "profile.jpg"); + + public string ProfilePicture + { + get => (string)GetValue(ProfilePictureProperty); + set => SetValue(ProfilePictureProperty, value); + } +} \ No newline at end of file diff --git a/source/Trek-12/Trek-12/Resources/Views/PageLeaderBoard.xaml b/source/Trek-12/Trek-12/Views/PageLeaderBoard.xaml similarity index 87% rename from source/Trek-12/Trek-12/Resources/Views/PageLeaderBoard.xaml rename to source/Trek-12/Trek-12/Views/PageLeaderBoard.xaml index 9831512..447466b 100644 --- a/source/Trek-12/Trek-12/Resources/Views/PageLeaderBoard.xaml +++ b/source/Trek-12/Trek-12/Views/PageLeaderBoard.xaml @@ -2,7 +2,6 @@ @@ -31,16 +30,16 @@ Margin="0,10"> - + + --> diff --git a/source/Trek-12/Trek-12/Resources/Views/PageLeaderBoard.xaml.cs b/source/Trek-12/Trek-12/Views/PageLeaderBoard.xaml.cs similarity index 86% rename from source/Trek-12/Trek-12/Resources/Views/PageLeaderBoard.xaml.cs rename to source/Trek-12/Trek-12/Views/PageLeaderBoard.xaml.cs index 8d65cbb..53428fc 100644 --- a/source/Trek-12/Trek-12/Resources/Views/PageLeaderBoard.xaml.cs +++ b/source/Trek-12/Trek-12/Views/PageLeaderBoard.xaml.cs @@ -6,7 +6,7 @@ public partial class PageLeaderBoard : ContentPage public Stub MyStub { get; set; } = new Stub(); public PageLeaderBoard() { - InitializeComponent(); + //InitializeComponent(); BindingContext = MyStub; } } \ No newline at end of file diff --git a/source/Trek-12/Trek-12/Resources/Views/PageMenuPrincipal.xaml b/source/Trek-12/Trek-12/Views/PageMenuPrincipal.xaml similarity index 100% rename from source/Trek-12/Trek-12/Resources/Views/PageMenuPrincipal.xaml rename to source/Trek-12/Trek-12/Views/PageMenuPrincipal.xaml diff --git a/source/Trek-12/Trek-12/Resources/Views/PageMenuPrincipal.xaml.cs b/source/Trek-12/Trek-12/Views/PageMenuPrincipal.xaml.cs similarity index 100% rename from source/Trek-12/Trek-12/Resources/Views/PageMenuPrincipal.xaml.cs rename to source/Trek-12/Trek-12/Views/PageMenuPrincipal.xaml.cs diff --git a/source/Trek-12/Trek-12/Resources/Views/pageProfils.xaml b/source/Trek-12/Trek-12/Views/pageProfils.xaml similarity index 65% rename from source/Trek-12/Trek-12/Resources/Views/pageProfils.xaml rename to source/Trek-12/Trek-12/Views/pageProfils.xaml index 54346a9..12a2cb3 100644 --- a/source/Trek-12/Trek-12/Resources/Views/pageProfils.xaml +++ b/source/Trek-12/Trek-12/Views/pageProfils.xaml @@ -14,18 +14,18 @@