-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScreenBlock.cs
More file actions
46 lines (39 loc) · 1.19 KB
/
ScreenBlock.cs
File metadata and controls
46 lines (39 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System.Windows.Forms;
namespace DayTimer
{
public partial class ScreenBlock : Form
{
private ITime _time;
private int _lastValue;
public ScreenBlock(ITime time)
{
InitializeComponent();
Icon = Properties.Resources.Sleeping_2;
_time = time;
_lastValue = 5;
debug.DataBindings.Add("Text", this, "Debug");
}
private void timer_Tick(object sender, System.EventArgs e)
{
Text = _time.Time;
#if !DEBUG
Debug = Text;
#endif
}
private void numericUpDown_ValueChanged(object sender, System.EventArgs e)
{
var val = numericUpDown.Value;
numericUpDown.Increment = Increment(val, val < _lastValue);
_lastValue = (int)val;
}
private decimal Increment(decimal value, bool decrementing = false)
{
value += decrementing ? -1 : 0;
if (value < 10) return 1;
else if (value < 30) return 5;
return 10;
}
public int PauzeInterval { get { return (int)numericUpDown.Value; } }
public string Debug { get; set; }
}
}