diff --git a/.gitignore b/.gitignore index ca7dbda..2fa3c75 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ packages/ .vs/ +/ScreenSleep/bin +/ScreenSleep/obj \ No newline at end of file diff --git a/ScreenSleep/Properties/AssemblyInfo.cs b/ScreenSleep/Properties/AssemblyInfo.cs index 00a24d0..a5cd7d5 100644 --- a/ScreenSleep/Properties/AssemblyInfo.cs +++ b/ScreenSleep/Properties/AssemblyInfo.cs @@ -12,7 +12,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ScreenSleep")] -[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyCopyright("Copyright © Adrian Lungu 2020")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -51,5 +51,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.0.0.2")] +[assembly: AssemblyFileVersion("1.0.0.2")] diff --git a/ScreenSleep/ScreenSleep.csproj b/ScreenSleep/ScreenSleep.csproj index b184c6d..f688f2c 100644 --- a/ScreenSleep/ScreenSleep.csproj +++ b/ScreenSleep/ScreenSleep.csproj @@ -14,6 +14,9 @@ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 true + false + + publish\ true Disk @@ -26,11 +29,8 @@ true 0 1.0.0.%2a - false false true - - AnyCPU diff --git a/ScreenSleep/Settings.xaml b/ScreenSleep/Settings.xaml index 85b5f2f..d477228 100644 --- a/ScreenSleep/Settings.xaml +++ b/ScreenSleep/Settings.xaml @@ -28,7 +28,7 @@ - + seconds diff --git a/ScreenSleep/Settings.xaml.cs b/ScreenSleep/Settings.xaml.cs index ca0085f..e1845ce 100644 --- a/ScreenSleep/Settings.xaml.cs +++ b/ScreenSleep/Settings.xaml.cs @@ -141,26 +141,24 @@ private void RunCheckbox_OnChecked(object sender, RoutedEventArgs e) SetupStartup(); } - private void TimerTextBox_PreviewKeyDown(object sender, KeyEventArgs e) + private void TimerTextBox_PreviewTextInput(object sender, TextCompositionEventArgs e) { - var timerText = TimerTextBox.Text; int timer; - var isNumeric = int.TryParse(timerText, out timer); + var isNumeric = int.TryParse(e.Text, out timer); - if (!isNumeric) { - Properties.Settings.Default.SleepTimer = 1; - } else { + if (!isNumeric) + { + Properties.Settings.Default.SleepTimer = 1; + } + else + { Properties.Settings.Default.SleepTimer = timer; } Properties.Settings.Default.Save(); - } - private void TimerTextBox_PreviewTextInput(object sender, TextCompositionEventArgs e) - { - var isNumeric = int.TryParse(e.Text, out _); - e.Handled = isNumeric; + e.Handled = !isNumeric; } } } diff --git a/ScreenSleep/obj/Debug/ScreenSleep.csproj.FileListAbsolute.txt b/ScreenSleep/obj/Debug/ScreenSleep.csproj.FileListAbsolute.txt deleted file mode 100644 index e69de29..0000000 diff --git a/ScreenSleep/obj/Debug/ScreenSleep_MarkupCompile.i.lref b/ScreenSleep/obj/Debug/ScreenSleep_MarkupCompile.i.lref deleted file mode 100644 index 6ad270b..0000000 --- a/ScreenSleep/obj/Debug/ScreenSleep_MarkupCompile.i.lref +++ /dev/null @@ -1,4 +0,0 @@ - - -FC:\Users\nokya\source\repos\ScreenSleep\ScreenSleep\MainWindow.xaml;; - diff --git a/ScreenSleep/obj/Debug/Settings.g.i.cs b/ScreenSleep/obj/Debug/Settings.g.i.cs deleted file mode 100644 index 7cdf8ad..0000000 --- a/ScreenSleep/obj/Debug/Settings.g.i.cs +++ /dev/null @@ -1,140 +0,0 @@ -#pragma checksum "..\..\Settings.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "A2EA36D819E44D6E3093FC65E2A5CDFBC5C2041E3ADC34D18D1719982F2CF451" -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -using System; -using System.Diagnostics; -using System.Windows; -using System.Windows.Automation; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Ink; -using System.Windows.Input; -using System.Windows.Markup; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Media.Effects; -using System.Windows.Media.Imaging; -using System.Windows.Media.Media3D; -using System.Windows.Media.TextFormatting; -using System.Windows.Navigation; -using System.Windows.Shapes; -using System.Windows.Shell; - - -namespace ScreenSleep { - - - /// - /// Settings - /// - public partial class Settings : System.Windows.Window, System.Windows.Markup.IComponentConnector { - - - #line 23 "..\..\Settings.xaml" - [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - internal System.Windows.Controls.TextBox ShortcutTextBox; - - #line default - #line hidden - - - #line 31 "..\..\Settings.xaml" - [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - internal System.Windows.Controls.TextBox TimerTextBox; - - #line default - #line hidden - - - #line 36 "..\..\Settings.xaml" - [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - internal System.Windows.Controls.CheckBox RunCheckbox; - - #line default - #line hidden - - private bool _contentLoaded; - - /// - /// InitializeComponent - /// - [System.Diagnostics.DebuggerNonUserCodeAttribute()] - [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")] - public void InitializeComponent() { - if (_contentLoaded) { - return; - } - _contentLoaded = true; - System.Uri resourceLocater = new System.Uri("/ScreenSleep;component/settings.xaml", System.UriKind.Relative); - - #line 1 "..\..\Settings.xaml" - System.Windows.Application.LoadComponent(this, resourceLocater); - - #line default - #line hidden - } - - [System.Diagnostics.DebuggerNonUserCodeAttribute()] - [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")] - [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { - switch (connectionId) - { - case 1: - this.ShortcutTextBox = ((System.Windows.Controls.TextBox)(target)); - - #line 23 "..\..\Settings.xaml" - this.ShortcutTextBox.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.ShortcutTextBox_PreviewKeyDown); - - #line default - #line hidden - return; - case 2: - this.TimerTextBox = ((System.Windows.Controls.TextBox)(target)); - - #line 31 "..\..\Settings.xaml" - this.TimerTextBox.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.TimerTextBox_PreviewKeyDown); - - #line default - #line hidden - - #line 31 "..\..\Settings.xaml" - this.TimerTextBox.PreviewTextInput += new System.Windows.Input.TextCompositionEventHandler(this.TimerTextBox_PreviewTextInput); - - #line default - #line hidden - return; - case 3: - this.RunCheckbox = ((System.Windows.Controls.CheckBox)(target)); - - #line 36 "..\..\Settings.xaml" - this.RunCheckbox.Unchecked += new System.Windows.RoutedEventHandler(this.RunCheckbox_OnChecked); - - #line default - #line hidden - - #line 36 "..\..\Settings.xaml" - this.RunCheckbox.Checked += new System.Windows.RoutedEventHandler(this.RunCheckbox_OnChecked); - - #line default - #line hidden - return; - } - this._contentLoaded = true; - } - } -} - diff --git a/ScreenSleep/obj/Release/ScreenSleep_MarkupCompile.i.lref b/ScreenSleep/obj/Release/ScreenSleep_MarkupCompile.i.lref deleted file mode 100644 index 44c1d02..0000000 --- a/ScreenSleep/obj/Release/ScreenSleep_MarkupCompile.i.lref +++ /dev/null @@ -1,4 +0,0 @@ - - -FD:\Programming Stuff\ScreenSleep\ScreenSleep\MainWindow.xaml;; - diff --git a/ScreenSleep/obj/Release/Settings.g.i.cs b/ScreenSleep/obj/Release/Settings.g.i.cs deleted file mode 100644 index 7cdf8ad..0000000 --- a/ScreenSleep/obj/Release/Settings.g.i.cs +++ /dev/null @@ -1,140 +0,0 @@ -#pragma checksum "..\..\Settings.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "A2EA36D819E44D6E3093FC65E2A5CDFBC5C2041E3ADC34D18D1719982F2CF451" -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -using System; -using System.Diagnostics; -using System.Windows; -using System.Windows.Automation; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Ink; -using System.Windows.Input; -using System.Windows.Markup; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Media.Effects; -using System.Windows.Media.Imaging; -using System.Windows.Media.Media3D; -using System.Windows.Media.TextFormatting; -using System.Windows.Navigation; -using System.Windows.Shapes; -using System.Windows.Shell; - - -namespace ScreenSleep { - - - /// - /// Settings - /// - public partial class Settings : System.Windows.Window, System.Windows.Markup.IComponentConnector { - - - #line 23 "..\..\Settings.xaml" - [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - internal System.Windows.Controls.TextBox ShortcutTextBox; - - #line default - #line hidden - - - #line 31 "..\..\Settings.xaml" - [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - internal System.Windows.Controls.TextBox TimerTextBox; - - #line default - #line hidden - - - #line 36 "..\..\Settings.xaml" - [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - internal System.Windows.Controls.CheckBox RunCheckbox; - - #line default - #line hidden - - private bool _contentLoaded; - - /// - /// InitializeComponent - /// - [System.Diagnostics.DebuggerNonUserCodeAttribute()] - [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")] - public void InitializeComponent() { - if (_contentLoaded) { - return; - } - _contentLoaded = true; - System.Uri resourceLocater = new System.Uri("/ScreenSleep;component/settings.xaml", System.UriKind.Relative); - - #line 1 "..\..\Settings.xaml" - System.Windows.Application.LoadComponent(this, resourceLocater); - - #line default - #line hidden - } - - [System.Diagnostics.DebuggerNonUserCodeAttribute()] - [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")] - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")] - [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { - switch (connectionId) - { - case 1: - this.ShortcutTextBox = ((System.Windows.Controls.TextBox)(target)); - - #line 23 "..\..\Settings.xaml" - this.ShortcutTextBox.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.ShortcutTextBox_PreviewKeyDown); - - #line default - #line hidden - return; - case 2: - this.TimerTextBox = ((System.Windows.Controls.TextBox)(target)); - - #line 31 "..\..\Settings.xaml" - this.TimerTextBox.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(this.TimerTextBox_PreviewKeyDown); - - #line default - #line hidden - - #line 31 "..\..\Settings.xaml" - this.TimerTextBox.PreviewTextInput += new System.Windows.Input.TextCompositionEventHandler(this.TimerTextBox_PreviewTextInput); - - #line default - #line hidden - return; - case 3: - this.RunCheckbox = ((System.Windows.Controls.CheckBox)(target)); - - #line 36 "..\..\Settings.xaml" - this.RunCheckbox.Unchecked += new System.Windows.RoutedEventHandler(this.RunCheckbox_OnChecked); - - #line default - #line hidden - - #line 36 "..\..\Settings.xaml" - this.RunCheckbox.Checked += new System.Windows.RoutedEventHandler(this.RunCheckbox_OnChecked); - - #line default - #line hidden - return; - } - this._contentLoaded = true; - } - } -} -