suppression review

master
Anthony RICHARD 2 years ago
parent de4e761b59
commit ba2bc4fa55

@ -13,6 +13,7 @@
<Grid ColumnDefinitions="auto, auto, auto, *"> <Grid ColumnDefinitions="auto, auto, auto, *">
<Label Text="{Binding AuthorName, FallbackValue='Default'}" FontSize="20"/> <Label Text="{Binding AuthorName, FallbackValue='Default'}" FontSize="20"/>
<ImageButton Grid.Column="2" Source="pen.png" Background="{StaticResource Transparent}" HeightRequest="30" Clicked="EditReview"/> <ImageButton Grid.Column="2" Source="pen.png" Background="{StaticResource Transparent}" HeightRequest="30" Clicked="EditReview"/>
<ImageButton Grid.Column="3" Style="{StaticResource removeButton}" HorizontalOptions="Start" HeightRequest="30" Clicked="RemoveReview"/>
<local:StarsContainer Grid.Column="4" Rate="{Binding Rate, FallbackValue='0'}"/> <local:StarsContainer Grid.Column="4" Rate="{Binding Rate, FallbackValue='0'}"/>
</Grid> </Grid>
<Label Text="{Binding Text, FallbackValue='Default'}"/> <Label Text="{Binding Text, FallbackValue='Default'}"/>
@ -21,7 +22,7 @@
</DataTemplate> </DataTemplate>
</ContentPage.Resources> </ContentPage.Resources>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*" /> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>

@ -20,14 +20,25 @@ public partial class DetailledPage : ContentPage
private async void AddReview(object sender, EventArgs e) private async void AddReview(object sender, EventArgs e)
{ {
var res = await this.ShowPopupAsync(new ReviewPopUp()); var res = await this.ShowPopupAsync(new ReviewPopUp());
if (res != null && res is int i && i == 1) await this.ShowPopupAsync(new MessagePopup("Commentaire ajouté !")); if (res != null && res is int i && i == 1) await this.ShowPopupAsync(new MessagePopup("Commentaire ajouté !"));
} }
private async void EditReview(object sender, EventArgs e) private async void EditReview(object sender, EventArgs e)
{ {
var res = await this.ShowPopupAsync(new ReviewPopUp((sender as ImageButton).BindingContext as Review)); var res = await this.ShowPopupAsync(new ReviewPopUp((sender as ImageButton).BindingContext as Review));
if (res != null && res is int i && i == 2) await this.ShowPopupAsync(new MessagePopup("Commentaire modifié !")); if (res != null && res is int i && i == 2) await this.ShowPopupAsync(new MessagePopup("Commentaire modifié !"));
} }
private async void RemoveReview(object sender, EventArgs e)
{
var res = await this.ShowPopupAsync(new ConfirmationPopup("Voulez-vous vraiment supprimer votre commentaire ?"));
if (res != null && res is bool v && v)
{
(App.Current as App).Manager.SelectedGame.RemoveReview((sender as ImageButton).BindingContext as Review);
(App.Current as App).Manager.SaveGames();
await this.ShowPopupAsync(new MessagePopup("Commentaire supprimé !"));
}
} }
private async void AddFollow(object sender, EventArgs e) private async void AddFollow(object sender, EventArgs e)

Loading…
Cancel
Save