parent
45c91336f2
commit
a2a2cc8473
@ -0,0 +1,122 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="CanYouBuildIt.Views.SignIn"
|
||||
Title="SignIn"
|
||||
BackgroundColor="#26B4BE">
|
||||
<AbsoluteLayout>
|
||||
|
||||
<VerticalStackLayout
|
||||
AbsoluteLayout.LayoutBounds="0.5,0.5,500,700"
|
||||
AbsoluteLayout.LayoutFlags="PositionProportional"
|
||||
BackgroundColor="#408097">
|
||||
|
||||
<Image Source="logologin.png"
|
||||
Margin="25,60,25,0"/>
|
||||
|
||||
<Label Text="Inscription"
|
||||
FontAttributes="Bold"
|
||||
FontSize="30"
|
||||
Margin="25,60,25,0"
|
||||
MaximumWidthRequest="160"
|
||||
TextColor="White"
|
||||
WidthRequest="500"/>
|
||||
|
||||
|
||||
<Entry BackgroundColor="#EEEEFF"
|
||||
HeightRequest="20"
|
||||
Margin="25,60,25,0"
|
||||
Placeholder="Nom"
|
||||
PlaceholderColor="Black"
|
||||
TextColor="Black"
|
||||
x:Name="Nom"/>
|
||||
|
||||
<Entry BackgroundColor="#EEEEFF"
|
||||
HeightRequest="20"
|
||||
IsPassword="True"
|
||||
Margin="25,60,25,0"
|
||||
Placeholder="Mot de Passe"
|
||||
PlaceholderColor="Black"
|
||||
TextColor="Black"
|
||||
x:Name="Mdp"/>
|
||||
|
||||
<Entry BackgroundColor="#EEEEFF"
|
||||
HeightRequest="20"
|
||||
IsPassword="True"
|
||||
Margin="25,60,25,0"
|
||||
Placeholder="Confirmer Mot de Passe"
|
||||
PlaceholderColor="Black"
|
||||
TextColor="Black"
|
||||
x:Name="cMdp"/>
|
||||
<VerticalStackLayout>
|
||||
|
||||
<Button BackgroundColor="DimGrey"
|
||||
Clicked="BtValider"
|
||||
FontAttributes="Bold"
|
||||
HorizontalOptions="Center"
|
||||
Text="Valider"
|
||||
TextColor="White"
|
||||
x:Name="btnValider" />
|
||||
|
||||
<Button BackgroundColor="DimGrey"
|
||||
Margin="0,60"
|
||||
x:Name="annul"
|
||||
Text="Annuler"
|
||||
FontAttributes="Bold"
|
||||
TextColor="White"
|
||||
Clicked="BackLogin"
|
||||
HorizontalOptions="Center" />
|
||||
|
||||
<Label Text="WARNING ! Les champs doivent être remplis."
|
||||
IsVisible="false"
|
||||
x:Name="vide"
|
||||
BackgroundColor="Red"
|
||||
FontAttributes="Bold"
|
||||
Padding="30"
|
||||
Margin="0,30,0,0"
|
||||
HorizontalOptions="Center"
|
||||
WidthRequest="500"/>
|
||||
<!-- the cat : fcgvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv-->
|
||||
<Label Text="Le mot de passe doit être composé d'au moins 4 caractères."
|
||||
IsVisible="false"
|
||||
x:Name="wrong"
|
||||
BackgroundColor="Red"
|
||||
FontAttributes="Bold"
|
||||
Padding="30"
|
||||
Margin="0,30,0,0"
|
||||
HorizontalOptions="Center"
|
||||
WidthRequest="500"/>
|
||||
|
||||
<Label Text="Les 2 mots de passe doivent être les mêmes."
|
||||
BackgroundColor="Red"
|
||||
FontAttributes="Bold"
|
||||
HorizontalOptions="Center"
|
||||
IsVisible="false"
|
||||
Margin="0,30,0,0"
|
||||
Padding="30"
|
||||
WidthRequest="500"
|
||||
x:Name="nequal"/>
|
||||
|
||||
<Label Text="Ce nom n'est pas disponible."
|
||||
BackgroundColor="Red"
|
||||
FontAttributes="Bold"
|
||||
HorizontalOptions="Center"
|
||||
IsVisible="false"
|
||||
Margin="0,30,0,0"
|
||||
Padding="30"
|
||||
WidthRequest="500"
|
||||
x:Name="userNameUsed"/>
|
||||
|
||||
<Label Text="Incription valide."
|
||||
IsVisible="false"
|
||||
x:Name="valide"
|
||||
BackgroundColor="Green"
|
||||
FontAttributes="Bold"
|
||||
Padding="30"
|
||||
Margin="0,30,0,0"
|
||||
HorizontalOptions="Center"
|
||||
WidthRequest="500"/>
|
||||
</VerticalStackLayout>
|
||||
</VerticalStackLayout>
|
||||
</AbsoluteLayout>
|
||||
</ContentPage>
|
@ -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();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue