diff --git a/MCTG/Model/User/User.cs b/MCTG/Model/User/User.cs index 013bbe1..cbcb5e5 100644 --- a/MCTG/Model/User/User.cs +++ b/MCTG/Model/User/User.cs @@ -8,6 +8,7 @@ using System.Runtime.CompilerServices; using System.Text.RegularExpressions; using System.Text; using System.Runtime.Serialization; +using System.ComponentModel; namespace Model { @@ -16,7 +17,7 @@ namespace Model /// This user can login with an Id and a password /// [DataContract(Name = "user")] - public class User : IEquatable + public class User : IEquatable , INotifyPropertyChanged { #region Private Attributes @@ -26,6 +27,8 @@ namespace Model [DataMember] private string picture = ""; [DataMember] private int password ; [DataMember] private List priorities; + + public event PropertyChangedEventHandler? PropertyChanged; #endregion #region Properties @@ -44,6 +47,7 @@ namespace Model throw new ArgumentException("Impossible d'avoir un champ Nom vide!"); } name = value; + OnPropertyChanged(); } } @@ -61,6 +65,7 @@ namespace Model throw new ArgumentException("Impossible d'avoir un champ Prénom vide!"); } surname = value; + OnPropertyChanged(); } } @@ -130,6 +135,21 @@ namespace Model throw new NotImplementedException(); } + + protected void OnPropertyChanged ([CallerMemberName] string? propertyName = null) + { + if (PropertyChanged != null) + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + public override string ToString() + { + return $"{Name} {Surname}"; + } + + + + #endregion diff --git a/MCTG/Views/App.xaml.cs b/MCTG/Views/App.xaml.cs index 304aed5..59c681f 100644 --- a/MCTG/Views/App.xaml.cs +++ b/MCTG/Views/App.xaml.cs @@ -4,10 +4,13 @@ using Microsoft.UI.Windowing; using Windows.Graphics; #endif +using DataPersistence; + namespace Views { public partial class App : Application { + public DataManager DataMgr { get; private set; } = new DataManager(new Stubs()); const int WindowWidth = 1200; const int WindowHeight = 800; diff --git a/MCTG/Views/ContainerFlyout.xaml b/MCTG/Views/ContainerFlyout.xaml index 77a742e..0001b22 100644 --- a/MCTG/Views/ContainerFlyout.xaml +++ b/MCTG/Views/ContainerFlyout.xaml @@ -28,7 +28,7 @@ Style="{StaticResource button2}" IsVisible="{Binding IsNotConnected, Source={x:Reference fl}}" IsEnabled="{Binding IsNotConnected, Source={x:Reference fl}}"/> -