feat : review pop up
continuous-integration/drone/push Build is passing Details

Popup_qui_marche_pas
BelsethUwU 2 years ago
parent 7f116ed0eb
commit ad3905d359

@ -1,6 +1,5 @@
using CommunityToolkit.Maui.Views;
using Model;
using StimPersistance;
namespace Stim;
@ -18,9 +17,9 @@ public partial class DetailledPage : ContentPage
await Navigation.PushModalAsync(new MainPage());
}
private void AddReview(object sender, EventArgs e)
private async void AddReview(object sender, EventArgs e)
{
//popup add review
await this.ShowPopupAsync(new ReviewPopUp((App.Current as App).Manager.SelectedGame));
}
private async void AddFollow(object sender, EventArgs e)

@ -1,8 +1,8 @@
<?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="Stim.LoginPage"
Title="LoginPage">
<?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="Stim.LoginPage"
Title="LoginPage">
<ScrollView>
<Grid BackgroundColor="{StaticResource Tertiary}" ColumnDefinitions="*, 5*, *" RowDefinitions="auto, *">
<VerticalStackLayout BackgroundColor="Black" Grid.Column="0"/>
@ -25,7 +25,7 @@
Grid.Row="1"
ClearButtonVisibility="WhileEditing"
Text="anthony5"/>
<Grid Grid.Row="2"
Margin="10,0,0,10" ColumnDefinitions="3*, *">
<Button Text="Se connecter"

@ -25,10 +25,10 @@
</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}" Button="0" PopUp="PopUpUsername"/>
<local:UserInfo Name="{Binding Biographie}" Button="1" PopUp="PopUpBio" LabelHeight="200"/>
<local:UserInfo Name="{Binding Password}" Button="2" PopUp="PopUpPswd" IsPswd="False"/>
<local:UserInfo Name="{Binding Email}" Button="3" PopUp="PopUpEmail"/>
<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">

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<toolkit:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:Class="Stim.ReviewPopUp"
CanBeDismissedByTappingOutsideOfPopup="False">
<Grid ColumnDefinitions="*" RowDefinitions="*, *, *, *, *">
<Label x:Name="placeholder" Style="{StaticResource popupLabel}"/>
<Entry Grid.Row="1" x:Name="Entrytxt" VerticalOptions="Center" HorizontalOptions="Center"/>
<Entry Grid.Row="2" x:Name="Val" VerticalOptions="Center" HorizontalOptions="Center"/>
<Button Grid.Row="3" Text="Valider" Style="{StaticResource popupButton}" Clicked="Valider"/>
<Button Grid.Row="4" Text="Annuler" Style="{StaticResource popupButton}" Clicked="CloseButton"/>
<HorizontalStackLayout x:Name="Error"/>
</Grid>
</toolkit:Popup>

@ -0,0 +1,35 @@
using CommunityToolkit.Maui.Views;
using Model;
using System.Globalization;
namespace Stim;
public partial class ReviewPopUp : Popup
{
Game CurrGame { get; set; }
public ReviewPopUp(Game currGame)
{
InitializeComponent();
CurrGame = currGame;
}
public void CloseButton(object sender, EventArgs e)
{
Close();
}
private void Valider(object sender, EventArgs e)
{
if (CurrGame == null)
{
throw new Exception();
}
bool IsFloat = float.TryParse(Val.Text, NumberStyles.Float, CultureInfo.InvariantCulture, out float rate);
if (!string.IsNullOrWhiteSpace(Entrytxt.Text) && IsFloat)
{
((App)App.Current).Manager.CurrentUser.AddReview(CurrGame, rate, Entrytxt.Text);
Close();
}
else Error.Children.Add(new Label { Text="Champ vide ou invalide", TextColor=Colors.Red });
}
}

@ -65,6 +65,9 @@
<Compile Update="DetailledPage - Copier.xaml.cs">
<DependentUpon>%(Filename)</DependentUpon>
</Compile>
<Compile Update="ReviewPopUp.xaml.cs">
<DependentUpon>ReviewPopUp.xaml</DependentUpon>
</Compile>
<Compile Update="LoginPage.xaml.cs">
<DependentUpon>LoginPage.xaml</DependentUpon>
</Compile>
@ -89,6 +92,9 @@
<MauiXaml Update="DetailledPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="ReviewPopUp.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="EntryPopup.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>

@ -31,14 +31,6 @@ public partial class UserInfo : ContentView
public static readonly BindableProperty NameProperty =
BindableProperty.Create(nameof(Name), typeof(string), typeof(UserInfo), "Erreur");
public int Button
{
get => (int)GetValue(ButtonProperty);
set => SetValue(ButtonProperty, value);
}
public static readonly BindableProperty ButtonProperty =
BindableProperty.Create(nameof(Button), typeof(int), typeof(UserInfo), 4);
public UserInfo()
{
InitializeComponent();

Loading…
Cancel
Save