(Admin) Création Jeu et Persistance (en cours)
continuous-integration/drone/push Build is failing Details

pull/49/head
Rémi LAVERGNE 2 years ago
parent 1078d4a5ad
commit 8e1f8ea73d

@ -1,172 +0,0 @@

namespace GameAtlas.Models
{
public class Popup
{
public static Manager PopUpManager => (App.Current as App).MyManager;
public static async Task<string> CreatePopupAsync()
{
var tcs = new TaskCompletionSource<string>();
var popupPage = new ContentPage();
popupPage.BackgroundColor = Color.FromRgba(255, 255, 255, 0);
var popupLayout = new StackLayout
{
Padding = new Thickness(20),
BackgroundColor = Color.FromRgba(255, 255, 255, 255)
};
var titleLabel = new Label
{
Text = "Informations sur le Jeu",
FontSize = 18,
FontAttributes = FontAttributes.Bold,
HorizontalOptions = LayoutOptions.Center
};
popupLayout.Children.Add(titleLabel);
var nomLabel = new Label
{
Text = "Nom :"
};
var nomEntry = new Entry();
popupLayout.Children.Add(nomLabel);
popupLayout.Children.Add(nomEntry);
var sortieLabel = new Label
{
Text = "Date de Sortie :"
};
var sortieDatePicker = new DatePicker();
popupLayout.Children.Add(sortieLabel);
popupLayout.Children.Add(sortieDatePicker);
var plateformesLabel = new Label
{
Text = "Plateformes :"
};
var plateformesEntry = new Entry();
popupLayout.Children.Add(plateformesLabel);
popupLayout.Children.Add(plateformesEntry);
var developpeurLabel = new Label
{
Text = "Développeur :"
};
var developpeurEntry = new Entry();
popupLayout.Children.Add(developpeurLabel);
popupLayout.Children.Add(developpeurEntry);
var editeurLabel = new Label
{
Text = "Éditeur :"
};
var editeurEntry = new Entry();
popupLayout.Children.Add(editeurLabel);
popupLayout.Children.Add(editeurEntry);
var noteLabel = new Label
{
Text = "Note :"
};
var noteEntry = new Entry();
popupLayout.Children.Add(noteLabel);
popupLayout.Children.Add(noteEntry);
var nbTelechargementLabel = new Label
{
Text = "Nombre de téléchargements :"
};
var nbTelechargementEntry = new Entry();
popupLayout.Children.Add(nbTelechargementLabel);
popupLayout.Children.Add(nbTelechargementEntry);
var genresLabel = new Label
{
Text = "Genres :"
};
var genresEntry = new Entry();
popupLayout.Children.Add(genresLabel);
popupLayout.Children.Add(genresEntry);
var imageLabel = new Label
{
Text = "Image :"
};
var imageEntry = new Entry();
popupLayout.Children.Add(imageLabel);
popupLayout.Children.Add(imageEntry);
var saveButton = new Button
{
Text = "Enregistrer",
HorizontalOptions = LayoutOptions.Center,
Margin = new Thickness(0, 20, 0, 0)
};
saveButton.Clicked += (sender, args) =>
{
// Récupérer les valeurs des champs
string nom = nomEntry.Text;
DateTime sortie = sortieDatePicker.Date;
string sortieString = sortie.ToString("dd/MM/yyyy");
string plateformesText = plateformesEntry.Text;
string developpeur = developpeurEntry.Text;
string editeur = editeurEntry.Text;
int note = int.Parse(noteEntry.Text);
int nbTelechargement = int.Parse(nbTelechargementEntry.Text);
string genresText = genresEntry.Text;
string image = imageEntry.Text;
// Séparer les plateformes par des espaces et les ajouter à une liste
// List<string> plateformesList = plateformesText.Split(' ').ToList();
// Séparer les genres par des espaces et les ajouter à une liste
// List<string> genresList = genresText.Split(' ').ToList();
Jeu jeu = new Jeu
(
nom,
sortieString,
//plateformesList,
plateformesText,
developpeur,
editeur,
note,
nbTelechargement,
//genresList,
genresText,
image
);
Popup.PopUpManager.AddJeux(jeu);
Popup.PopUpManager.SauvegardeDonnees();
// Fermer la popup et retourner les valeurs
Application.Current.MainPage.Navigation.PopModalAsync();
tcs.SetResult("");
};
popupLayout.Children.Add(saveButton);
popupPage.Content = popupLayout;
await Application.Current.MainPage.Navigation.PushModalAsync(popupPage);
return await tcs.Task;
}
}
}

@ -17,6 +17,14 @@ public partial class PageAdmin : ContentPage
private async void OnButtonClicked(object sender, EventArgs e) private async void OnButtonClicked(object sender, EventArgs e)
{ {
string result = await Popup.CreatePopupAsync(); string nom = await DisplayPromptAsync("Informations sur le Jeu", "Quel est le Titre ?", placeholder: "GTA VI");
string sortie = await DisplayPromptAsync("Informations sur le Jeu", "Date de Sortie", placeholder: "JJ/MM/AAAA");
string plateformes = await DisplayPromptAsync("Informations sur le Jeu", "Plateforme(s), un espace pour séparer", placeholder: "Ex: XOne PC PS5");
string developpeur = await DisplayPromptAsync("Informations sur le Jeu", "Développeur", placeholder: "Rockstar Games");
string editeur = await DisplayPromptAsync("Informations sur le Jeu", "Editeur", placeholder: "Take-Two Interactive");
string note = await DisplayPromptAsync("Informations sur le Jeu", "Note de 0 à 5", maxLength: 1, keyboard:Keyboard.Numeric, placeholder: "5");
string nbtelechargement = await DisplayPromptAsync("Informations sur le Jeu", "Nombre de Téléchargements (en milliers, ex: 630k)", keyboard: Keyboard.Numeric, placeholder: "630");
string genre = await DisplayPromptAsync("Informations sur le Jeu", "Genre(s), un espace pour séparer", placeholder: "Action Aventure");
string image = await DisplayPromptAsync("Informations sur le Jeu", "Image de couverture (préférez URL finissant par .png)", placeholder: "Take-Two Interactive");
} }
} }

@ -45,15 +45,21 @@
Text="Mot de Passe oublié" Text="Mot de Passe oublié"
TextColor="#7392FF" TextColor="#7392FF"
FontSize="13" FontSize="13"
FontFamily="PTSansNRegular" FontFamily="PTSansNRegular">
/> <Label.GestureRecognizers>
<TapGestureRecognizer Tapped="OnMotDePasseOublie_Tapped" />
</Label.GestureRecognizers>
</Label>
<Label <Label
Text="S'inscrire >" Text="S'inscrire >"
TextColor="#7392FF" TextColor="#7392FF"
FontSize="13" FontSize="13"
FontFamily="PTSansNBold" FontFamily="PTSansNBold">
/> <Label.GestureRecognizers>
<TapGestureRecognizer Tapped="OnInscrire_Tapped" />
</Label.GestureRecognizers>
</Label>
</HorizontalStackLayout> </HorizontalStackLayout>

@ -6,6 +6,7 @@ using System.Text.RegularExpressions;
public partial class PageConnexion : ContentPage public partial class PageConnexion : ContentPage
{ {
public int compteur { get; set; } = 0;
public Manager ConnexionManager => (App.Current as App).MyManager; public Manager ConnexionManager => (App.Current as App).MyManager;
public PageConnexion() public PageConnexion()
@ -31,6 +32,27 @@ public partial class PageConnexion : ContentPage
} }
private async void OnInscrire_Tapped(object sender, EventArgs e)
{
await Navigation.PushAsync(new PageInscription());
}
private async void OnMotDePasseOublie_Tapped(object sender, EventArgs e)
{
await DisplayAlert("Oh non !", "Le mot de passe va te revenir à force", "Concentration");
await DisplayAlert("Oh non !", "Encore un petit effort !", "Concentration");
bool reponse = await DisplayAlert("Alors ?", "Tu l'as retrouvé ce mot de passe ?", "Oui", "Non");
if (!reponse)
{
await DisplayAlert("...", "Désolé on peut rien pour toi. La prochaine fois utilise un papier comme tout le monde.", "RIP");
}
else
{
await DisplayAlert("...", "C'est bien, la prochaine fois tu le notera.", "Ok");
}
}
public bool Verification(string username, string password) public bool Verification(string username, string password)
{ {
foreach (Utilisateur user in ConnexionManager.Utilisateurs) foreach (Utilisateur user in ConnexionManager.Utilisateurs)
@ -46,6 +68,8 @@ public partial class PageConnexion : ContentPage
} }
} }
} }
Debug.WriteLine("La connection a echouée (pseudo ou mot de passe invalide)");
ConnexionManager.ConnectedUser = null;
return false; return false;
} }
} }
Loading…
Cancel
Save