Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit 13403e9

Browse files
committed
Program will now close after 60 seconds in certain conditions
1 parent cf44066 commit 13403e9

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

AssignmentReminder/AssignmentList.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ public AssignmentList()
9595
sort.SortColumn = 1; // Sorts the due date column to show nearest due dates at the top
9696
sort.Order = SortOrder.Ascending;
9797
listView.Sort();
98+
99+
AssignmentReminder.closetimer.Stop();
98100
}
99101

100102
private void RegisterEvents()

AssignmentReminder/AssignmentManager.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public AssignmentManager()
1414
InitializeComponent();
1515
TimeChooser.CustomFormat = "hh:mm:ss tt";
1616
TimeChooser.Format = DateTimePickerFormat.Custom;
17+
AssignmentReminder.closetimer.Stop();
1718
}
1819

1920
private void AddButton_Click( object sender, EventArgs e )

AssignmentReminder/AssignmentReminder.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
using System.Xml.Linq;
66
using System.Linq;
77
using System.IO;
8+
using System.Timers;
89

910
namespace AssignmentReminder
1011
{
1112
static class AssignmentReminder
1213
{
1314
private static NotifyIcon notify;
15+
public static System.Timers.Timer closetimer = new System.Timers.Timer( 60000 );
1416

1517
[STAThread]
1618
static void Main()
@@ -27,10 +29,18 @@ static void Main()
2729
};
2830
DueNotify( notify );
2931

32+
closetimer.Elapsed += TimerEnd;
33+
closetimer.Start();
34+
3035
Application.ApplicationExit += delegate { notify.Dispose(); };
3136
Application.Run();
3237
}
3338

39+
private static void TimerEnd( object obj, ElapsedEventArgs e )
40+
{
41+
Application.Exit();
42+
}
43+
3444
private static ContextMenu GetContextMenu()
3545
{
3646
string path = AppDomain.CurrentDomain.BaseDirectory.ToString();
@@ -96,6 +106,7 @@ private static void DueNotify( NotifyIcon notify )
96106
notify.ShowBalloonTip( 1, "No Assignments Due", "You have no assignments due today.", ToolTipIcon.Info );
97107
}
98108
notify.BalloonTipClicked += BalloonTipClicked;
109+
closetimer.Stop();
99110
}
100111

101112
private static void BalloonTipClicked( object sender, EventArgs e )

AssignmentReminder/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion( "1.5" )]
35-
[assembly: AssemblyFileVersion( "1.5" )]
34+
[assembly: AssemblyVersion( "1.6" )]
35+
[assembly: AssemblyFileVersion( "1.6" )]

0 commit comments

Comments
 (0)