You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
965 B
34 lines
965 B
using CommunityToolkit.Maui.Views;
|
|
using Model;
|
|
using System.Globalization;
|
|
|
|
namespace Stim;
|
|
|
|
public partial class ReviewPopUp : Popup
|
|
{
|
|
public ReviewPopUp()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void CloseButton(object sender, EventArgs e)
|
|
{
|
|
Close();
|
|
}
|
|
|
|
private void Valider(object sender, EventArgs e)
|
|
{
|
|
if ((App.Current as App).Manager.SelectedGame == null)
|
|
{
|
|
throw new Exception();
|
|
}
|
|
bool isDouble = double.TryParse(Val.Text, NumberStyles.Float, CultureInfo.InvariantCulture, out double rate);
|
|
if (!string.IsNullOrWhiteSpace(Entrytxt.Text) && isDouble)
|
|
{
|
|
((App)App.Current).Manager.CurrentUser.AddReview((App.Current as App).Manager.SelectedGame, rate, Entrytxt.Text);
|
|
((App)App.Current).Manager.SaveGames();
|
|
Close();
|
|
}
|
|
else Error.Children.Add(new Label { Text="Champ vide ou invalide", TextColor=Colors.Red });
|
|
}
|
|
} |