Skip to content

Commit 20834df

Browse files
committed
Fixed sleep timer and cleaned up code
1 parent 21545d0 commit 20834df

File tree

10 files changed

+18
-306
lines changed

10 files changed

+18
-306
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
packages/
22
.vs/
3+
/ScreenSleep/bin
4+
/ScreenSleep/obj

ScreenSleep/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
[assembly: AssemblyConfiguration("")]
1313
[assembly: AssemblyCompany("")]
1414
[assembly: AssemblyProduct("ScreenSleep")]
15-
[assembly: AssemblyCopyright("Copyright © 2019")]
15+
[assembly: AssemblyCopyright("Copyright © Adrian Lungu 2020")]
1616
[assembly: AssemblyTrademark("")]
1717
[assembly: AssemblyCulture("")]
1818

@@ -51,5 +51,5 @@
5151
// You can specify all the values or you can default the Build and Revision Numbers
5252
// by using the '*' as shown below:
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("1.0.0.0")]
55-
[assembly: AssemblyFileVersion("1.0.0.0")]
54+
[assembly: AssemblyVersion("1.0.0.2")]
55+
[assembly: AssemblyFileVersion("1.0.0.2")]

ScreenSleep/ScreenSleep.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
1515
<WarningLevel>4</WarningLevel>
1616
<Deterministic>true</Deterministic>
17+
<IsWebBootstrapper>false</IsWebBootstrapper>
18+
<NuGetPackageImportStamp>
19+
</NuGetPackageImportStamp>
1720
<PublishUrl>publish\</PublishUrl>
1821
<Install>true</Install>
1922
<InstallFrom>Disk</InstallFrom>
@@ -26,11 +29,8 @@
2629
<MapFileExtensions>true</MapFileExtensions>
2730
<ApplicationRevision>0</ApplicationRevision>
2831
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
29-
<IsWebBootstrapper>false</IsWebBootstrapper>
3032
<UseApplicationTrust>false</UseApplicationTrust>
3133
<BootstrapperEnabled>true</BootstrapperEnabled>
32-
<NuGetPackageImportStamp>
33-
</NuGetPackageImportStamp>
3434
</PropertyGroup>
3535
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
3636
<PlatformTarget>AnyCPU</PlatformTarget>

ScreenSleep/Settings.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<ColumnDefinition Width="*"></ColumnDefinition>
2929
<ColumnDefinition Width="50"></ColumnDefinition>
3030
</Grid.ColumnDefinitions>
31-
<TextBox DockPanel.Dock="Left" Name="TimerTextBox" PreviewKeyDown="TimerTextBox_PreviewKeyDown" Height="26" Margin="0,0,10,0" PreviewTextInput="TimerTextBox_PreviewTextInput"></TextBox>
31+
<TextBox DockPanel.Dock="Left" Name="TimerTextBox" Height="26" Margin="0,0,10,0" PreviewTextInput="TimerTextBox_PreviewTextInput"></TextBox>
3232
<TextBlock Grid.Column="1" DockPanel.Dock="Right" TextAlignment="Left" Margin="0,4,0,0">seconds</TextBlock>
3333
</Grid>
3434

ScreenSleep/Settings.xaml.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -141,26 +141,24 @@ private void RunCheckbox_OnChecked(object sender, RoutedEventArgs e)
141141
SetupStartup();
142142
}
143143

144-
private void TimerTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
144+
private void TimerTextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
145145
{
146-
var timerText = TimerTextBox.Text;
147146
int timer;
148147

149-
var isNumeric = int.TryParse(timerText, out timer);
148+
var isNumeric = int.TryParse(e.Text, out timer);
150149

151-
if (!isNumeric) {
152-
Properties.Settings.Default.SleepTimer = 1;
153-
} else {
150+
if (!isNumeric)
151+
{
152+
Properties.Settings.Default.SleepTimer = 1;
153+
}
154+
else
155+
{
154156
Properties.Settings.Default.SleepTimer = timer;
155157
}
156158

157159
Properties.Settings.Default.Save();
158-
}
159160

160-
private void TimerTextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
161-
{
162-
var isNumeric = int.TryParse(e.Text, out _);
163-
e.Handled = isNumeric;
161+
e.Handled = !isNumeric;
164162
}
165163
}
166164
}

ScreenSleep/obj/Debug/ScreenSleep.csproj.FileListAbsolute.txt

Whitespace-only changes.

ScreenSleep/obj/Debug/ScreenSleep_MarkupCompile.i.lref

Lines changed: 0 additions & 4 deletions
This file was deleted.

ScreenSleep/obj/Debug/Settings.g.i.cs

Lines changed: 0 additions & 140 deletions
This file was deleted.

ScreenSleep/obj/Release/ScreenSleep_MarkupCompile.i.lref

Lines changed: 0 additions & 4 deletions
This file was deleted.

ScreenSleep/obj/Release/Settings.g.i.cs

Lines changed: 0 additions & 140 deletions
This file was deleted.

0 commit comments

Comments
 (0)