using System; using System.Collections.Generic; using Xamarin.Forms; namespace TheGameExtreme.view { public partial class GamePreparationPage : ContentPage { public List listNbPlayer = new List { 1, 2, 3, 4, 5 }; public List listGameMode = new List { "entières", "relatives", "décimales", "fractionnées" }; public List listNbStack = new List { 4, 5, 6, 7, 8 }; public GamePreparationPage() { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); PlayerSelecter.ItemsSource = listNbPlayer; PlayerSelecter.SelectedIndex = 0; SelectMode.ItemsSource = listGameMode; SelectMode.SelectedIndex = 0; SelectNbStack.ItemsSource = listNbStack; SelectNbStack.SelectedIndex = 0; } private async void Back(object sender, EventArgs e) { await Navigation.PopAsync(); } private async void Play(object sender, EventArgs args) { List playersNames = new List(); for (int i = 1; i < NameList.Children.Count; i++) { playersNames.Add(((Entry)NameList.Children[i]).Text); if (string.IsNullOrWhiteSpace(playersNames[playersNames.Count - 1])) { await DisplayAlert("Erreur pseudo", AppRessource.StrEnterPseudo, "OK"); return; } } await Navigation.PushAsync(new MainPage(playersNames)); } private void ChangedPseudo(object sender, EventArgs args) { while (NameList.Children.Count - 1 != (int)PlayerSelecter.SelectedItem) { if (NameList.Children.Count - 1 < (int)PlayerSelecter.SelectedItem) { Entry e = new Entry { Placeholder = "Pseudo", BackgroundColor = (Color)Application.Current.Resources["SkyBlueColor"], WidthRequest = 200, MinimumWidthRequest = 50, HorizontalOptions = LayoutOptions.Center }; //Frame myFrame = new Frame //{ // BackgroundColor = (Color)Application.Current.Resources["SkyBlueColor"], // HeightRequest = 45, // VerticalOptions = LayoutOptions.Center, // HorizontalOptions = LayoutOptions.Center, // WidthRequest = 120, // CornerRadius = 10, // Content = e //}; NameList.Children.Add(e); } else { NameList.Children.RemoveAt(NameList.Children.Count - 1); } } } private void SelectNbStack_Changed(object sender, EventArgs args) { } private void SelectMode_SelectedIndexChanged(object sender, EventArgs e) { } } }