Skip to content

Commit 22d71cf

Browse files
author
Peter
committed
Initial version
1 parent 00d6e77 commit 22d71cf

File tree

12 files changed

+1973
-0
lines changed

12 files changed

+1973
-0
lines changed

PauseMe.sln

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2013
4+
VisualStudioVersion = 12.0.31101.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PauseMe", "PauseMe\PauseMe.csproj", "{354113A4-0A3E-4875-974E-758A02EF22F8}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{354113A4-0A3E-4875-974E-758A02EF22F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{354113A4-0A3E-4875-974E-758A02EF22F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{354113A4-0A3E-4875-974E-758A02EF22F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{354113A4-0A3E-4875-974E-758A02EF22F8}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal

PauseMe/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<startup>
4+
5+
<supportedRuntime version="v2.0.50727"/></startup>
6+
</configuration>

PauseMe/MainForm.Designer.cs

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

PauseMe/MainForm.cs

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Data;
5+
using System.Drawing;
6+
using System.Text;
7+
using System.Windows.Forms;
8+
9+
namespace PauseMe
10+
{
11+
public partial class MainForm : Form
12+
{
13+
private int _CountDownTimer = 0;
14+
15+
private DateTime _TimerStarted;
16+
17+
public MainForm()
18+
{
19+
InitializeComponent();
20+
21+
this.TopMost = true;
22+
this.ShowInTaskbar = false;
23+
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
24+
this.Opacity = 0.5;
25+
this.WindowState = FormWindowState.Maximized;
26+
27+
lblCountdown.Text = "";
28+
tbxStatus.Text = "Stopped";
29+
}
30+
31+
private void tmrCountdown_Tick(object sender, EventArgs e)
32+
{
33+
lblCountdown.Text = "Pause time: " + (20 - _CountDownTimer++) + "s";
34+
35+
if (_CountDownTimer == 21)
36+
{
37+
_CountDownTimer = 0;
38+
tmrCountdown.Stop();
39+
this.Hide();
40+
}
41+
42+
}
43+
44+
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
45+
{
46+
this.Close();
47+
}
48+
49+
private void startToolStripMenuItem_Click(object sender, EventArgs e)
50+
{
51+
tmrMain.Start();
52+
_TimerStarted = DateTime.Now;
53+
tmrUpdateStatus.Start();
54+
55+
tbxStatus.Text = "Running";
56+
}
57+
58+
private void pauseToolStripMenuItem_Click(object sender, EventArgs e)
59+
{
60+
tmrMain.Stop();
61+
tmrUpdateStatus.Stop();
62+
tbxStatus.Text = "Stopped";
63+
niMain.Text = "Pause Me - Stopped";
64+
}
65+
66+
private void lblCountdown_Click(object sender, EventArgs e)
67+
{
68+
}
69+
70+
private void MainForm_Load(object sender, EventArgs e)
71+
{
72+
BeginInvoke(new MethodInvoker(delegate
73+
{
74+
Hide();
75+
startToolStripMenuItem_Click(this, null);
76+
niMain.ShowBalloonTip(5000, "Pause Me Started", "Pause Me has been started an will gently remind you every 20 minutes to rest your eyes!", ToolTipIcon.Info);
77+
}));
78+
}
79+
80+
private void tmrMain_Tick(object sender, EventArgs e)
81+
{
82+
lblCountdown.Text = "Pause time: " + (20 - _CountDownTimer++) + "s";
83+
this.Show();
84+
_TimerStarted = DateTime.Now;
85+
tmrCountdown.Start();
86+
}
87+
88+
private void lblCountdown_DoubleClick(object sender, EventArgs e)
89+
{
90+
this.Hide();
91+
}
92+
93+
private void tmrUpdateStatus_Tick(object sender, EventArgs e)
94+
{
95+
var timePassed = (DateTime.Now - (_TimerStarted.AddMinutes(20))).Negate();
96+
var minutesPassed = timePassed.Minutes.ToString("00");
97+
var secondsPassed = timePassed.Seconds.ToString("00");
98+
99+
tbxStatus.Text = "Running (" + minutesPassed + ":" + secondsPassed + ")";
100+
niMain.Text = "Pause Me - Running (" + minutesPassed + ":" + secondsPassed + ")";
101+
}
102+
}
103+
}

0 commit comments

Comments
 (0)