Continuité des vues.xaml

master
Baptiste ARNAUD 6 years ago
parent 17093b2a7b
commit b4d7095552

@ -22,6 +22,7 @@ namespace TheGameExtreme.Droid
Xamarin.Essentials.Platform.Init(this, savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
LoadApplication(new App()); LoadApplication(new App());
Window.SetStatusBarColor(Android.Graphics.Color.Argb(255, 0, 0, 0));
} }
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults) public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
{ {

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.uca.thegameextreme"> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.uca.thegameextreme">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" /> <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
<application android:label="TheGameExtreme.Android"></application> <application android:label="TheGameExtreme.Android" ></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest> </manifest>

@ -38,7 +38,7 @@
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>AppRessources-br.Designer.cs</LastGenOutput> <LastGenOutput>AppRessources-br.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="Rules.xaml"> <EmbeddedResource Update="view\Rules.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator> <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Condition=" '$(EnableDefaultEmbeddedResourceItems)' == 'true' " Update="view\AppResources.resx"> <EmbeddedResource Condition=" '$(EnableDefaultEmbeddedResourceItems)' == 'true' " Update="view\AppResources.resx">

@ -5,12 +5,18 @@
<Style x:Key="MyBackGroundColorStyle" TargetType="ContentPage"> <Style x:Key="MyBackGroundColorStyle" TargetType="ContentPage">
<Setter Property="BackgroundColor" Value="Black"></Setter> <Setter Property="BackgroundColor" Value="Black"></Setter>
</Style> </Style>
<Style x:Key="MyBackGroundColorStyle1" TargetType="ContentPage">
<Setter Property="BackgroundColor" Value="Red"></Setter>
</Style>
<Style x:Key="MyBackGroundColorStyle2" TargetType="ContentPage"> <Style x:Key="MyBackGroundColorStyle2" TargetType="ContentPage">
<Setter Property="BackgroundColor" Value="White"></Setter> <Setter Property="BackgroundColor" Value="White"></Setter>
</Style> </Style>
<Style x:Key="ColorLabelDark" TargetType="Label">
<Setter Property="TextColor" Value="White"></Setter>
</Style>
<Style x:Key="ColorLabelWhite" TargetType="Label">
<Setter Property="TextColor" Value="Black"></Setter>
</Style>
</ResourceDictionary> </ResourceDictionary>
</Application.Resources> </Application.Resources>
</Application> </Application>

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

@ -19,14 +19,14 @@
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label Text="THE GAME" TextColor="White" <Label Text="THE GAME" TextColor="White"
Grid.Row="0" Grid.Column="1" Grid.Row="0" Grid.Column="1"
HorizontalTextAlignment="Center" HorizontalTextAlignment="Center"
FontSize="35" FontSize="35"
VerticalTextAlignment="Center"/> VerticalTextAlignment="Center"/>
<ImageButton Source="EngrenageV1.jpeg" <ImageButton Source="EngrenageV1.jpeg"
Grid.Row="0" Grid.Column="2" Grid.Row="0" Grid.Column="2"
VerticalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"
@ -34,32 +34,39 @@
HeightRequest="60" HeightRequest="60"
WidthRequest="68" WidthRequest="68"
Clicked="OpenSetting" Clicked="OpenSetting"
BackgroundColor="Transparent"
/> />
<Button Text="Solo" Grid.Row="1" Grid.Column="1" <Button Text="Solo" Grid.Row="1" Grid.Column="1"
HorizontalOptions="Center" HorizontalOptions="Center"
WidthRequest="150" WidthRequest="230"
HeightRequest="50" HeightRequest="40"
VerticalOptions="Center" VerticalOptions="Center"
Clicked="OpenGame" Clicked="OpenGame"
CornerRadius="20" CornerRadius="10"
Margin="15"/> Margin="20"/>
<Button Text="Multijoueur" Grid.Row="2" Grid.Column="1" <Button Text="Multijoueur" Grid.Row="2" Grid.Column="1"
HorizontalOptions="Center" HorizontalOptions="Center"
VerticalOptions="Center" VerticalOptions="Center"
HeightRequest="50" HeightRequest="40"
WidthRequest="180" WidthRequest="230"
Clicked="OpenMultiPlayerMode" Clicked="OpenMultiPlayerMode"
CornerRadius="20"/> CornerRadius="10"
Margin="20"
/>
<Button Text="Connexion en ligne" Grid.Row="3" Grid.Column="1" <Button Text="Connexion en ligne" Grid.Row="3" Grid.Column="1"
HorizontalOptions="Center" HorizontalOptions="Center"
VerticalOptions="Center" VerticalOptions="Center"
WidthRequest="230" WidthRequest="230"
HeightRequest="50" HeightRequest="40"
CornerRadius="20"/> CornerRadius="10"
Margin="20"/>
</Grid> </Grid>
</StackLayout> </StackLayout>
</ContentPage> </ContentPage>

@ -10,6 +10,10 @@ namespace TheGameExtreme.view
public HomePage() public HomePage()
{ {
InitializeComponent(); InitializeComponent();
NavigationPage.SetHasNavigationBar(this, false);
} }
private async void OpenGame(object sender, EventArgs args) private async void OpenGame(object sender, EventArgs args)

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ContentPage Style="{StaticResource Key=MyBackGroundColorStyle2}" x:Name="pageContentSetting" <ContentPage Style="{StaticResource Key=MyBackGroundColorStyle}" 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"
@ -19,20 +19,53 @@
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label HorizontalTextAlignment="Start" Text="langage" Grid.Column="0" Grid.Row="0" FontSize="25" TextColor="Black"/> <Label Style="{StaticResource ColorLabelDark}"
<Label Text="English" Grid.Column="1" Grid.Row="0" FontSize="25" TextColor="Black"/> HorizontalTextAlignment="Start"
<CheckBox IsChecked="False" Grid.Column="1" Grid.Row="0" x:Name="CBBr" CheckedChanged="CBBr_CheckedChanged"/> Text="langage" Grid.Column="0"
<Label Text="Français" Grid.Column="2" Grid.Row="0" FontSize="25" TextColor="Black"/> Grid.Row="0" FontSize="25"
<CheckBox IsChecked="True" Grid.Column="2" Grid.Row="0" x:Name="CBFr" CheckedChanged="CBFr_CheckedChanged"/> x:Name="lbColor0"/>
<Label Text="English"
Grid.Column="1" Grid.Row="0"
FontSize="25"
x:Name="lbColor1"
Style="{StaticResource ColorLabelDark}"/>
<Label HorizontalTextAlignment="Start" Text="Son" Grid.Column="0" Grid.Row="1" TextColor="Black" FontSize="25"/> <CheckBox IsChecked="False"
<Switch IsToggled="true" Grid.Column="1" Grid.Row="1" /> Grid.Column="1" Grid.Row="0"
<Label HorizontalTextAlignment="Start" Text="Mode Extreme" Grid.Column="0" Grid.Row="2" TextColor="Black" FontSize="25"/> x:Name="CBBr"
<Switch IsToggled="True" Grid.Column="1" Grid.Row="2" /> CheckedChanged="CBBr_CheckedChanged"/>
<Label Text="Thème sombre" Grid.Column="0" Grid.Row="3" FontSize="25" TextColor="Black"/> <Label Text="Français"
<Switch IsToggled="True" Grid.Column="1" Grid.Row="3" Toggled="Switch_Toggled_Theme" x:Name="swTheme"/> Grid.Column="2" Grid.Row="0"
FontSize="25"
x:Name="lbColor2"
Style="{StaticResource ColorLabelDark}"/>
<CheckBox IsChecked="True"
Grid.Column="2" Grid.Row="0"
x:Name="CBFr"
CheckedChanged="CBFr_CheckedChanged"/>
<Label HorizontalTextAlignment="Start"
Text="Mode Extreme" Grid.Column="0"
Grid.Row="2" FontSize="25"
x:Name="lbColor3"
Style="{StaticResource ColorLabelDark}"/>
<Switch IsToggled="True"
Grid.Column="1" Grid.Row="2" />
<Label Text="Thème sombre"
Grid.Column="0" Grid.Row="3"
FontSize="25"
x:Name="lbColor4"
Style="{StaticResource ColorLabelDark}"/>
<Switch IsToggled="True"
Grid.Column="1" Grid.Row="3"
Toggled="Switch_Toggled_Theme" x:Name="swTheme"/>
</Grid> </Grid>
</ContentPage> </ContentPage>

@ -22,6 +22,7 @@ namespace TheGameExtreme.view
} }
} }
private void CBFr_CheckedChanged(object sender, CheckedChangedEventArgs e) private void CBFr_CheckedChanged(object sender, CheckedChangedEventArgs e)
@ -30,17 +31,33 @@ namespace TheGameExtreme.view
{ {
CBBr.IsChecked = !CBBr.IsChecked; CBBr.IsChecked = !CBBr.IsChecked;
} }
}
private void WhiteTheme()
{
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 void Switch_Toggled_Theme(object sender, ToggledEventArgs e) private void Switch_Toggled_Theme(object sender, ToggledEventArgs e)
{ {
if(swTheme.IsToggled == false) if (swTheme.IsToggled == true)
{ {
pageContentSetting.Style = Application.Current.Resources["MyBackGroundColorStyle1"] 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;
} }
else else
{ {
pageContentSetting.Style = Application.Current.Resources["MyBackGroundColorStyle2"] as Style; WhiteTheme();
} }
} }
} }

Loading…
Cancel
Save