From 8d2336f8f2abdf5a2334055dae5d2db05a2fec65 Mon Sep 17 00:00:00 2001 From: Michal Mizera Date: Tue, 20 Dec 2016 00:25:38 +0100 Subject: [PATCH] Added options window --- MFIGamepadFeeder/App.config | 6 + MFIGamepadFeeder/MFIGamepadFeeder.csproj | 16 ++- MFIGamepadFeeder/MainWindow.xaml | 18 ++- MFIGamepadFeeder/MainWindow.xaml.cs | 108 ++++++++++++++---- MFIGamepadFeeder/OptionsWindow.xaml | 25 ++++ MFIGamepadFeeder/OptionsWindow.xaml.cs | 52 +++++++++ .../Properties/Settings.Designer.cs | 24 ++++ MFIGamepadFeeder/Properties/Settings.settings | 6 + 8 files changed, 225 insertions(+), 30 deletions(-) create mode 100644 MFIGamepadFeeder/OptionsWindow.xaml create mode 100644 MFIGamepadFeeder/OptionsWindow.xaml.cs diff --git a/MFIGamepadFeeder/App.config b/MFIGamepadFeeder/App.config index 8a48343..4f8adab 100644 --- a/MFIGamepadFeeder/App.config +++ b/MFIGamepadFeeder/App.config @@ -58,6 +58,12 @@ False + + False + + + False + diff --git a/MFIGamepadFeeder/MFIGamepadFeeder.csproj b/MFIGamepadFeeder/MFIGamepadFeeder.csproj index 0283347..ce5d125 100644 --- a/MFIGamepadFeeder/MFIGamepadFeeder.csproj +++ b/MFIGamepadFeeder/MFIGamepadFeeder.csproj @@ -15,7 +15,8 @@ 4 true false - D:\Users\axadiw\Desktop\MFIGamepad\ + 11e577087eab47da8e602d846426c923 + C:\Repos\MFIGamepadRelease\ true Disk false @@ -25,13 +26,11 @@ false false true - true - 2 + 3 1.0.0.%2a false true true - 11e577087eab47da8e602d846426c923 icon.ico @@ -43,7 +42,7 @@ MFIGamepadFeeder_1_TemporaryKey.pfx - false + true false @@ -225,9 +224,16 @@ MainWindow.xaml Code + + Designer + MSBuild:Compile + + + OptionsWindow.xaml + Code diff --git a/MFIGamepadFeeder/MainWindow.xaml b/MFIGamepadFeeder/MainWindow.xaml index aa5f9e3..a6728f5 100644 --- a/MFIGamepadFeeder/MainWindow.xaml +++ b/MFIGamepadFeeder/MainWindow.xaml @@ -7,7 +7,8 @@ mc:Ignorable="d" Title="MFI Gamepad Feeder" Width="800" Height="350" ResizeMode="CanResizeWithGrip" Icon="icon.ico" Closing="Window_Closing" WindowStartupLocation="CenterScreen" - StateChanged="Window_StateChanged" MinWidth="500" MinHeight="250"> + StateChanged="Window_StateChanged" MinWidth="500" MinHeight="250" + > - + + + diff --git a/MFIGamepadFeeder/OptionsWindow.xaml.cs b/MFIGamepadFeeder/OptionsWindow.xaml.cs new file mode 100644 index 0000000..e5771e4 --- /dev/null +++ b/MFIGamepadFeeder/OptionsWindow.xaml.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; +using MFIGamepadFeeder.Properties; + +namespace MFIGamepadFeeder +{ + /// + /// Interaction logic for OptionsWindow.xaml + /// + public partial class OptionsWindow : Window + { + public OptionsWindow() + { + InitializeComponent(); + } + + private void Grid_Loaded(object sender, RoutedEventArgs e) + { + AutoPlugInCheckBox.IsChecked = Settings.Default.AutoPlugIn; + StartMinimizedCheckBox.IsChecked = Settings.Default.StartMinimized; + } + + private void SaveButton_Click(object sender, RoutedEventArgs e) + { + if (AutoPlugInCheckBox.IsChecked != null) Settings.Default.AutoPlugIn = AutoPlugInCheckBox.IsChecked.Value; + if (StartMinimizedCheckBox.IsChecked != null) Settings.Default.StartMinimized = StartMinimizedCheckBox.IsChecked.Value; + Settings.Default.Save(); + Close(); + } + + private void StartMinimized_MouseDown(object sender, MouseButtonEventArgs e) + { + StartMinimizedCheckBox.IsChecked = !StartMinimizedCheckBox.IsChecked; + } + + private void AutoPlugIn_MouseDown(object sender, MouseButtonEventArgs e) + { + AutoPlugInCheckBox.IsChecked = !AutoPlugInCheckBox.IsChecked; + } + } +} diff --git a/MFIGamepadFeeder/Properties/Settings.Designer.cs b/MFIGamepadFeeder/Properties/Settings.Designer.cs index a2931bb..9b153be 100644 --- a/MFIGamepadFeeder/Properties/Settings.Designer.cs +++ b/MFIGamepadFeeder/Properties/Settings.Designer.cs @@ -214,5 +214,29 @@ public bool ControllerActive4 { this["ControllerActive4"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool StartMinimized { + get { + return ((bool)(this["StartMinimized"])); + } + set { + this["StartMinimized"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool AutoPlugIn { + get { + return ((bool)(this["AutoPlugIn"])); + } + set { + this["AutoPlugIn"] = value; + } + } } } diff --git a/MFIGamepadFeeder/Properties/Settings.settings b/MFIGamepadFeeder/Properties/Settings.settings index bcc152b..cbeb5c8 100644 --- a/MFIGamepadFeeder/Properties/Settings.settings +++ b/MFIGamepadFeeder/Properties/Settings.settings @@ -50,5 +50,11 @@ False + + False + + + False + \ No newline at end of file