diff --git a/CanYouBuildIt/CanYouBuildIt.csproj b/CanYouBuildIt/CanYouBuildIt.csproj
index 3df0b26..4bd2aa5 100644
--- a/CanYouBuildIt/CanYouBuildIt.csproj
+++ b/CanYouBuildIt/CanYouBuildIt.csproj
@@ -62,6 +62,9 @@
MSBuild:Compile
+
+ MSBuild:Compile
+
diff --git a/CanYouBuildIt/Data/UserData.xml b/CanYouBuildIt/Data/UserData.xml
index 54528a5..abe6565 100644
--- a/CanYouBuildIt/Data/UserData.xml
+++ b/CanYouBuildIt/Data/UserData.xml
@@ -79,5 +79,12 @@
0000
Kevin
+
+
+
+
+ 0123
+ tt
+
\ No newline at end of file
diff --git a/CanYouBuildIt/Model/Manager.cs b/CanYouBuildIt/Model/Manager.cs
index cf8c60b..3bb4ec0 100644
--- a/CanYouBuildIt/Model/Manager.cs
+++ b/CanYouBuildIt/Model/Manager.cs
@@ -47,9 +47,10 @@ namespace CanYouBuildIt.Model
Persi.sauvegardeDonnee(data);
}
- public void ajouterUtilisateur(Utilisateur utilisateur)
+ public int ajouterUtilisateur(Utilisateur utilisateur)
{
listUtil.Add(utilisateur);
+ return listUtil.Count-1 ;
}
public void ajouterComposant(Composant composant)
diff --git a/CanYouBuildIt/Views/Acceuil.xaml.cs b/CanYouBuildIt/Views/Acceuil.xaml.cs
index 2a08a0a..cac79eb 100644
--- a/CanYouBuildIt/Views/Acceuil.xaml.cs
+++ b/CanYouBuildIt/Views/Acceuil.xaml.cs
@@ -14,6 +14,8 @@ public partial class Acceuil : ContentPage
{
InitializeComponent();
BindingContext = manager;
+ if (connecte)
+ Log.Text = "{Binding ListUtil[user].username}";
}
public Acceuil(int iduser)
@@ -47,6 +49,7 @@ public partial class Acceuil : ContentPage
{
await Navigation.PushAsync(new Credits());
}
+
private async void NavLogin(object sender, EventArgs e)
{
await Navigation.PushAsync(new Login());
diff --git a/CanYouBuildIt/Views/Login.xaml b/CanYouBuildIt/Views/Login.xaml
index ea046f9..e4d2942 100644
--- a/CanYouBuildIt/Views/Login.xaml
+++ b/CanYouBuildIt/Views/Login.xaml
@@ -15,28 +15,30 @@
Margin="25,60,25,0"/>
+ TextColor="Black"
+ x:Name="Nom"/>
+ TextColor="Black"
+ x:Name="Mdp"/>
diff --git a/CanYouBuildIt/Views/Login.xaml.cs b/CanYouBuildIt/Views/Login.xaml.cs
index b439fe8..75752c3 100644
--- a/CanYouBuildIt/Views/Login.xaml.cs
+++ b/CanYouBuildIt/Views/Login.xaml.cs
@@ -40,4 +40,9 @@ public partial class Login : ContentPage
{
await Navigation.PopAsync();
}
+
+ private async void NavSignIn(object sender, EventArgs e)
+ {
+ await Navigation.PushAsync(new SignIn());
+ }
}
\ No newline at end of file
diff --git a/CanYouBuildIt/Views/SignIn.xaml b/CanYouBuildIt/Views/SignIn.xaml
new file mode 100644
index 0000000..10ffc95
--- /dev/null
+++ b/CanYouBuildIt/Views/SignIn.xaml
@@ -0,0 +1,122 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CanYouBuildIt/Views/SignIn.xaml.cs b/CanYouBuildIt/Views/SignIn.xaml.cs
new file mode 100644
index 0000000..4295851
--- /dev/null
+++ b/CanYouBuildIt/Views/SignIn.xaml.cs
@@ -0,0 +1,47 @@
+namespace CanYouBuildIt.Views;
+using CanYouBuildIt.Model;
+
+public partial class SignIn : ContentPage
+{
+ public Manager manager => (App.Current as App).manager;
+ public SignIn()
+ {
+ InitializeComponent();
+ }
+
+ private async void BtValider(object sender, EventArgs e)
+ {
+ vide.IsVisible = false;
+ wrong.IsVisible = false;
+ nequal.IsVisible = false;
+ userNameUsed.IsVisible = false;
+
+ //recupérer les valeurs d'entrées
+ string MdpUtil = Mdp.Text;
+ string cMdpUtil = cMdp.Text;
+ string Name = Nom.Text;
+
+ if (Name == null || MdpUtil == null || cMdpUtil ==null)
+ vide.IsVisible = true;
+ else if (MdpUtil.Length <4)
+ wrong.IsVisible=true;
+ else if (MdpUtil != cMdpUtil)
+ nequal.IsVisible = true;
+ else if (manager.rechercheUsername(Name) != -1)
+ userNameUsed.IsVisible = true;
+ else
+ {
+ valide.IsVisible = true;
+ await Task.Delay(1000);
+ valide.IsVisible = false;
+ int id = manager.ajouterUtilisateur(new Utilisateur(Name,MdpUtil));
+ manager.sauvegardeDonnee();
+ await Navigation.PushAsync(new Acceuil(id));
+ }
+ }
+
+ private async void BackLogin(object sender, EventArgs e)
+ {
+ await Navigation.PopAsync();
+ }
+}
\ No newline at end of file