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
{
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)
private async void RemoveGame(object sender, EventArgs e)
{
Navigation.PopAsync();
base.OnNavigatedFrom(args);
}
protected override void OnDisappearing()
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)
{
Navigation.PopAsync();
base.OnDisappearing();
(App.Current as App).Manager.RemoveGameFromGamesList((App.Current as App).Manager.SelectedGame);
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)
{
InitializeComponent();
LabelTxt.Text = fieldName;
placeholder.Text = fieldName;
}
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;
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