parent
93dace397a
commit
3a7551e491
@ -0,0 +1,100 @@
|
||||
<?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.Login"
|
||||
Title="Login">
|
||||
|
||||
<AbsoluteLayout>
|
||||
<Image Source="fond.jpg"/>
|
||||
|
||||
<VerticalStackLayout
|
||||
BackgroundColor="#320639"
|
||||
AbsoluteLayout.LayoutBounds="0.5,0.5,500,700"
|
||||
AbsoluteLayout.LayoutFlags="PositionProportional">
|
||||
<Image Source="logo.png"
|
||||
MaximumWidthRequest="90"
|
||||
Margin="25,60,25,0"/>
|
||||
|
||||
<Label Text="Connexion"
|
||||
Margin="25,60,25,0"
|
||||
MaximumWidthRequest="160"
|
||||
TextColor="White"
|
||||
FontAttributes="Bold"
|
||||
FontSize="30"
|
||||
WidthRequest="500"/>
|
||||
<Entry
|
||||
Margin="25,60,25,0"
|
||||
x:Name="Nom"
|
||||
Placeholder="Nom"
|
||||
PlaceholderColor="#BF730A"
|
||||
HeightRequest="20"
|
||||
BackgroundColor="#BDA7C1" />
|
||||
<Entry
|
||||
Margin="25,60,25,0"
|
||||
x:Name="Mdp"
|
||||
IsPassword="True"
|
||||
Placeholder="Mot de Passe"
|
||||
PlaceholderColor="#BF730A"
|
||||
HeightRequest="20"
|
||||
BackgroundColor="#BDA7C1"/>
|
||||
<Entry
|
||||
BackgroundColor="#BDA7C1"
|
||||
Margin="25,60,25,0"
|
||||
x:Name="Adresse"
|
||||
Placeholder="Mail"
|
||||
PlaceholderColor="#BF730A"
|
||||
HeightRequest="20"/>
|
||||
|
||||
<HorizontalStackLayout>
|
||||
<Button
|
||||
BackgroundColor="#882297"
|
||||
Margin="220,60,0,0"
|
||||
x:Name="BtnValider"
|
||||
Text="LOGIN"
|
||||
FontAttributes="Bold"
|
||||
TextColor="White"
|
||||
HorizontalOptions="Center" />
|
||||
<Button Margin="90,60,0,0"
|
||||
x:Name="btn_insc"
|
||||
Text="inscription"
|
||||
FontAttributes="Bold"
|
||||
TextColor="White"
|
||||
HorizontalOptions="Center" />
|
||||
</HorizontalStackLayout>
|
||||
|
||||
<HorizontalStackLayout>
|
||||
|
||||
<Label Text="ERREUR ! les cases Nom et Mot de Passe doivent etre remplie."
|
||||
IsVisible="false"
|
||||
x:Name="error"
|
||||
BackgroundColor="Red"
|
||||
FontAttributes="Bold"
|
||||
Padding="30"
|
||||
Margin="0,30,0,0"
|
||||
HorizontalOptions="Center"
|
||||
WidthRequest="500"/>
|
||||
|
||||
<Label Text="ERREUR ! mauvais mdp et nom."
|
||||
IsVisible="false"
|
||||
x:Name="wrong"
|
||||
BackgroundColor="Red"
|
||||
FontAttributes="Bold"
|
||||
Padding="30"
|
||||
Margin="0,30,0,0"
|
||||
HorizontalOptions="Center"
|
||||
WidthRequest="500"/>
|
||||
|
||||
<Label Text="mot de passe et nom VALIDE."
|
||||
IsVisible="false"
|
||||
x:Name="valide"
|
||||
BackgroundColor="Green"
|
||||
FontAttributes="Bold"
|
||||
Padding="30"
|
||||
Margin="0,30,0,0"
|
||||
HorizontalOptions="Center"
|
||||
WidthRequest="500"/>
|
||||
</HorizontalStackLayout>
|
||||
</VerticalStackLayout>
|
||||
</AbsoluteLayout>
|
||||
|
||||
</ContentPage>
|
@ -0,0 +1,48 @@
|
||||
namespace CanYouBuildIt.Views;
|
||||
|
||||
public partial class Login : ContentPage
|
||||
{
|
||||
public Manager MyManager => (App.Current as App).MyManager;
|
||||
public PageConnexion()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private async void BoutonValider(object sender, EventArgs e)
|
||||
{
|
||||
//recupérer les valeurs d'entrées
|
||||
string email = Adresse.Text;
|
||||
string MdpUlti = Mdp.Text;
|
||||
string Name = Nom.Text;
|
||||
int idname = MyManager.rechercheNom(Name);
|
||||
int idmail = MyManager.rechercheAdresse(email);
|
||||
int idmdp = MyManager.rechercheMdp(MdpUlti);
|
||||
|
||||
if (Name == null || MdpUlti == null)
|
||||
{
|
||||
error.IsVisible = true;
|
||||
await Task.Delay(3000);
|
||||
error.IsVisible = false;
|
||||
return;
|
||||
}
|
||||
else if (idname == -1 && idmail == -1 && idmdp == -1)
|
||||
{
|
||||
wrong.IsVisible = true;
|
||||
await Task.Delay(1000);
|
||||
wrong.IsVisible = false;
|
||||
return;
|
||||
}
|
||||
else if (idname != -1 && idmail != -1 && idmdp != -1)
|
||||
{
|
||||
valide.IsVisible = true;
|
||||
await Task.Delay(1000);
|
||||
valide.IsVisible = false;
|
||||
await Navigation.PushAsync(new Accueil(idname));
|
||||
}
|
||||
}
|
||||
|
||||
private void btninsc(object sender, EventArgs e)
|
||||
{
|
||||
Navigation.PushAsync(new PageInscription());
|
||||
}
|
||||
}
|
Loading…
Reference in new issue