suppression page setting et changement sur le theme qui vient se place sur la page d'acceuil

master
Baptiste ARNAUD 5 years ago
parent 1ff7e4f3e2
commit 88a7e41aa4

@ -5800,67 +5800,73 @@ namespace TheGameExtreme.Droid
public const int imagesRules = 2131165291;
// aapt resource value: 0x7F07006C
public const int mtrl_snackbar_background = 2131165292;
public const int LuneSombreTheme = 2131165292;
// aapt resource value: 0x7F07006D
public const int mtrl_tabs_default_indicator = 2131165293;
public const int mtrl_snackbar_background = 2131165293;
// aapt resource value: 0x7F07006E
public const int navigation_empty_icon = 2131165294;
public const int mtrl_tabs_default_indicator = 2131165294;
// aapt resource value: 0x7F07006F
public const int notification_action_background = 2131165295;
public const int navigation_empty_icon = 2131165295;
// aapt resource value: 0x7F070070
public const int notification_bg = 2131165296;
public const int notification_action_background = 2131165296;
// aapt resource value: 0x7F070071
public const int notification_bg_low = 2131165297;
public const int notification_bg = 2131165297;
// aapt resource value: 0x7F070072
public const int notification_bg_low_normal = 2131165298;
public const int notification_bg_low = 2131165298;
// aapt resource value: 0x7F070073
public const int notification_bg_low_pressed = 2131165299;
public const int notification_bg_low_normal = 2131165299;
// aapt resource value: 0x7F070074
public const int notification_bg_normal = 2131165300;
public const int notification_bg_low_pressed = 2131165300;
// aapt resource value: 0x7F070075
public const int notification_bg_normal_pressed = 2131165301;
public const int notification_bg_normal = 2131165301;
// aapt resource value: 0x7F070076
public const int notification_icon_background = 2131165302;
public const int notification_bg_normal_pressed = 2131165302;
// aapt resource value: 0x7F070077
public const int notification_template_icon_bg = 2131165303;
public const int notification_icon_background = 2131165303;
// aapt resource value: 0x7F070078
public const int notification_template_icon_low_bg = 2131165304;
public const int notification_template_icon_bg = 2131165304;
// aapt resource value: 0x7F070079
public const int notification_tile_bg = 2131165305;
public const int notification_template_icon_low_bg = 2131165305;
// aapt resource value: 0x7F07007A
public const int notify_panel_notification_icon_bg = 2131165306;
public const int notification_tile_bg = 2131165306;
// aapt resource value: 0x7F07007B
public const int rules = 2131165307;
public const int notify_panel_notification_icon_bg = 2131165307;
// aapt resource value: 0x7F07007C
public const int rulesImg = 2131165308;
public const int rules = 2131165308;
// aapt resource value: 0x7F07007D
public const int tooltip_frame_dark = 2131165309;
public const int rulesImg = 2131165309;
// aapt resource value: 0x7F07007E
public const int tooltip_frame_light = 2131165310;
public const int SoleilThemes = 2131165310;
// aapt resource value: 0x7F07007F
public const int TrierImageB = 2131165311;
public const int tooltip_frame_dark = 2131165311;
// aapt resource value: 0x7F070080
public const int UsersExiticon = 2131165312;
public const int tooltip_frame_light = 2131165312;
// aapt resource value: 0x7F070081
public const int TrierImageB = 2131165313;
// aapt resource value: 0x7F070082
public const int UsersExiticon = 2131165314;
static Drawable()
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

@ -157,5 +157,11 @@
<SubType>Designer</SubType>
</AndroidResource>
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\LuneSombreTheme.png" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\SoleilThemes.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

@ -181,6 +181,8 @@
<BundleResource Include="Resources\TrierImageB.ico" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\SoleilThemes.png" />
<BundleResource Include="Resources\LuneSombreTheme.png" />
<Content Include="TrierImageB.ico" />
</ItemGroup>
</Project>

@ -5,11 +5,12 @@
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:resources="clr-namespace:TheGameExtreme.Resx"
x:Class="TheGameExtreme.view.HomePage">
x:Class="TheGameExtreme.view.HomePage"
x:Name="homepageT">
<StackLayout BackgroundColor="Transparent">
<Grid>
<Grid x:Name="MainGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="15*"/>
@ -32,15 +33,7 @@
VerticalTextAlignment="Center"
FontFamily=""/>
<ImageButton
Source="EngrenageV1.jpeg"
Grid.Row="0" Grid.Column="2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="End"
HeightRequest="60"
WidthRequest="68"
Clicked="OpenSetting"
BackgroundColor="{DynamicResource BlackColor}"/>
<Button
Text="{x:Static resources:AppResources.StrLocalGame}"
@ -53,7 +46,6 @@
VerticalOptions="Center"
Clicked="OpenGame"
CornerRadius="10"
Margin="15"
BackgroundColor="{DynamicResource SkyBlueColor}"/>
@ -68,19 +60,39 @@
WidthRequest="230"
Clicked="OpenMultiPlayerMode"
CornerRadius="10"
Margin="15"
BackgroundColor="{DynamicResource SkyBlueColor}"/>
<ImageButton
Source="imagesRules.png"
Grid.Column="0"
Grid.Row="0"
HeightRequest="50"
WidthRequest="35"
VerticalOptions="CenterAndExpand"
HorizontalOptions="Start"
<Button Text="{x:Static resources:AppResources.StrTitleRules}"
FontSize="18"
Grid.Row="3"
Grid.Column="1"
HorizontalOptions="Center"
VerticalOptions="Center"
HeightRequest="57"
WidthRequest="230"
Clicked="Rules_Clicked"
BackgroundColor="{DynamicResource BlackColor}"/>
CornerRadius="10"
BackgroundColor="{DynamicResource SkyBlueColor}"/>
<Grid Grid.Row="0" Grid.Column="2" x:Name="ButtonGrid">
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="5*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="5*" />
</Grid.ColumnDefinitions>
<ImageButton
x:Name="imageButton"
Grid.Column="1"
Grid.Row="1"
VerticalOptions="End"
HorizontalOptions="Center"
Clicked="Theme_Clicked"
BackgroundColor="Transparent"/>
</Grid>
</Grid>

@ -18,7 +18,7 @@ namespace TheGameExtreme.view
{
InitializeComponent();
NavigationPage.SetHasNavigationBar(this, false);
SetTheme();
LoadParameterOptionOnHomepage();
}
@ -33,11 +33,6 @@ namespace TheGameExtreme.view
//await Navigation.PushAsync(new MultiPlayerMode());
}
private async void OpenSetting(object sender, EventArgs args)
{
await Navigation.PushAsync(new Settings());
}
private async void Rules_Clicked(object sender, EventArgs e)
{
await DisplayAlert(AppResources.StrTitleRules, AppResources.StrRules, AppResources.StrCloseWind);
@ -51,15 +46,63 @@ namespace TheGameExtreme.view
{
Application.Current.Resources["BlackColor"] = Color.Black;
Application.Current.Resources["WhiteColor"] = Color.White;
imageButton.Source = "SoleilThemes.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);
System.Diagnostics.Debug.WriteLine("Source : " + imageButton.Source);
if(homepageT.BackgroundColor == Color.Black)
{
b = true;
Application.Current.Resources["BlackColor"] = Color.White;
Application.Current.Resources["WhiteColor"] = Color.Black;
imageButton = new ImageButton()
{
BackgroundColor = (Color)Application.Current.Resources["BlackColor"]
};
imageButton.Source = "LuneSombreTheme.png";
}
else
{
b = false;
Application.Current.Resources["BlackColor"] = Color.Black;
Application.Current.Resources["WhiteColor"] = Color.White;
imageButton = new ImageButton()
{
BackgroundColor = (Color)Application.Current.Resources["BlackColor"]
};
imageButton.Source = "SoleilThemes.png";
}
ButtonGrid.Children.Add(imageButton, 1, 1);
imageButton.Clicked += Theme_Clicked;
IOOptions.SaveOptionParameter(b);
}
private void SetTheme()
{
if (homepageT.BackgroundColor == Color.Black)
{
imageButton.Source = "SoleilThemes.png";
}
if(homepageT.BackgroundColor == Color.White)
{
imageButton.Source = "LuneSombreTheme";
}
}
}
}

@ -7,9 +7,9 @@
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="2*"/>
<RowDefinition Height="4*"/>
<RowDefinition Height="4*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
@ -32,7 +32,7 @@
HorizontalTextAlignment="Center"
Grid.Column="1" Grid.Row="0"/>
<!--<Button Text="Connexion Bluetooth"
<Button Text="Heberger une partie"
Grid.Row="1"
Grid.Column="1"
WidthRequest="230"
@ -42,7 +42,7 @@
CornerRadius="10"
BackgroundColor="{DynamicResource SkyBlueColor}"/>
<Button Text="Connexion Wifi"
<Button Text="Rejoindre une partie"
Grid.Row="2"
Grid.Column="1"
WidthRequest="230"
@ -50,7 +50,7 @@
VerticalOptions="Center"
HorizontalOptions="Center"
CornerRadius="10"
BackgroundColor="{DynamicResource SkyBlueColor}"/>-->
BackgroundColor="{DynamicResource SkyBlueColor}"/>
<!--<Button Text="bouton statue"
Clicked="BtnStatueClicked"

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage BackgroundColor="{DynamicResource BlackColor}" x:Name="pageContentSetting"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:resources="clr-namespace:TheGameExtreme.Resx"
x:Class="TheGameExtreme.view.Settings">
<Grid
Margin="20,20,20,20">
<Grid.RowDefinitions>
<RowDefinition Height="15*"/>
<RowDefinition Height="28*"/>
<RowDefinition Height="28*"/>
<RowDefinition Height="28*"/>
</Grid.RowDefinitions>
<StackLayout
Grid.Row="0">
<ImageButton Source="ArrowSettingsBack.png"
VerticalOptions="Start"
HorizontalOptions="StartAndExpand"
HeightRequest="40"
WidthRequest="50"
Clicked="SettingToHomePage"
BackgroundColor="{DynamicResource BlackColor}"
Margin="10,10,0,0"/>
</StackLayout>
<StackLayout
Grid.Row="2"
Orientation="Horizontal">
<Label
Text="{x:Static resources:AppResources.WhiteTheme}"
FontSize="25"
TextColor="{DynamicResource WhiteColor}"/>
<Switch
Toggled="Switch_Toggled_Theme"
Margin="30,0,0,50"
x:Name="swTheme"
OnColor="{DynamicResource SkyBlueColor}"
ThumbColor="WhiteSmoke"/>
</StackLayout>
</Grid>
</ContentPage>

@ -1,97 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization.Json;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using TheGameExtreme.IO;
using Xamarin.Forms;
namespace TheGameExtreme.view
{
[Serializable]
public partial class Settings : ContentPage
{
public Settings()
{
InitializeComponent();
NavigationPage.SetHasNavigationBar(this, false);
if(pageContentSetting.BackgroundColor == Color.Black)
{
swTheme.IsToggled = false;
}
else
{
swTheme.IsToggled = true;
}
}
/*private void CBBr_CheckedChanged(object sender, CheckedChangedEventArgs e)
{
if (CBBr.IsChecked == true)
{
CBFr.IsChecked = false;
}
else if(CBBr.IsChecked == false)
{
CBFr.IsChecked = true;
}
}
private void CBFr_CheckedChanged(object sender, CheckedChangedEventArgs e)
{
if (CBFr.IsChecked == true)
{
CBBr.IsChecked = false;
}
else if (CBFr.IsChecked == false)
{
CBBr.IsChecked = true;
}
} */
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 == false)
{
Application.Current.Resources["BlackColor"] = Color.Black;
Application.Current.Resources["WhiteColor"] = Color.White;
}
else
{
Application.Current.Resources["BlackColor"] = Color.White;
Application.Current.Resources["WhiteColor"] = Color.Black;
}
}
private async void SettingToHomePage(object sender, EventArgs e)
{
IOOptions.SaveOptionParameter(swTheme.IsToggled);
//serialisationSwitch();
await Navigation.PopAsync();
}
protected override bool OnBackButtonPressed()
{
IOOptions.SaveOptionParameter(swTheme.IsToggled);
return base.OnBackButtonPressed();
}
}
}
Loading…
Cancel
Save