You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
3.4 KiB

using System;
using Xamarin.Forms;
using TheGameExtreme.IO;
using TheGameExtreme.Resx;
namespace TheGameExtreme.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 async void OpenMultiPlayerMode(object sender, EventArgs args)
{
await DisplayAlert("Mode en cours de développement", null, "Fermer");
//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 );
}
}
}