theme prêt

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

@ -1,13 +1,12 @@
<?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.Resources>
<ResourceDictionary x:Key="DictionnaireR">
<Style x:Key="ColorApplication" TargetType="ContentPage">
<Setter Property="BackgroundColor" Value="Black"></Setter>
</Style>
<Style x:Key="ColorLabel" TargetType="Label">
<Setter Property="TextColor" Value="Black"></Setter>
</Style>
<ResourceDictionary>
<Color x:Key="BlackColor">black</Color>
<Color x:Key="WhiteColor">white</Color>
<Color x:Key="SkyBlueColor">SkyBlue</Color>
</ResourceDictionary>
</Application.Resources>

@ -1,5 +1,5 @@
<?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:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TheGameExtreme.view.HomePage">
@ -18,7 +18,7 @@
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Label Text="THE GAME" TextColor="White"
<Label Text="THE GAME" TextColor="{DynamicResource WhiteColor}"
Grid.Row="0" Grid.Column="1"
HorizontalTextAlignment="Center"
FontSize="35"
@ -42,7 +42,7 @@
Clicked="OpenGame"
CornerRadius="10"
Margin="15"
BackgroundColor="White"/>
BackgroundColor="{DynamicResource SkyBlueColor}"/>
<Button Text="Multijoueur" FontSize="18" Grid.Row="2" Grid.Column="1"
@ -53,7 +53,7 @@
Clicked="OpenMultiPlayerMode"
CornerRadius="10"
Margin="15"
BackgroundColor="White"/>
BackgroundColor="{DynamicResource SkyBlueColor}"/>
<Button Text="Connexion en ligne" FontSize="16" Grid.Row="3" Grid.Column="1"
HorizontalOptions="Center"
@ -62,7 +62,7 @@
HeightRequest="57"
CornerRadius="10"
Margin="15"
BackgroundColor="White"/>
BackgroundColor="{DynamicResource SkyBlueColor}"/>
<ImageButton Source="imagesRules.png" Grid.Column="0"
Grid.Row="0"

@ -1,11 +1,10 @@
<?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:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TheGameExtreme.view.Settings"
Resources="">
x:Class="TheGameExtreme.view.Settings">
<Grid>
<Grid.RowDefinitions>
@ -33,14 +32,14 @@
<Label HorizontalTextAlignment="Start"
Text ="Langage" Grid.Column="0"
Grid.Row="0" FontSize="25"
x:Name="lbColor0"
TextColor="{DynamicResource WhiteColor}"
Margin="40,58,0,0"/>
<Label Text="English"
Grid.Column="1" Grid.Row="0"
FontSize="25"
x:Name="lbColor1"
TextColor="{DynamicResource WhiteColor}"
Margin="80,58,0,0"/>
<CheckBox IsChecked="False"
@ -53,8 +52,7 @@
<Label Text="Français"
Grid.Column="2" Grid.Row="0"
FontSize="25"
x:Name="lbColor2"
TextColor="{DynamicResource WhiteColor}"
Margin="80,58,0,0"/>
<CheckBox IsChecked="True"
@ -62,30 +60,27 @@
x:Name="CBFr"
CheckedChanged="CBFr_CheckedChanged"
Color="SkyBlue"
Margin="40,63,0,0"
/>
Margin="40,63,0,0"/>
<Label HorizontalTextAlignment="Start"
Text="Mode Extreme" Grid.Column="0"
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"
OnColor="SkyBlue"
ThumbColor="WhiteSmoke"/>
<Label Text="Thème sombre"
<Label Text="Thème Clair"
Grid.Column="0" Grid.Row="3"
FontSize="25"
x:Name="lbColor4"
Margin="40,25,0,0"/>
TextColor="{DynamicResource WhiteColor}"
Margin="40,25,0,0"/>
<Switch IsToggled="True"
<Switch
Grid.Column="1" Grid.Row="3"
Toggled="Switch_Toggled_Theme" x:Name="swTheme"
OnColor="SkyBlue" ThumbColor="WhiteSmoke"/>

@ -13,6 +13,15 @@ namespace TheGameExtreme.view
{
InitializeComponent();
NavigationPage.SetHasNavigationBar(this, false);
if(pageContentSetting.BackgroundColor == Color.Black)
{
swTheme.IsToggled = false;
}
else
{
swTheme.IsToggled = true;
}
}
@ -37,35 +46,18 @@ 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
{
if (swTheme.IsToggled == true)
if (swTheme.IsToggled == false)
{
/*(Application.Current.Resources["ColorLabelText"] as Style).
pageContentSetting.Style = Application.Current.Resources["MyBackGroundColorStyle"] as Style;
lbColor0.Style = Application.Current.Resources["ColorLabelDark"] as Style;
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;*/
Application.Current.Resources["BlackColor"] = Color.Black;
Application.Current.Resources["WhiteColor"] = Color.White;
Application.Current.Resources["SkyBlueColor"] = Color.SkyBlue;
}
else
{
WhiteTheme();
}
}
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;
Application.Current.Resources["BlackColor"] = Color.White;
Application.Current.Resources["WhiteColor"] = Color.Black;
Application.Current.Resources["BlueSkyColor"] = Color.SkyBlue;
}
}

Loading…
Cancel
Save