commit
3812042ccb
Binary file not shown.
@ -0,0 +1,15 @@
|
||||
<?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.ConfirmationPopup"
|
||||
CanBeDismissedByTappingOutsideOfPopup="False">
|
||||
|
||||
<Grid RowDefinitions="*, *" ColumnDefinitions="*, *">
|
||||
<Label Grid.ColumnSpan="2" x:Name="placeholder" Style="{StaticResource popupLabel}"/>
|
||||
<Button Grid.Row="2" Style="{StaticResource popupButton}" Text="Non" Clicked="No"/>
|
||||
<Button Grid.Row="2" Grid.Column="2" Style="{StaticResource popupButton}" Text="Oui" Clicked="Yes"/>
|
||||
</Grid>
|
||||
</toolkit:Popup>
|
||||
|
||||
|
@ -0,0 +1,17 @@
|
||||
using CommunityToolkit.Maui.Views;
|
||||
|
||||
namespace Stim;
|
||||
|
||||
public partial class ConfirmationPopup : Popup
|
||||
{
|
||||
public ConfirmationPopup(string message)
|
||||
{
|
||||
InitializeComponent();
|
||||
placeholder.Text = message;
|
||||
}
|
||||
|
||||
public void Yes(object sender, EventArgs e)
|
||||
=> Close(true);
|
||||
public void No(object sender, EventArgs e)
|
||||
=> Close(false);
|
||||
}
|
After Width: | Height: | Size: 7.1 KiB |
After Width: | Height: | Size: 7.7 KiB |
After Width: | Height: | Size: 8.0 KiB |
@ -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 });
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:conv="clr-namespace:Stim.Converter"
|
||||
x:Class="Stim.StarsContainer"
|
||||
x:Name="StarsContainerView">
|
||||
|
||||
<ContentView.Resources>
|
||||
<conv:DoubleToStar x:Key="DoubleToStar" EtoilePleine="etoile_pleine.png" EtoileMiPleine="etoile_mi_pleine.png" EtoileVide="etoile_vide.png"/>
|
||||
</ContentView.Resources>
|
||||
|
||||
<HorizontalStackLayout Grid.Column="1" HorizontalOptions="End" BindingContext="{x:Reference StarsContainerView}">
|
||||
<Label Text="{Binding Rate, FallbackValue='0', StringFormat='{0}/5'}" FontSize="20"/>
|
||||
<Image Style="{StaticResource star}" Source="{Binding Rate, FallbackValue='0', Converter={StaticResource DoubleToStar}, ConverterParameter='1'}"/>
|
||||
<Image Style="{StaticResource star}" Source="{Binding Rate, FallbackValue='0', Converter={StaticResource DoubleToStar}, ConverterParameter='2'}"/>
|
||||
<Image Style="{StaticResource star}" Source="{Binding Rate, FallbackValue='0', Converter={StaticResource DoubleToStar}, ConverterParameter='3'}"/>
|
||||
<Image Style="{StaticResource star}" Source="{Binding Rate, FallbackValue='0', Converter={StaticResource DoubleToStar}, ConverterParameter='4'}"/>
|
||||
<Image Style="{StaticResource star}" Source="{Binding Rate, FallbackValue='0', Converter={StaticResource DoubleToStar}, ConverterParameter='5'}"/>
|
||||
</HorizontalStackLayout>
|
||||
</ContentView>
|
@ -0,0 +1,18 @@
|
||||
namespace Stim;
|
||||
|
||||
public partial class StarsContainer : ContentView
|
||||
{
|
||||
public static readonly BindableProperty RateProperty =
|
||||
BindableProperty.Create(nameof(Rate), typeof(double), typeof(StarsContainer), double.NaN);
|
||||
|
||||
public double Rate
|
||||
{
|
||||
get => (double)GetValue(StarsContainer.RateProperty);
|
||||
set => SetValue(StarsContainer.RateProperty, value);
|
||||
}
|
||||
|
||||
public StarsContainer()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue