diff --git a/Sources/IHM/App.xaml.cs b/Sources/IHM/App.xaml.cs
index 9f6cb75..c5f7639 100644
--- a/Sources/IHM/App.xaml.cs
+++ b/Sources/IHM/App.xaml.cs
@@ -16,7 +16,10 @@ namespace IHM
{
MainPage = new UI_Windows.MainPage_Windows();
}
-
+ else if(OperatingSystem.IsAndroid() || OperatingSystem.IsIOS())
+ {
+ MainPage = new MainPage();
+ }
}
}
diff --git a/Sources/IHM/Desktop/MainPage_Windows.xaml b/Sources/IHM/Desktop/MainPage_Windows.xaml
new file mode 100644
index 0000000..2357a9a
--- /dev/null
+++ b/Sources/IHM/Desktop/MainPage_Windows.xaml
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Sources/IHM/Desktop/MainPage_Windows.xaml.cs b/Sources/IHM/Desktop/MainPage_Windows.xaml.cs
new file mode 100644
index 0000000..a9e298e
--- /dev/null
+++ b/Sources/IHM/Desktop/MainPage_Windows.xaml.cs
@@ -0,0 +1,59 @@
+using Model;
+using System.Windows.Input;
+
+namespace IHM.UI_Windows;
+
+public partial class MainPage_Windows : ContentPage
+{
+ public Manager Mgr => (App.Current as App).Manager;
+ public MainPage_Windows()
+ {
+ InitializeComponent();
+ BindingContext = this;
+ }
+
+ public void ConnectionOnClicked(object sender, EventArgs e)
+ {
+ if (EntryMail.Text == null || EntryPassworld.Text == null)
+ {
+ AffichError("Champ invalide", "Veuillez compléter tout les champs", "OK");
+ }
+ else
+ {
+ if (Mgr.existEmail(EntryMail.Text))
+ {
+ if (Mgr.isEqualHash(Mgr.recupMdpBdd(EntryMail.Text), EntryPassworld.Text))
+ {
+ Mgr.LoadInscrit(EntryMail.Text, EntryPassworld.Text);
+ ConnexionValide();
+ }
+ else
+ {
+ AffichError("Mot de passe non valide", "Le mot de passe ne correspond pas à celui existant pout cette adresse mail", "OK");
+ }
+ }
+ else
+ {
+ AffichError("Compte inexistant", "Email ou mot de passe invalide", "OK");
+ }
+ }
+ }
+
+ private async void ConnexionValide()
+ {
+ await Navigation.PopModalAsync();
+ }
+
+ private async void AffichError(string s, string s1, string s2)
+ {
+ await DisplayAlert(s, s1, s2);
+ }
+
+ protected override bool OnBackButtonPressed()
+ {
+ return true;
+ }
+
+ //Exception à gérer pour cette version desktop
+ public ICommand TapCommand => new Command(async (page) => await Shell.Current.GoToAsync(page));
+}
\ No newline at end of file
diff --git a/Sources/IHM/Desktop/logo_sans_fond.png b/Sources/IHM/Desktop/logo_sans_fond.png
new file mode 100644
index 0000000..7ab20ec
Binary files /dev/null and b/Sources/IHM/Desktop/logo_sans_fond.png differ
diff --git a/Sources/IHM/IHM.csproj b/Sources/IHM/IHM.csproj
index f515366..a4e594d 100644
--- a/Sources/IHM/IHM.csproj
+++ b/Sources/IHM/IHM.csproj
@@ -33,6 +33,9 @@
+
+ PreserveNewest
+
@@ -54,6 +57,10 @@
+
+
+
+
@@ -73,9 +80,6 @@
MSBuild:Compile
-
- MSBuild:Compile
-
MSBuild:Compile
@@ -91,7 +95,7 @@
MSBuild:Compile
-
+
MSBuild:Compile
diff --git a/Sources/IHM/Mobile/ChangePassword.xaml b/Sources/IHM/Mobile/ChangePassword.xaml
new file mode 100644
index 0000000..673404d
--- /dev/null
+++ b/Sources/IHM/Mobile/ChangePassword.xaml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Sources/IHM/Mobile/ChangePassword.xaml.cs b/Sources/IHM/Mobile/ChangePassword.xaml.cs
new file mode 100644
index 0000000..5f31f93
--- /dev/null
+++ b/Sources/IHM/Mobile/ChangePassword.xaml.cs
@@ -0,0 +1,45 @@
+using Model;
+
+namespace IHM;
+
+public partial class ChangePassword : ContentPage
+{
+ public Manager Mgr => (App.Current as App).Manager;
+ private string MailUser;
+ public ChangePassword(string mailUser)
+ {
+ InitializeComponent();
+ MailUser = mailUser;
+ }
+
+ private void ValidationButton_Clicked(object sender, EventArgs e)
+ {
+ if (EntryNewMdp.Text == null || EntryNewMdpConfirmation.Text == null)
+ {
+ AffichError("Champ non valide", "Veuillez remplir tout les champs", "OK");
+ }
+ else {
+ if (!EntryNewMdp.Text.Equals(EntryNewMdpConfirmation.Text))
+ {
+ AffichError("mot de passe non identique", "veuillez entrer des mots de passe identique", "OK");
+ }
+ else
+ {
+ Mgr.changePasswordBdd(MailUser, EntryNewMdp.Text);
+ AffichError("mdp changé", "mot de passe bien changé", "ok");
+ NavigateTo("../..");
+ }
+ }
+ }
+
+ private async void NavigateTo(string path)
+ {
+ await Shell.Current.GoToAsync(path);
+ }
+
+
+ private async void AffichError(string s, string s1, string s2)
+ {
+ await DisplayAlert(s, s1, s2);
+ }
+}
\ No newline at end of file
diff --git a/Sources/IHM/Mobile/Dashboard.xaml b/Sources/IHM/Mobile/Dashboard.xaml
new file mode 100644
index 0000000..d3ac65d
--- /dev/null
+++ b/Sources/IHM/Mobile/Dashboard.xaml
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Sources/IHM/Mobile/Dashboard.xaml.cs b/Sources/IHM/Mobile/Dashboard.xaml.cs
new file mode 100644
index 0000000..dabbff7
--- /dev/null
+++ b/Sources/IHM/Mobile/Dashboard.xaml.cs
@@ -0,0 +1,27 @@
+using Model;
+
+namespace IHM;
+
+public partial class DashBoard : ContentPage
+{
+ public Manager Mgr => (App.Current as App).Manager;
+ public DashBoard()
+ {
+ InitializeComponent();
+ //Routing.RegisterRoute(nameof(DashBoard), typeof(DashBoard));
+
+
+ if (Mgr.SelectedInscrit == null)
+ {
+ loadInscription();
+ }
+
+
+
+ }
+
+ public async void loadInscription()
+ {
+ await Navigation.PushModalAsync(new MainPage());
+ }
+}
\ No newline at end of file
diff --git a/Sources/IHM/Mobile/ForgetPassword.xaml b/Sources/IHM/Mobile/ForgetPassword.xaml
new file mode 100644
index 0000000..92c34bb
--- /dev/null
+++ b/Sources/IHM/Mobile/ForgetPassword.xaml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Sources/IHM/ForgetPassword.xaml.cs b/Sources/IHM/Mobile/ForgetPassword.xaml.cs
similarity index 67%
rename from Sources/IHM/ForgetPassword.xaml.cs
rename to Sources/IHM/Mobile/ForgetPassword.xaml.cs
index b4eac3f..795a774 100644
--- a/Sources/IHM/ForgetPassword.xaml.cs
+++ b/Sources/IHM/Mobile/ForgetPassword.xaml.cs
@@ -7,6 +7,9 @@ public partial class ForgetPassword : ContentPage
{
public Manager Mgr => (App.Current as App).Manager;
private string code;
+ //private DateTime _startTime;
+ //private CancellationTokenSource _cancellationTokenSource;
+
public ForgetPassword()
{
InitializeComponent();
@@ -22,14 +25,30 @@ public partial class ForgetPassword : ContentPage
code = generator.Next(0, 1000000).ToString("D6");
Email.CreateMail(EntryMail.Text, code);
ValidateReceptCode.IsVisible = true;
+ ConnexionButton.IsEnabled = false;
+ UpdateArc();
}
}
private async void AffichError(string s, string s1, string s2)
{
await DisplayAlert(s, s1, s2);
}
+ private async void UpdateArc()
+ {
+ int timeRemaining = 60;
+ while (timeRemaining != 0)
+ {
+ ConnexionButton.Text = $"{timeRemaining}";
+
+ timeRemaining--;
- private void ValideCode(object sender, EventArgs e)
+ await Task.Delay(1000);
+ }
+
+ ConnexionButton.Text = "valider Email";
+ ConnexionButton.IsEnabled = true;
+ }
+ private void ValideCode(object sender, EventArgs e)
{
if(EntryCodeRecept.Text == code)
{
diff --git a/Sources/IHM/Mobile/Inscription.xaml b/Sources/IHM/Mobile/Inscription.xaml
new file mode 100644
index 0000000..26f4cea
--- /dev/null
+++ b/Sources/IHM/Mobile/Inscription.xaml
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Sources/IHM/Mobile/Inscription.xaml.cs b/Sources/IHM/Mobile/Inscription.xaml.cs
new file mode 100644
index 0000000..bc88336
--- /dev/null
+++ b/Sources/IHM/Mobile/Inscription.xaml.cs
@@ -0,0 +1,73 @@
+using Model;
+using Email = Model.Email;
+
+namespace IHM;
+
+public partial class Inscription : ContentPage
+{
+ private string code;
+ public Manager Mgr => (App.Current as App).Manager;
+ public Inscription()
+ {
+ InitializeComponent();
+ }
+ public void InscriptionOnClicked(object sender, EventArgs e)
+ {
+ if (EntryNewName.Text == null || EntryNewMail.Text == null || EntryConfirmationPassword.Text == null || EntryNewPassword.Text == null ||
+ EntryNewSurname.Text == null)
+ {
+ AffichError("Champ invalide", "Veuillez compléter tout les champs", "OK");
+ }
+ else
+ {
+ if(EntryNewPassword.Text.Equals(EntryConfirmationPassword.Text)) {
+ if (Mgr.existEmail(EntryNewMail.Text))
+ {
+ AffichError("Mail existant", "un compte porte déjà cette adresse mail, veuillez en changer", "OK");
+ }
+ else
+ {
+ try
+ {
+ Random generator = new Random();
+ code = generator.Next(0, 1000000).ToString("D6");
+ Email.CreateMail(EntryNewMail.Text, code);
+ ValidateReceptCode.IsVisible = true;
+ }
+ catch (Exception ex)
+ {
+ AffichError("Information invalide", ex.Message, "OK");
+ }
+ }
+ }
+ else
+ {
+ AffichError("Mot de passe de confirmation invalide", "Veuillez mettre deux mots de passe identiques", "OK");
+ }
+ }
+ }
+ private void ValideCode(object sender, EventArgs e)
+ {
+ if (EntryCodeRecept.Text == code)
+ {
+ Inscrit inscrit = new Inscrit(Mgr.lastInscrit() + 1, EntryNewName.Text, EntryNewMail.Text, EntryNewSurname.Text, EntryNewPassword.Text);
+ Mgr.createInscrit(inscrit);
+ AffichError("compte créé", "Compte bien créé", "OK");
+ NavigateTo("..");
+ }
+ else
+ {
+ AffichError("Code non identique", "Veuillez entrer le même code que celui reçu par mail", "OK");
+ }
+ }
+
+ private async void AffichError(string s, string s1, string s2)
+ {
+ await DisplayAlert(s, s1, s2);
+ }
+
+ private async void NavigateTo(string s)
+ {
+ await Shell.Current.GoToAsync(s);
+ }
+}
\ No newline at end of file
diff --git a/Sources/IHM/MainPage.xaml b/Sources/IHM/Mobile/MainPage.xaml
similarity index 73%
rename from Sources/IHM/MainPage.xaml
rename to Sources/IHM/Mobile/MainPage.xaml
index 109a56e..a251167 100644
--- a/Sources/IHM/MainPage.xaml
+++ b/Sources/IHM/Mobile/MainPage.xaml
@@ -10,26 +10,27 @@
VerticalOptions="Start">
-
+
-
-
+
-
-
+