Working on the new settings page.

This commit is contained in:
Brian Lima 2016-10-03 16:08:01 -03:00
parent 04a7bb360a
commit 2aaea481f7
11 changed files with 138 additions and 25 deletions

View File

@ -1,6 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="UWPHook.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<userSettings>
<UWPHook.Properties.Settings>
<setting name="ChangeLanguage" serializeAs="String">
<value>False</value>
</setting>
<setting name="TargetLanguage" serializeAs="String">
<value />
</setting>
</UWPHook.Properties.Settings>
</userSettings>
</configuration>

View File

@ -9,7 +9,7 @@
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Blue.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.deeppurple.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>

View File

@ -11,7 +11,7 @@
TextElement.FontSize="14"
FontFamily="Segoe UI Light"
mc:Ignorable="d"
Title="GamesWindow" Height="600" Width="800" Icon="Resources/hook_icon.ico">
Title="GamesWindow" Height="600" Width="800">
<Grid x:Name="grid">
<Grid.RowDefinitions>
<RowDefinition Height="28*"/>

View File

@ -1,5 +1,6 @@
using SharpSteam;
using System;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading;
@ -22,8 +23,19 @@ public GamesWindow()
Apps = new AppEntryModel();
listGames.ItemsSource = Apps.Entries;
if (Properties.Settings.Default.ChangeLanguage)
{
this.Title = "true ";
}
else
{
this.Title = "false ";
}
this.Title += Properties.Settings.Default.TargetLanguage;
//If null or 1, the app was launched normally
if (Environment.GetCommandLineArgs() != null)
if (Environment.GetCommandLineArgs() == null)
{
//When length is 1, the only argument is the path where the app is installed
if (Environment.GetCommandLineArgs().Length > 1)
@ -115,6 +127,8 @@ private void LoadButton_Click(object sender, RoutedEventArgs e)
private void HelpButton_Click(object sender, RoutedEventArgs e)
{
SettingsWindow window = new SettingsWindow();
window.ShowDialog();
}
}
}

View File

@ -8,23 +8,43 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace UWPHook.Properties
{
namespace UWPHook.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool ChangeLanguage {
get {
return ((bool)(this["ChangeLanguage"]));
}
set {
this["ChangeLanguage"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string TargetLanguage {
get {
return ((string)(this["TargetLanguage"]));
}
set {
this["TargetLanguage"] = value;
}
}
}
}

View File

@ -1,7 +1,12 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="UWPHook.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="ChangeLanguage" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="TargetLanguage" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -6,7 +6,7 @@
// The PropertyChanged event is raised after a setting's value is changed.
// The SettingsLoaded event is raised after the setting values are loaded.
// The SettingsSaving event is raised before the setting values are saved.
internal sealed partial class Settings {
public sealed partial class Settings {
public Settings() {
// // To add event handlers for saving and changing settings, uncomment the lines below:

View File

@ -23,7 +23,42 @@
</Grid.RowDefinitions>
<materialDesign:ColorZone Padding="16" materialDesign:ShadowAssist.ShadowDepth="Depth2" Mode="PrimaryMid" VerticalAlignment="Top" Height="80" Grid.ColumnSpan="2"/>
<Image x:Name="image" HorizontalAlignment="Left" Width="178" Height="80" VerticalAlignment="Top" Source="Resources/WhiteTransparent.png" Stretch="UniformToFill" ToolTip="Welcome to UWPHook, add your UWP apps and games to Steam!"/>
<Grid Margin="10" Grid.Row="1"/>
<Grid Grid.Column="1" Margin="10" Grid.Row="1"/>
<Grid Margin="10" Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="4*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="52*"/>
<ColumnDefinition Width="301*"/>
<ColumnDefinition Width="113*"/>
</Grid.ColumnDefinitions>
<GroupBox x:Name="groupBox" Header="Settings" Grid.ColumnSpan="3" Grid.RowSpan="2"/>
<ToggleButton x:Name="language_toggle" Style="{StaticResource MaterialDesignSwitchToggleButton}" VerticalAlignment="Top" Margin="4,56,0,0" ToolTip="MaterialDesignSwitchToggleButton" IsChecked="False" Checked="ToggleButton_Checked" Height="18" HorizontalAlignment="Left" Width="46" />
<Label ToolTip="Some apps use the system language to choose what language to display, this setting will store your current language, change it so you can play in another language and then revert your system back to your default display language." x:Name="label1" Content="Set system language when launching an app*" Margin="5,48,0,0" VerticalAlignment="Top" Height="29" Grid.Column="1"/>
<ComboBox ToolTip="Some apps use the system language to choose what language to display, this setting will store your current language, change it so you can play in another language and then revert your system back to your default display language." x:Name="cultures_comboBox" Margin="0,48,10,0" VerticalAlignment="Top" Height="31" Grid.Column="2" HorizontalAlignment="Right" Width="93"/>
<Button x:Name="save_button" Content="Save" HorizontalAlignment="Right" Margin="0,15,10,0" VerticalAlignment="Top" Width="93" Click="saveButton_Click" Grid.Column="2" Grid.Row="1"/>
</Grid>
<GroupBox Header="About" Grid.Column="1" Margin="10" Grid.Row="1" materialDesign:ColorZoneAssist.Mode="Accent">
<Grid Margin="0,0,0,2" Width="270">
<Button Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}"
Margin="0,0,116,10" HorizontalAlignment="Right"
ToolTip="My Twitter" Height="40" VerticalAlignment="Bottom">
<materialDesign:PackIcon Kind="Twitter" Height="24" Width="24" />
</Button>
<Button Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}"
Margin="0,0,0,10" HorizontalAlignment="Right"
ToolTip="Donate on Paypal" Height="40" VerticalAlignment="Bottom">
<materialDesign:PackIcon Kind="Cash" Height="24" Width="24" />
</Button>
<Button Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}"
Margin="0,0,0,10"
ToolTip="My GitHub" Width="40" Height="40" VerticalAlignment="Bottom" HorizontalAlignment="Left">
<materialDesign:PackIcon Kind="GithubCircle" Height="24" Width="24" />
</Button>
<TextBlock TextWrapping="WrapWithOverflow" x:Name="textBlock" Margin="0,166,0,0" VerticalAlignment="Top" Height="120" Text="Developed by Brian Lima, @brianostorm, if you like my work cheer me up at my Twitter or pay me a coffee via Paypal, this way i can keep building amazing open-source tools for you!" HorizontalAlignment="Left" Width="270"/>
</Grid>
</GroupBox>
<Image x:Name="image1" Source="Resources/briano.jpg" Margin="82,57,0,283" HorizontalAlignment="Left" Width="152" Grid.Column="1" Grid.Row="1"/>
</Grid>
</Window>

View File

@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
@ -22,6 +24,25 @@ public partial class SettingsWindow : Window
public SettingsWindow()
{
InitializeComponent();
Properties.Settings.Default.ChangeLanguage = true;
foreach (var culture in CultureInfo.GetCultures(CultureTypes.AllCultures))
{
cultures_comboBox.Items.Add(culture.TextInfo.CultureName);
}
}
private void ToggleButton_Checked(object sender, RoutedEventArgs e)
{
}
private void saveButton_Click(object sender, RoutedEventArgs e)
{
Properties.Settings.Default.ChangeLanguage = (bool)language_toggle.IsChecked;
Properties.Settings.Default.TargetLanguage = cultures_comboBox.SelectedItem.ToString();
Properties.Settings.Default.Save();
}
}
}

View File

@ -134,7 +134,7 @@
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<Generator>PublicSettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
@ -185,6 +185,9 @@
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\briano.jpg" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.