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" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:UserInfo="clr-namespace:Stim"
xmlns:local="clr-namespace:Stim"
x:Class="Stim.ProfilPage"
Title="Profil">
<ScrollView>
@ -12,31 +12,30 @@
<VerticalStackLayout Style="{StaticResource pageBorder}" Grid.Column="0" 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*, *">
<Border>
<Label Text="{Binding CurrentUser.Biographie}" HeightRequest="200" HorizontalTextAlignment="Start" VerticalTextAlignment="Start"/>
</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>
</Grid>
<Grid Margin="0,20,0,0" ColumnDefinitions="10*, *">
<Border Margin="0,10,0,0" Padding="0">
<Label Text="**********"/>
</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>
</Grid>
<UserInfo:UserInfo Bind="{Binding CurrentUser.Email}"/>
<VerticalStackLayout BackgroundColor="Black" Grid.Column="0"/>
<VerticalStackLayout BackgroundColor="Black" Grid.Column="2"/>
<VerticalStackLayout BackgroundColor="Black" Grid.Column="0" Grid.Row="1"/>
<VerticalStackLayout BackgroundColor="Black" Grid.Column="2" Grid.Row="1"/>
<Grid Grid.Column="1" Grid.Row="1" Margin="0,10,100,0" BindingContext="{Binding CurrentUser}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<VerticalStackLayout Grid.Column="0" Margin="10,0,0,0">
<Image Source="{Binding UserImage}" HeightRequest="200" WidthRequest="200" Margin="0,0,10,0"/>
<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 Grid.Column="1" Margin="100,0,0,0">
<Label HorizontalOptions="Center" Text="Mes suivis"/>
<ScrollView>
<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>
</ScrollView>
</VerticalStackLayout>

@ -1,13 +1,14 @@
using CommunityToolkit.Maui.Views;
using Model;
using System.Text.RegularExpressions;
namespace Stim;
public partial class ProfilPage : ContentPage
{
public ProfilPage()
{
InitializeComponent();
public ProfilPage()
{
InitializeComponent();
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"));
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"
x:Class="Stim.UserInfo"
x:Name="userInfoView">
<Grid Margin="0,20,0,0" ColumnDefinitions="10*, *">
<Border Margin="0,10,0,0" Padding="0">
<Label Text="{Binding Path=Bind, Source={x:Reference userInfoView}}" />
<Grid Margin="0,20,0,0">
<Grid.ColumnDefinitions>
<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>
<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>
</ContentView>

@ -1,28 +1,43 @@
using Microsoft.VisualBasic;
using CommunityToolkit.Maui.Views;
namespace Stim;
public partial class UserInfo : ContentView
{
public static readonly BindableProperty BindProperty =
BindableProperty.Create(nameof(Bind), typeof(string), typeof(UserInfo), string.Empty, propertyChanged: OnBindChanged);
public string Bind
public bool IsPswd
{
get { return (string)GetValue(BindProperty); }
set { SetValue(BindProperty, value); }
get => (bool)GetValue(IsPswdProperty);
set => SetValue(IsPswdProperty, value);
}
private static void OnBindChanged(BindableObject bindable, object oldValue, object newValue)
public static readonly BindableProperty IsPswdProperty =
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 UserInfo()
public static readonly BindableProperty LabelHeightProperty =
BindableProperty.Create(nameof(Name), typeof(int), typeof(UserInfo), 32);
public event EventHandler PopUp;
public void popUp(object sender, EventArgs e)
{
InitializeComponent();
BindingContext = ((App)App.Current).Manager;
PopUp?.Invoke(sender, e);
}
private void Button_Clicked(object sender, EventArgs e)
public string Name
{
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