theme prêt

master
Baptiste ARNAUD 6 years ago
parent 103b4801ed
commit 09ed366d2a

@ -1,13 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Application xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:d="http://xamarin.com/schemas/2014/forms/design" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="TheGameExtreme.App"> <Application xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:d="http://xamarin.com/schemas/2014/forms/design" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="TheGameExtreme.App">
<Application.Resources> <Application.Resources>
<ResourceDictionary x:Key="DictionnaireR"> <ResourceDictionary>
<Style x:Key="ColorApplication" TargetType="ContentPage">
<Setter Property="BackgroundColor" Value="Black"></Setter> <Color x:Key="BlackColor">black</Color>
</Style> <Color x:Key="WhiteColor">white</Color>
<Style x:Key="ColorLabel" TargetType="Label"> <Color x:Key="SkyBlueColor">SkyBlue</Color>
<Setter Property="TextColor" Value="Black"></Setter>
</Style>
</ResourceDictionary> </ResourceDictionary>
</Application.Resources> </Application.Resources>

@ -12,7 +12,7 @@ namespace TheGameExtreme
InitializeComponent(); InitializeComponent();
MainPage = new NavigationPage(new HomePage()); MainPage = new NavigationPage(new HomePage());
} }
protected override void OnStart() protected override void OnStart()

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ContentPage Title="THEGAME" Style="{DynamicResource ColorApplication}" <ContentPage Title="THEGAME" BackgroundColor="{DynamicResource BlackColor}"
xmlns="http://xamarin.com/schemas/2014/forms" xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TheGameExtreme.view.HomePage"> x:Class="TheGameExtreme.view.HomePage">
@ -18,7 +18,7 @@
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label Text="THE GAME" TextColor="White" <Label Text="THE GAME" TextColor="{DynamicResource WhiteColor}"
Grid.Row="0" Grid.Column="1" Grid.Row="0" Grid.Column="1"
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"
FontSize="35" FontSize="35"
@ -42,7 +42,7 @@
Clicked="OpenGame" Clicked="OpenGame"
CornerRadius="10" CornerRadius="10"
Margin="15" Margin="15"
BackgroundColor="White"/> BackgroundColor="{DynamicResource SkyBlueColor}"/>
<Button Text="Multijoueur" FontSize="18" Grid.Row="2" Grid.Column="1" <Button Text="Multijoueur" FontSize="18" Grid.Row="2" Grid.Column="1"
@ -53,7 +53,7 @@
Clicked="OpenMultiPlayerMode" Clicked="OpenMultiPlayerMode"
CornerRadius="10" CornerRadius="10"
Margin="15" Margin="15"
BackgroundColor="White"/> BackgroundColor="{DynamicResource SkyBlueColor}"/>
<Button Text="Connexion en ligne" FontSize="16" Grid.Row="3" Grid.Column="1" <Button Text="Connexion en ligne" FontSize="16" Grid.Row="3" Grid.Column="1"
HorizontalOptions="Center" HorizontalOptions="Center"
@ -62,7 +62,7 @@
HeightRequest="57" HeightRequest="57"
CornerRadius="10" CornerRadius="10"
Margin="15" Margin="15"
BackgroundColor="White"/> BackgroundColor="{DynamicResource SkyBlueColor}"/>
<ImageButton Source="imagesRules.png" Grid.Column="0" <ImageButton Source="imagesRules.png" Grid.Column="0"
Grid.Row="0" Grid.Row="0"

@ -1,12 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ContentPage Style="{DynamicResource ColorApplication}" x:Name="pageContentSetting" <ContentPage BackgroundColor="{DynamicResource BlackColor}" x:Name="pageContentSetting"
xmlns="http://xamarin.com/schemas/2014/forms" xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TheGameExtreme.view.Settings" x:Class="TheGameExtreme.view.Settings">
Resources="">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
@ -33,14 +32,14 @@
<Label HorizontalTextAlignment="Start" <Label HorizontalTextAlignment="Start"
Text ="Langage" Grid.Column="0" Text ="Langage" Grid.Column="0"
Grid.Row="0" FontSize="25" Grid.Row="0" FontSize="25"
x:Name="lbColor0" TextColor="{DynamicResource WhiteColor}"
Margin="40,58,0,0"/> Margin="40,58,0,0"/>
<Label Text="English" <Label Text="English"
Grid.Column="1" Grid.Row="0" Grid.Column="1" Grid.Row="0"
FontSize="25" FontSize="25"
x:Name="lbColor1"
TextColor="{DynamicResource WhiteColor}"
Margin="80,58,0,0"/> Margin="80,58,0,0"/>
<CheckBox IsChecked="False" <CheckBox IsChecked="False"
@ -52,9 +51,8 @@
<Label Text="Français" <Label Text="Français"
Grid.Column="2" Grid.Row="0" Grid.Column="2" Grid.Row="0"
FontSize="25" FontSize="25"
x:Name="lbColor2" TextColor="{DynamicResource WhiteColor}"
Margin="80,58,0,0"/> Margin="80,58,0,0"/>
<CheckBox IsChecked="True" <CheckBox IsChecked="True"
@ -62,30 +60,27 @@
x:Name="CBFr" x:Name="CBFr"
CheckedChanged="CBFr_CheckedChanged" CheckedChanged="CBFr_CheckedChanged"
Color="SkyBlue" Color="SkyBlue"
Margin="40,63,0,0" Margin="40,63,0,0"/>
/>
<Label HorizontalTextAlignment="Start" <Label HorizontalTextAlignment="Start"
Text="Mode Extreme" Grid.Column="0" Text="Mode Extreme" Grid.Column="0"
Grid.Row="2" FontSize="25" Grid.Row="2" FontSize="25"
x:Name="lbColor3" TextColor="{DynamicResource WhiteColor}"
Margin="40,25,0,0"/>
Margin="40,25,0,0"/>
<Switch IsToggled="True" <Switch
Grid.Column="1" Grid.Row="2" Grid.Column="1" Grid.Row="2"
OnColor="SkyBlue" OnColor="SkyBlue"
ThumbColor="WhiteSmoke"/> ThumbColor="WhiteSmoke"/>
<Label Text="Thème sombre" <Label Text="Thème Clair"
Grid.Column="0" Grid.Row="3" Grid.Column="0" Grid.Row="3"
FontSize="25" FontSize="25"
x:Name="lbColor4" TextColor="{DynamicResource WhiteColor}"
Margin="40,25,0,0"/>
Margin="40,25,0,0"/>
<Switch IsToggled="True" <Switch
Grid.Column="1" Grid.Row="3" Grid.Column="1" Grid.Row="3"
Toggled="Switch_Toggled_Theme" x:Name="swTheme" Toggled="Switch_Toggled_Theme" x:Name="swTheme"
OnColor="SkyBlue" ThumbColor="WhiteSmoke"/> OnColor="SkyBlue" ThumbColor="WhiteSmoke"/>

@ -13,7 +13,16 @@ namespace TheGameExtreme.view
{ {
InitializeComponent(); InitializeComponent();
NavigationPage.SetHasNavigationBar(this, false); NavigationPage.SetHasNavigationBar(this, false);
if(pageContentSetting.BackgroundColor == Color.Black)
{
swTheme.IsToggled = false;
}
else
{
swTheme.IsToggled = true;
}
} }
private void CBBr_CheckedChanged(object sender, CheckedChangedEventArgs e) private void CBBr_CheckedChanged(object sender, CheckedChangedEventArgs e)
@ -37,37 +46,20 @@ namespace TheGameExtreme.view
private void Switch_Toggled_Theme(object sender, ToggledEventArgs e)//Change le background color de settings en noir et swap la couleur des labels en blanc private void Switch_Toggled_Theme(object sender, ToggledEventArgs e)//Change le background color de settings en noir et swap la couleur des labels en blanc
{ {
if (swTheme.IsToggled == true) if (swTheme.IsToggled == false)
{ {
/*(Application.Current.Resources["ColorLabelText"] as Style). Application.Current.Resources["BlackColor"] = Color.Black;
pageContentSetting.Style = Application.Current.Resources["MyBackGroundColorStyle"] as Style; Application.Current.Resources["WhiteColor"] = Color.White;
lbColor0.Style = Application.Current.Resources["ColorLabelDark"] as Style; Application.Current.Resources["SkyBlueColor"] = Color.SkyBlue;
lbColor1.Style = Application.Current.Resources["ColorLabelDark"] as Style;
lbColor2.Style = Application.Current.Resources["ColorLabelDark"] as Style;
lbColor3.Style = Application.Current.Resources["ColorLabelDark"] as Style;
lbColor4.Style = Application.Current.Resources["ColorLabelDark"] as Style;*/
} }
else else
{ {
WhiteTheme(); Application.Current.Resources["BlackColor"] = Color.White;
} Application.Current.Resources["WhiteColor"] = Color.Black;
} Application.Current.Resources["BlueSkyColor"] = Color.SkyBlue;
private void WhiteTheme()//Change le background color de settings en Blanc et swap la couleur des labels en noir
{
{
pageContentSetting.Style = Application.Current.Resources["MyBackGroundColorStyle2"] as Style;
lbColor0.Style = Application.Current.Resources["ColorLabelWhite"] as Style;
lbColor1.Style = Application.Current.Resources["ColorLabelWhite"] as Style;
lbColor2.Style = Application.Current.Resources["ColorLabelWhite"] as Style;
lbColor3.Style = Application.Current.Resources["ColorLabelWhite"] as Style;
lbColor4.Style = Application.Current.Resources["ColorLabelWhite"] as Style;
} }
} }
private async void SettingToHomePage(object sender, EventArgs e) private async void SettingToHomePage(object sender, EventArgs e)
{ {

Loading…
Cancel
Save