Pourquoi, pull, ça voulait pas pull ?
continuous-integration/drone/push Build was killed Details

Popup_qui_marche_pas
BelsethUwU 2 years ago
parent a6f0abbecc
commit 1c06b2cef1

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:UserInfo="clr-namespace:Stim" xmlns:local="clr-namespace:Stim"
x:Class="Stim.ProfilPage" x:Class="Stim.ProfilPage"
Title="Profil"> Title="Profil">
<ScrollView> <ScrollView>
@ -12,31 +12,30 @@
<VerticalStackLayout Style="{StaticResource pageBorder}" Grid.Column="0" Grid.Row="1"/> <VerticalStackLayout Style="{StaticResource pageBorder}" Grid.Column="0" Grid.Row="1"/>
<VerticalStackLayout Style="{StaticResource pageBorder}" Grid.Column="2" Grid.Row="1"/> <VerticalStackLayout Style="{StaticResource pageBorder}" Grid.Column="2" Grid.Row="1"/>
<Grid Grid.Column="1" Grid.Row="1" Margin="0,10,100,0" ColumnDefinitions="*, *">
<VerticalStackLayout Grid.Column="0" Margin="10,0,0,0">
<Image Source="{Binding CurrentUser.UserImage}" HeightRequest="200" WidthRequest="200" Margin="0,0,10,0"/>
<UserInfo:UserInfo Bind="{Binding CurrentUser.Username}"/>
<Grid Margin="0,20,0,0" ColumnDefinitions="10*, *"> <VerticalStackLayout BackgroundColor="Black" Grid.Column="0"/>
<Border> <VerticalStackLayout BackgroundColor="Black" Grid.Column="2"/>
<Label Text="{Binding CurrentUser.Biographie}" HeightRequest="200" HorizontalTextAlignment="Start" VerticalTextAlignment="Start"/> <VerticalStackLayout BackgroundColor="Black" Grid.Column="0" Grid.Row="1"/>
</Border> <VerticalStackLayout BackgroundColor="Black" Grid.Column="2" Grid.Row="1"/>
<Button ImageSource="pen.png" Grid.Column="1" MaximumHeightRequest="32" MaximumWidthRequest="32" Padding="0,0,0,0" Margin="5,0,0,0" BackgroundColor="{StaticResource Gray500}"></Button>
</Grid> <Grid Grid.Column="1" Grid.Row="1" Margin="0,10,100,0" BindingContext="{Binding CurrentUser}">
<Grid Margin="0,20,0,0" ColumnDefinitions="10*, *"> <Grid.ColumnDefinitions>
<Border Margin="0,10,0,0" Padding="0"> <ColumnDefinition Width="*"/>
<Label Text="**********"/> <ColumnDefinition Width="*"/>
</Border> </Grid.ColumnDefinitions>
<Button ImageSource="pen.png" Grid.Column="1" MaximumHeightRequest="32" MaximumWidthRequest="32" Padding="0,0,0,0" Margin="5,0,0,0" BackgroundColor="{StaticResource Gray500}"></Button> <VerticalStackLayout Grid.Column="0" Margin="10,0,0,0">
</Grid> <Image Source="{Binding UserImage}" HeightRequest="200" WidthRequest="200" Margin="0,0,10,0"/>
<UserInfo:UserInfo Bind="{Binding CurrentUser.Email}"/> <local:UserInfo Name="{Binding Username}" PopUp="PopUpUsername"/>
<local:UserInfo Name="{Binding Biographie}" PopUp="PopUpBio" LabelHeight="200"/>
<local:UserInfo Name="{Binding Password}" PopUp="PopUpPswd" IsPswd="False"/>
<local:UserInfo Name="{Binding Email}" PopUp="PopUpEmail"/>
</VerticalStackLayout> </VerticalStackLayout>
<VerticalStackLayout Grid.Column="1" Margin="100,0,0,0"> <VerticalStackLayout Grid.Column="1" Margin="100,0,0,0">
<Label HorizontalOptions="Center" Text="Mes suivis"/> <Label HorizontalOptions="Center" Text="Mes suivis"/>
<ScrollView> <ScrollView>
<Border> <Border>
<CollectionView ItemsSource="{Binding CurrentUser.Followed_Games}" SelectionMode="Single" SelectionChanged="CollectionView_SelectionChanged" ItemTemplate="{StaticResource followLoginTemplate}"/> <CollectionView ItemsSource="{Binding Followed_Games}" SelectionMode="Single" SelectionChanged="CollectionView_SelectionChanged" ItemTemplate="{StaticResource followLoginTemplate}"/>
</Border> </Border>
</ScrollView> </ScrollView>
</VerticalStackLayout> </VerticalStackLayout>

@ -1,13 +1,14 @@
using CommunityToolkit.Maui.Views; using CommunityToolkit.Maui.Views;
using Model; using Model;
using System.Text.RegularExpressions;
namespace Stim; namespace Stim;
public partial class ProfilPage : ContentPage public partial class ProfilPage : ContentPage
{ {
public ProfilPage() public ProfilPage()
{ {
InitializeComponent(); InitializeComponent();
BindingContext = ((App)App.Current).Manager; BindingContext = ((App)App.Current).Manager;
} }
@ -22,4 +23,29 @@ public partial class ProfilPage : ContentPage
if (string.IsNullOrWhiteSpace(newName as string)) await this.ShowPopupAsync(new MessagePopup("Nom d'utilisateur invalide")); if (string.IsNullOrWhiteSpace(newName as string)) await this.ShowPopupAsync(new MessagePopup("Nom d'utilisateur invalide"));
else ((App)App.Current).Manager.CurrentUser.Username = (newName as string); else ((App)App.Current).Manager.CurrentUser.Username = (newName as string);
} }
public async void PopUpUsername(object sender, EventArgs e)
{
var newName = await this.ShowPopupAsync(new EntryPopup("Username"));
if (string.IsNullOrWhiteSpace(newName as string)) await this.ShowPopupAsync(new MessagePopup("Nom d'utilisateur invalide"));
else ((App)App.Current).Manager.CurrentUser.Username = (newName as string);
}
public async void PopUpBio(object sender, EventArgs e)
{
var newBio = await this.ShowPopupAsync(new EntryPopup("Biographie"));
((App)App.Current).Manager.CurrentUser.Biographie = (newBio as string);
}
public async void PopUpPswd(object sender, EventArgs e)
{
Regex rg = new Regex("^(?=.*[A-Za-z])(?=.*[0-9@$!%*#?&])[A-Za-z-0-9@$!%*#?&]{8,}$");
var newPswd = await this.ShowPopupAsync(new EntryPopup("Password"));
if (string.IsNullOrWhiteSpace(newPswd as string) || rg.IsMatch(newPswd as string)) await this.ShowPopupAsync(new MessagePopup("Nom d'utilisateur invalide"));
else ((App)App.Current).Manager.CurrentUser.Password = (newPswd as string);
}
public async void PopUpEmail(object sender, EventArgs e)
{
Regex rg = new Regex("^([a-zA-Z0-9_-]+[.])*[a-zA-Z0-9_-]+@([a-zA-Z0-9_-]+[.])+[a-zA-Z0-9_-]{2,4}$");
var newMail = await this.ShowPopupAsync(new EntryPopup("Email"));
if (string.IsNullOrWhiteSpace(newMail as string) || rg.IsMatch(newMail as string)) await this.ShowPopupAsync(new MessagePopup("Email Invalide"));
else ((App)App.Current).Manager.CurrentUser.Email = (newMail as string);
}
} }

@ -4,11 +4,17 @@
xmlns:local="clr-namespace:Stim" xmlns:local="clr-namespace:Stim"
x:Class="Stim.UserInfo" x:Class="Stim.UserInfo"
x:Name="userInfoView"> x:Name="userInfoView">
<Grid Margin="0,20,0,0" ColumnDefinitions="10*, *"> <Grid Margin="0,20,0,0">
<Border Margin="0,10,0,0" Padding="0"> <Grid.ColumnDefinitions>
<Label Text="{Binding Path=Bind, Source={x:Reference userInfoView}}" /> <ColumnDefinition Width="10*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Margin="0,10,0,0" Padding="0" HeightRequest="{Binding LabelHeight, Source={x:Reference userInfoView}}">
<Label x:Name="Label" Text="{Binding Name, Source={x:Reference userInfoView}}" IsVisible="True"/>
</Border> </Border>
<Button ImageSource="pen.png" Grid.Column="1" MaximumHeightRequest="32" MaximumWidthRequest="32" Padding="0,0,0,0" Margin="5,0,0,0" BackgroundColor="{StaticResource Gray500}"></Button> <Button Clicked="popUp" ImageSource="pen.png" Grid.Column="1"
MaximumHeightRequest="32" MaximumWidthRequest="32"
Padding="0,0,0,0" Margin="5,0,0,0"
BackgroundColor="{StaticResource Gray500}"/>
</Grid> </Grid>
</ContentView> </ContentView>

@ -1,28 +1,43 @@
using Microsoft.VisualBasic;
using CommunityToolkit.Maui.Views;
namespace Stim; namespace Stim;
public partial class UserInfo : ContentView public partial class UserInfo : ContentView
{ {
public static readonly BindableProperty BindProperty = public bool IsPswd
BindableProperty.Create(nameof(Bind), typeof(string), typeof(UserInfo), string.Empty, propertyChanged: OnBindChanged);
public string Bind
{ {
get { return (string)GetValue(BindProperty); } get => (bool)GetValue(IsPswdProperty);
set { SetValue(BindProperty, value); } set => SetValue(IsPswdProperty, value);
} }
public static readonly BindableProperty IsPswdProperty =
private static void OnBindChanged(BindableObject bindable, object oldValue, object newValue) BindableProperty.Create(nameof(Name), typeof(bool), typeof(UserInfo), false);
public int LabelHeight
{ {
var contentView = (UserInfo)bindable; get => (int)GetValue(LabelHeightProperty);
set => SetValue(LabelHeightProperty, value);
} }
public static readonly BindableProperty LabelHeightProperty =
public UserInfo() BindableProperty.Create(nameof(Name), typeof(int), typeof(UserInfo), 32);
public event EventHandler PopUp;
public void popUp(object sender, EventArgs e)
{ {
InitializeComponent(); PopUp?.Invoke(sender, e);
BindingContext = ((App)App.Current).Manager;
} }
public string Name
private void Button_Clicked(object sender, EventArgs e)
{ {
get => (string)GetValue(NameProperty);
set => SetValue(NameProperty, value);
}
public static readonly BindableProperty NameProperty =
BindableProperty.Create(nameof(Name), typeof(string), typeof(UserInfo), "Erreur");
public UserInfo()
{
InitializeComponent();
if (IsPswd)
{
Label.IsVisible = false;
}
else Label.IsVisible = true;
} }
} }
Loading…
Cancel
Save