diff --git a/source/Trek-12/Models/Game/Player.cs b/source/Trek-12/Models/Game/Player.cs
index f363eb4..97940d4 100644
--- a/source/Trek-12/Models/Game/Player.cs
+++ b/source/Trek-12/Models/Game/Player.cs
@@ -1,15 +1,37 @@
-namespace Models.Game
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+
+namespace Models.Game
{
///
/// Represents a player in the game.
///
- public class Player
+ public class Player : INotifyPropertyChanged
{
+
+ public event PropertyChangedEventHandler? PropertyChanged;
+
+ void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+
+
///
/// It is he pseudo of the player.
///
- public string Pseudo { get; private set; }
+ private string _pseudo;
+ public string Pseudo
+ {
+ get => _pseudo;
+ set
+ {
+ if (_pseudo == value)
+ return;
+ _pseudo = value;
+ OnPropertyChanged();
+ }
+ }
+ private int hairCount;
///
/// It is the profile picture of the player.
@@ -46,6 +68,7 @@
ProfilePicture = profilePicture;
}
+
///
/// Chooses the operation for the player.
///
diff --git a/source/Trek-12/Stub/Stub.cs b/source/Trek-12/Stub/Stub.cs
new file mode 100644
index 0000000..46a4511
--- /dev/null
+++ b/source/Trek-12/Stub/Stub.cs
@@ -0,0 +1,51 @@
+using System.Collections.ObjectModel;
+using System.Data;
+using System.Numerics;
+using Models.Game;
+
+namespace Stub
+{
+ public class Stub
+ {
+ public ReadOnlyObservableCollection ListPlayer { get; private set; }
+ private readonly ObservableCollection listplayer = new ObservableCollection();
+
+ public Stub()
+ {
+ LoadPlayer();
+ ListPlayer = new ReadOnlyObservableCollection(listplayer);
+ }
+
+ public void LoadPlayer()
+ {
+
+ listplayer.Add(new Player());
+ listplayer.Add(new Player("Lucas", "profile.jpg"));
+ listplayer.Add(new Player("relavergne", "profile.jpg"));
+ listplayer.Add(new Player("reneveu", "profile.jpg"));
+
+ }
+
+ public void Add(string pseudo, string profilePicture)
+ {
+ listplayer.Add(new Player(pseudo, profilePicture));
+ }
+
+ public void Pop(string pseudo, string profilePicture)
+ {
+ listplayer.Remove(new Player(pseudo, profilePicture));
+ }
+ public bool Modify(string pseudo, string newpseudo)
+ {
+ foreach(var index in listplayer)
+ {
+ if (index.Pseudo == pseudo)
+ {
+ index.Pseudo = newpseudo;
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+}
diff --git a/source/Trek-12/Stub/Stub.csproj b/source/Trek-12/Stub/Stub.csproj
new file mode 100644
index 0000000..8dcc508
--- /dev/null
+++ b/source/Trek-12/Stub/Stub.csproj
@@ -0,0 +1,13 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/source/Trek-12/Trek-12.sln b/source/Trek-12/Trek-12.sln
index fda4705..4ce1243 100644
--- a/source/Trek-12/Trek-12.sln
+++ b/source/Trek-12/Trek-12.sln
@@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataContractPersistence", "DataContractPersistence\DataContractPersistence.csproj", "{FC6A23C3-A1E3-4BF4-85B0-404D8574E190}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stub", "Stub\Stub.csproj", "{49360F7D-C59D-4B4F-AF5A-73FF61D9EF9B}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -41,6 +43,10 @@ Global
{FC6A23C3-A1E3-4BF4-85B0-404D8574E190}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC6A23C3-A1E3-4BF4-85B0-404D8574E190}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC6A23C3-A1E3-4BF4-85B0-404D8574E190}.Release|Any CPU.Build.0 = Release|Any CPU
+ {49360F7D-C59D-4B4F-AF5A-73FF61D9EF9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {49360F7D-C59D-4B4F-AF5A-73FF61D9EF9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {49360F7D-C59D-4B4F-AF5A-73FF61D9EF9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {49360F7D-C59D-4B4F-AF5A-73FF61D9EF9B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/source/Trek-12/Trek-12/Trek-12.csproj b/source/Trek-12/Trek-12/Trek-12.csproj
index 51d65e3..6fa80dd 100644
--- a/source/Trek-12/Trek-12/Trek-12.csproj
+++ b/source/Trek-12/Trek-12/Trek-12.csproj
@@ -63,6 +63,11 @@
+
+
+
+
+
PageLeaderBoard.xaml
@@ -82,9 +87,6 @@
MSBuild:Compile
-
- MSBuild:Compile
-
diff --git a/source/Trek-12/Trek-12/Views/Components/viewsProfils.xaml b/source/Trek-12/Trek-12/Views/Components/viewsProfils.xaml
index 3b15b2c..474f88c 100644
--- a/source/Trek-12/Trek-12/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
index 330b631..a203e56 100644
--- a/source/Trek-12/Trek-12/Views/Components/viewsProfils.xaml.cs
+++ b/source/Trek-12/Trek-12/Views/Components/viewsProfils.xaml.cs
@@ -6,4 +6,23 @@ public partial class viewsProfils : ContentView
{
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/Views/PageLeaderBoard.xaml b/source/Trek-12/Trek-12/Views/PageLeaderBoard.xaml
index fb1dff7..2dd8ff3 100644
--- a/source/Trek-12/Trek-12/Views/PageLeaderBoard.xaml
+++ b/source/Trek-12/Trek-12/Views/PageLeaderBoard.xaml
@@ -1,43 +1,43 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source/Trek-12/Trek-12/Views/PageLeaderBoard.xaml.cs b/source/Trek-12/Trek-12/Views/PageLeaderBoard.xaml.cs
index 543413d..ff190c0 100644
--- a/source/Trek-12/Trek-12/Views/PageLeaderBoard.xaml.cs
+++ b/source/Trek-12/Trek-12/Views/PageLeaderBoard.xaml.cs
@@ -1,9 +1,9 @@
-namespace Trek_12.Views;
-
-public partial class PageLeaderBoard : ContentPage
-{
- public PageLeaderBoard()
- {
- InitializeComponent();
- }
+namespace Trek_12.Views;
+
+public partial class PageLeaderBoard : ContentPage
+{
+ public PageLeaderBoard()
+ {
+ InitializeComponent();
+ }
}
\ No newline at end of file
diff --git a/source/Trek-12/Trek-12/Views/pageProfils.xaml b/source/Trek-12/Trek-12/Views/pageProfils.xaml
index 54346a9..ac1720c 100644
--- a/source/Trek-12/Trek-12/Views/pageProfils.xaml
+++ b/source/Trek-12/Trek-12/Views/pageProfils.xaml
@@ -14,22 +14,22 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
diff --git a/source/Trek-12/Trek-12/Views/pageProfils.xaml.cs b/source/Trek-12/Trek-12/Views/pageProfils.xaml.cs
index f312177..9047a40 100644
--- a/source/Trek-12/Trek-12/Views/pageProfils.xaml.cs
+++ b/source/Trek-12/Trek-12/Views/pageProfils.xaml.cs
@@ -1,9 +1,66 @@
namespace Trek_12.Views;
+using Stub;
+using System.Diagnostics;
+using CommunityToolkit.Maui.Alerts;
+using CommunityToolkit.Maui.Core;
public partial class PageProfils : ContentPage
{
- public PageProfils()
+ public Stub MyStub { get; set; } = new Stub();
+
+ public PageProfils()
{
InitializeComponent();
+ BindingContext = MyStub;
}
-}
\ No newline at end of file
+
+
+ async void Button_ClickedAdd(System.Object sender, System.EventArgs e)
+ {
+ string result = await DisplayPromptAsync("Info", $"Choose a name : ", "Ok");
+ Debug.WriteLine("Answer: " + result);
+ if (result != null)
+ {
+ Debug.WriteLine("bam, added");
+ MyStub.Add(result, "profile.jpg");
+ }
+ }
+
+
+ async void Button_ClickedPop(System.Object sender, System.EventArgs e)
+ {
+ string result = await DisplayPromptAsync("Info", $"Choose a name to delete : ", "Ok");
+ Debug.WriteLine("Answer: " + result);
+ if (result != null)
+ {
+ Debug.WriteLine("bam, deleted");
+ MyStub.Pop(result, "profile.jpg");
+ }
+ else Debug.WriteLine("Pseudo not found");
+ }
+
+ async void Button_ClickedModify(System.Object sender, System.EventArgs e)
+ {
+ string result = await DisplayPromptAsync("Info", $"Choose a name to modify : ", "Ok");
+ Debug.WriteLine("Answer: " + result);
+ if (result != null)
+ {
+ string tomodify = await DisplayPromptAsync("Info", $"How will you rename it ?: ", "Ok");
+ Debug.WriteLine("Answer: " + tomodify);
+ if (tomodify != null)
+ {
+ Debug.WriteLine("bam, modified");
+ bool ismodified = MyStub.Modify(result, tomodify);
+
+ if (ismodified)
+ {
+ Debug.WriteLine("Modified");
+ }
+ else Debug.WriteLine("Player not found");
+ }
+ }
+ else Debug.WriteLine("Did not found");
+ }
+
+}
+