diff --git a/Sources/Stim/DetailledPage.xaml.cs b/Sources/Stim/DetailledPage.xaml.cs index 494a977..57e7de1 100644 --- a/Sources/Stim/DetailledPage.xaml.cs +++ b/Sources/Stim/DetailledPage.xaml.cs @@ -6,15 +6,11 @@ namespace Stim; public partial class DetailledPage : ContentPage { - private Game currentGame; - public DetailledPage() { InitializeComponent(); - currentGame = (App.Current as App).Manager.SelectedGame; - BindingContext = currentGame; - - if (currentGame is null) Navigation.PopAsync(); + BindingContext = (App.Current as App).Manager.SelectedGame; + if ((App.Current as App).Manager.SelectedGame is null) Navigation.RemovePage(this); } private async void GoToMainPage(object sender, EventArgs e) @@ -33,12 +29,12 @@ public partial class DetailledPage : ContentPage foreach (Game game in ((App)App.Current).Manager.CurrentUser.Followed_Games) { if (game == null) throw new Exception(); - else if (currentGame == game) { flag = true; break; } + else if ((App.Current as App).Manager.SelectedGame == game) { flag = true; break; } } if (!flag) { await this.ShowPopupAsync(new MessagePopup("Jeu ajouté dans les suivis !")); - ((App)App.Current).Manager.CurrentUser.FollowAGame(currentGame); + ((App)App.Current).Manager.CurrentUser.FollowAGame((App.Current as App).Manager.SelectedGame); } else { @@ -46,20 +42,14 @@ public partial class DetailledPage : ContentPage } } - protected override void OnNavigatedFrom(NavigatedFromEventArgs args) - { - Navigation.PopAsync(); - base.OnNavigatedFrom(args); - } - - protected override void OnDisappearing() + private async void RemoveGame(object sender, EventArgs e) { - Navigation.PopAsync(); - base.OnDisappearing(); - } - - protected override void OnAppearing() - { - base.OnAppearing(); + var res = await this.ShowPopupAsync(new ConfirmationPopup("Voulez-vous vraiment supprimer " + (App.Current as App).Manager.SelectedGame.Name + " ?")); + if (res != null && res is bool && (bool)res) + { + (App.Current as App).Manager.RemoveGameFromGamesList((App.Current as App).Manager.SelectedGame); + await Navigation.PopAsync(); + await this.ShowPopupAsync(new MessagePopup("Jeu supprimé !")); + } } } \ No newline at end of file diff --git a/Sources/Stim/EntryPopup.xaml.cs b/Sources/Stim/EntryPopup.xaml.cs index 41b0c6e..22e41c3 100644 --- a/Sources/Stim/EntryPopup.xaml.cs +++ b/Sources/Stim/EntryPopup.xaml.cs @@ -7,7 +7,7 @@ public partial class EntryPopup : Popup public EntryPopup(string fieldName) { InitializeComponent(); - LabelTxt.Text = fieldName; + placeholder.Text = fieldName; } public void CloseButton(object sender, EventArgs e) diff --git a/Sources/Stim/FollowPage.xaml.cs b/Sources/Stim/FollowPage.xaml.cs index 752060e..f8d61c8 100644 --- a/Sources/Stim/FollowPage.xaml.cs +++ b/Sources/Stim/FollowPage.xaml.cs @@ -15,4 +15,9 @@ public partial class FollowPage : ContentPage (App.Current as App).Manager.SelectedGame = (sender as CollectionView).SelectedItem as Game; await Navigation.PushAsync(new DetailledPage()); } + + protected override void OnAppearing() + { + base.OnAppearing(); + } } \ No newline at end of file diff --git a/Sources/Stim/Resources/Images/remove_black.png b/Sources/Stim/Resources/Images/remove_black.png new file mode 100644 index 0000000..e2ad22f Binary files /dev/null and b/Sources/Stim/Resources/Images/remove_black.png differ diff --git a/Sources/Stim/Resources/Images/remove_red.png b/Sources/Stim/Resources/Images/remove_red.png new file mode 100644 index 0000000..dfc2dd8 Binary files /dev/null and b/Sources/Stim/Resources/Images/remove_red.png differ diff --git a/Sources/Stim/Resources/Images/remove_white.png b/Sources/Stim/Resources/Images/remove_white.png new file mode 100644 index 0000000..8dfb79d Binary files /dev/null and b/Sources/Stim/Resources/Images/remove_white.png differ