Ajout de tout -> petits labels pour indiquer erreur, inscription fonctionnelle et tout 🎉
continuous-integration/drone/push Build is passing Details

Collection
Nicolas BLONDEAU 2 years ago
parent a128df48fb
commit 94e2b4d8d5

@ -58,7 +58,6 @@
</Setter>
</Style>
</FlexLayout.Resources>
<Image
Source="bienvenue.png"
VerticalOptions="Center"

@ -58,8 +58,9 @@
Source="connexion.png"
HeightRequest="70"
Margin="0, 0, 0, 30" />
<Entry x:Name="IdEntry" Placeholder="Identifiant" ReturnType="Next" />
<Entry x:Name="IdEntry" TextChanged="IdEntry_TextChanged" Placeholder="Identifiant" ReturnType="Next" />
<Entry x:Name="PsswEntry" Placeholder="Mot de passe" IsPassword="True" ReturnType="Next" />
<Label x:Name="resultLabel" IsVisible="False" Text="Wrong username or password!" TextColor="Red"/>
<Button Style="{StaticResource buttonStyle}"
Text="Valider"
Clicked="ValiderClicked"/>

@ -23,10 +23,18 @@ public partial class Connexion : ContentPage
{
(Application.Current as App).User = u;
await Navigation.PushAsync(new SearchMob());
return;
}
}
resultLabel.IsVisible = true;
return;
}
private void IdEntry_TextChanged(object sender, TextChangedEventArgs e)
{
resultLabel.IsVisible = false;
}
/*
private void Id_Entry_Completed(object sender, EventArgs e)
{

@ -58,18 +58,19 @@
HeightRequest="70"
Margin="0, 0, 0, 30" />
<HorizontalStackLayout>
<Entry Placeholder="Nom"
<Entry x:Name="Nom" Placeholder="Nom"
Text="{Binding Nom}"/>
<Entry Placeholder="Prénom"
<Entry x:Name="Prenom" Placeholder="Prénom"
Text="{Binding Prenom}"/>
</HorizontalStackLayout>
<HorizontalStackLayout>
<Entry Placeholder="Identifiant"
<Entry x:Name="Id" TextChanged="Id_TextChanged" Placeholder="Identifiant"
Text="{Binding Pseudo}"/>
<Entry Placeholder="Mot de passe"
<Entry x:Name="Mdp" Placeholder="Mot de passe"
Text="{Binding Mdp}"
IsPassword="True"/>
</HorizontalStackLayout>
<Label x:Name="resultLabel" IsVisible="False" Text="Error, this username is already taken!" TextColor="Red"/>
<Button Style="{StaticResource buttonStyle}"
Text="Valider"
Clicked="Valid_Clicked"/>

@ -3,23 +3,52 @@ using Persistance;
namespace Vues;
public partial class Inscription : ContentPage
{
List<User> users = new List<User>();
UserManager userMngr = new UserManager(new LoaderXml());
public User user { get; set; } = new User();
{
string nom;
string prenom;
string id;
string mdp;
public Inscription()
{
InitializeComponent();
BindingContext=user;
}
BindingContext = (Application.Current as App).userManager;
}
private async void Valid_Clicked(object sender, EventArgs e)
{
if (!(Application.Current as App).userManager.checkIfPseudoExists(user.Pseudo))
id = Id.Text;
mdp = Mdp.Text;
nom = Nom.Text;
prenom = Prenom.Text;
if ((Application.Current as App).userManager.checkIfPseudoExists(id))
{
resultLabel.IsVisible = true;
return;
//await Navigation.PushAsync(new SearchMob());
}
try
{
User newUser = new User(id, nom, prenom, mdp);
}
catch (FormatException)
{
resultLabel.IsVisible = true;
resultLabel.Text = "You must complete all entries!";
}
catch (ArgumentException)
{
users.Add(user);
userMngr.saveUsers(users);
userMngr.loadUsers();
await Navigation.PushAsync(new Accueil());
}
resultLabel.IsVisible = true;
resultLabel.Text = "You ";
}
(Application.Current as App).userManager.ListUsers.Add(newUser);
(Application.Current as App).User = newUser;
await Navigation.PopAsync();
return;
}
private void Id_TextChanged(object sender, TextChangedEventArgs e)
{
resultLabel.IsVisible=false;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

@ -130,7 +130,7 @@
</ListView.ItemTemplate>
</ListView>
</Grid>
<ScrollView Grid.Column="1" Margin="10">
<ScrollView Grid.Column="1" Margin="10" x:Name="ScrollLayoutThatNeedsToBeRefreshed">
<!-- Grid du Detail contenant toutes les informations du monstre -->
<Grid RowDefinitions="Auto,Auto,Auto,Auto" BindingContext="{Binding SelectedItem, Source={x:Reference ListViewMonsters}}">

@ -49,13 +49,14 @@ public partial class SearchMob : ContentPage, INotifyPropertyChanged
private void OnAddConseilClicked(object sender, EventArgs e)
{
var button = sender as Button;
var selectedConseil = button?.BindingContext as Conseil;
// Afficher les champs à remplir pour ajouter un conseil
var addConseilLayout = button?.Parent?.FindByName<StackLayout>("AddConseilLayout");
if (addConseilLayout != null)
{
ScrollLayoutThatNeedsToBeRefreshed.IsVisible = false;
addConseilLayout.IsVisible = true;
ScrollLayoutThatNeedsToBeRefreshed.IsVisible = true;
}
}
@ -76,7 +77,6 @@ public partial class SearchMob : ContentPage, INotifyPropertyChanged
}
texteConseilEntry.Text = string.Empty;
addConseilLayout.IsVisible = false;
}
}

Loading…
Cancel
Save