Skip to content

Commit 394ffd1

Browse files
authored
Merge pull request #2 from taylorflatt/dev
Release 2.0.0.0
2 parents 2e60af2 + 5f12dc1 commit 394ffd1

File tree

12 files changed

+534
-241
lines changed

12 files changed

+534
-241
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.0.0
1+
2.0.0.0

WindowsShutdownTimer.exe

142 KB
Binary file not shown.

WindowsShutdownTimer/CustomExceptions.cs

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,35 +44,34 @@ public StartTimerException(string message, Exception inner, string code) : base(
4444
}
4545
}
4646

47+
4748
/// <summary>
48-
/// Trouble checking for a timer.
49+
/// Used to show that the timer has ended. This isn't a true exception. This seemed easier (to read/understand) than traditional logic to me.
4950
/// </summary>
5051
[Serializable]
51-
class CheckTimerException : Exception
52+
class TimerEnded : Exception
5253
{
53-
public string ErrorCode = "";
54-
55-
public CheckTimerException() { }
56-
57-
public CheckTimerException(string message, string code) : base(message)
58-
{
59-
this.ErrorCode = code;
60-
}
61-
62-
public CheckTimerException(string message, Exception inner, string code) : base(message, inner)
63-
{
64-
this.ErrorCode = code;
65-
}
54+
public TimerEnded() { }
55+
public TimerEnded(string message) : base(message) { }
6656
}
6757

6858
/// <summary>
69-
/// Used to show that the timer has ended. This isn't a true exception. This seemed easier (to read/understand) than traditional logic to me.
59+
/// Timer exists in the scheduler.
7060
/// </summary>
7161
[Serializable]
72-
class TimerEnded : Exception
62+
class TimerExists : Exception
7363
{
74-
public TimerEnded() { }
64+
public TimerExists() { }
65+
public TimerExists(string message) : base(message) { }
66+
}
7567

76-
public TimerEnded(string message) : base(message) { }
68+
/// <summary>
69+
/// Timer doesn't exist in the scheduler.
70+
/// </summary>
71+
[Serializable]
72+
class NoTimerExists : Exception
73+
{
74+
public NoTimerExists() { }
75+
public NoTimerExists(string message) : base(message) { }
7776
}
7877
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Weavers>
3+
<Costura>
4+
<IncludedAssemblies>
5+
Microsoft.Win32.TaskScheduler
6+
</IncludedAssemblies>
7+
</Costura>
8+
</Weavers>

WindowsShutdownTimer/Options.Designer.cs

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WindowsShutdownTimer/Options.cs

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,29 @@ public Options(TimerForm parent)
2424
// Setting this in the design menu doesn't work. Must be set here.
2525
this.CenterToParent();
2626

27-
last_shutdown_label_desc.Text = "Last Shutdown: ";
28-
29-
// Because the settings manager won't store a 0001 default DateTime year.
30-
DateTime defaultDate = new DateTime(0002, 1, 1, 0, 0, 0, 0);
31-
32-
// Check on the status of the previous shutdown. If it was ever set or cancelled.
33-
// Or if it is still in the future (pending). Or successful then display when.
34-
if (Properties.Settings.Default.ShutdownTimer == defaultDate)
35-
last_shutdown_label.Text = "N/A or Unsuccessful";
36-
else if(Properties.Settings.Default.ShutdownTimer > DateTime.UtcNow.ToLocalTime())
37-
last_shutdown_label.Text = "Pending " + "(" + Convert.ToString(Properties.Settings.Default.ShutdownTimer.ToLocalTime()) + ")";
27+
last_shutdown_label_desc.Text = "Last Attempted Shutdown: ";
28+
29+
if(timerWindow.TimerExists(TimerForm.DEFAULT_TASK_NAME))
30+
{
31+
if(timerWindow.TimerRunning(TimerForm.DEFAULT_TASK_NAME, DateTime.Now))
32+
last_shutdown_label.Text = "Pending " + "(" + Convert.ToString(Properties.Settings.Default.ShutdownTimer) + ")";
33+
else
34+
{
35+
// If the timer was never run, display the time accordingly.
36+
if (timerWindow.GetLastRunTime(TimerForm.DEFAULT_TASK_NAME) == timerWindow.SetDefaultDateTime(new DateTime()))
37+
last_shutdown_label.Text = "N/A";
38+
else
39+
{
40+
// Windows 7 doesn't have the last run time so I need to do something else.
41+
if (timerWindow.GetLastRunTime(TimerForm.DEFAULT_TASK_NAME) == default(DateTime))
42+
last_shutdown_label.Text = Convert.ToString(Properties.Settings.Default.ShutdownTimer);
43+
else
44+
last_shutdown_label.Text = Convert.ToString(timerWindow.GetLastRunTime(TimerForm.DEFAULT_TASK_NAME));
45+
}
46+
}
47+
}
3848
else
39-
last_shutdown_label.Text = Convert.ToString(Properties.Settings.Default.ShutdownTimer.ToLocalTime());
49+
last_shutdown_label.Text = "N/A";
4050
}
4151

4252
/// <summary>
@@ -77,7 +87,7 @@ public void save_options_button_Click(object sender, EventArgs e)
7787
Properties.Settings.Default.LClickOpenSysTray = false;
7888

7989
Properties.Settings.Default.Save();
80-
timerWindow.ApplyUserSettings();
90+
//timerWindow.ApplyUserSettings();
8191

8292
// Close the options form and redisplay the parent.
8393
ActiveForm.Close();

WindowsShutdownTimer/Properties/AssemblyInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
[assembly: AssemblyConfiguration("")]
1111
[assembly: AssemblyCompany("")]
1212
[assembly: AssemblyProduct("WindowsShutdownTimer")]
13-
[assembly: AssemblyCopyright("Copyright © 2016")]
13+
[assembly: AssemblyCopyright("Copyright Taylor Flatt © 2016")]
1414
[assembly: AssemblyTrademark("")]
1515
[assembly: AssemblyCulture("")]
1616

@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.4.0.0")]
36-
[assembly: AssemblyFileVersion("1.4.0.0")]
35+
[assembly: AssemblyVersion("2.0.0.0")]
36+
[assembly: AssemblyFileVersion("2.0.0.0")]

WindowsShutdownTimer/Timer.Designer.cs

Lines changed: 14 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)