|
|
@ -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();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|