fonction pour supprimer un jeu
continuous-integration/drone/push Build is failing Details

Popup_qui_marche_pas
Anthony RICHARD 2 years ago
parent 750aa1778c
commit 321fa13b17

@ -6,15 +6,11 @@ namespace Stim;
public partial class DetailledPage : ContentPage public partial class DetailledPage : ContentPage
{ {
private Game currentGame;
public DetailledPage() public DetailledPage()
{ {
InitializeComponent(); InitializeComponent();
currentGame = (App.Current as App).Manager.SelectedGame; BindingContext = (App.Current as App).Manager.SelectedGame;
BindingContext = currentGame; if ((App.Current as App).Manager.SelectedGame is null) Navigation.RemovePage(this);
if (currentGame is null) Navigation.PopAsync();
} }
private async void GoToMainPage(object sender, EventArgs e) 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) foreach (Game game in ((App)App.Current).Manager.CurrentUser.Followed_Games)
{ {
if (game == null) throw new Exception(); 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) if (!flag)
{ {
await this.ShowPopupAsync(new MessagePopup("Jeu ajouté dans les suivis !")); 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 else
{ {
@ -46,20 +42,14 @@ public partial class DetailledPage : ContentPage
} }
} }
protected override void OnNavigatedFrom(NavigatedFromEventArgs args) private async void RemoveGame(object sender, EventArgs e)
{ {
Navigation.PopAsync(); var res = await this.ShowPopupAsync(new ConfirmationPopup("Voulez-vous vraiment supprimer " + (App.Current as App).Manager.SelectedGame.Name + " ?"));
base.OnNavigatedFrom(args); if (res != null && res is bool && (bool)res)
}
protected override void OnDisappearing()
{ {
Navigation.PopAsync(); (App.Current as App).Manager.RemoveGameFromGamesList((App.Current as App).Manager.SelectedGame);
base.OnDisappearing(); await Navigation.PopAsync();
await this.ShowPopupAsync(new MessagePopup("Jeu supprimé !"));
} }
protected override void OnAppearing()
{
base.OnAppearing();
} }
} }

@ -7,7 +7,7 @@ public partial class EntryPopup : Popup
public EntryPopup(string fieldName) public EntryPopup(string fieldName)
{ {
InitializeComponent(); InitializeComponent();
LabelTxt.Text = fieldName; placeholder.Text = fieldName;
} }
public void CloseButton(object sender, EventArgs e) public void CloseButton(object sender, EventArgs e)

@ -15,4 +15,9 @@ public partial class FollowPage : ContentPage
(App.Current as App).Manager.SelectedGame = (sender as CollectionView).SelectedItem as Game; (App.Current as App).Manager.SelectedGame = (sender as CollectionView).SelectedItem as Game;
await Navigation.PushAsync(new DetailledPage()); await Navigation.PushAsync(new DetailledPage());
} }
protected override void OnAppearing()
{
base.OnAppearing();
}
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Loading…
Cancel
Save