using System; using OrderStacks.Interface; using OrderStacks.IO; using OrderStacks.Resx; using Xamarin.Forms; namespace OrderStacks.view { public partial class HomePage : ContentPage { public HomePage() { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); NavigationPage.SetHasBackButton(this, false); LoadParameterOptionOnHomepage(); } private async void OpenGame(object sender, EventArgs args) { await Navigation.PushAsync(new GamePreparationPage()); } private void OpenMultiPlayerMode(object sender, EventArgs args) { DependencyService.Get().ShortAlert("Mode en cours de développement"); //await Navigation.PushAsync(new MultiPlayerMode()); } private async void Rules_Clicked(object sender, EventArgs args) { await Navigation.PushAsync(new RulesGame()); } public void LoadParameterOptionOnHomepage() { bool b = IOOptions.LoadOptionsParameter(); if (!b) { Application.Current.Resources["BlackColor"] = Color.Black; Application.Current.Resources["WhiteColor"] = Color.White; imageButton.Source = "Elsole.png"; } else { Application.Current.Resources["BlackColor"] = Color.White; Application.Current.Resources["WhiteColor"] = Color.Black; imageButton.Source = "LuneSombreTheme.png"; } } private void Theme_Clicked(object sender, EventArgs e) { bool b; ButtonGrid.Children.Remove(imageButton); if(homepageT.BackgroundColor == Color.Black) { b = true; Application.Current.Resources["BlackColor"] = Color.White; Application.Current.Resources["WhiteColor"] = Color.Black; imageButton = new ImageButton() { BackgroundColor = Color.Transparent, BorderColor = (Color)Application.Current.Resources["SkyBlueColor"] }; imageButton.Source = "LuneSombreTheme.png"; } else { b = false; Application.Current.Resources["BlackColor"] = Color.Black; Application.Current.Resources["WhiteColor"] = Color.White; imageButton = new ImageButton() { BackgroundColor = Color.Transparent, BorderColor = (Color)Application.Current.Resources["SkyBlueColor"], }; imageButton.Source = "Elsole.png"; } ButtonGrid.Children.Add(imageButton, 1, 1); imageButton.Clicked += Theme_Clicked; imageButton.HorizontalOptions = LayoutOptions.Center; imageButton.VerticalOptions = LayoutOptions.End; IOOptions.SaveOptionParameter(b); } private async void ImageButton_Clicked(object sender, EventArgs e) { await DisplayAlert(AppResources.StrInfo,AppResources.StrAbout, AppResources.StrCloseWind ); } } }