-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathTask.cs
More file actions
112 lines (101 loc) · 1.95 KB
/
Task.cs
File metadata and controls
112 lines (101 loc) · 1.95 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
using System;
using System.Collections.Generic;
using System.Text;
namespace CCTime
{
public enum TaskType
{
Normal,
Total,
Unaccounted
}
class Task
{
public Task( string title, int minutes = 0, TaskType type = TaskType.Normal)
{
this.Title = title;
this.Minutes = minutes;
this.Type = type;
this.IsDirty = false;
this.AutoTick = false;
}
public TaskType Type { get; set; }
public bool IsDirty { get; set; }
public bool AutoTick { get; set; }
private string _title;
public string Title
{
get
{
return this._title;
}
set
{
this._title = value;
this.IsDirty = true;
}
}
private int _minutes;
public int Minutes
{
get
{
return this._minutes;
}
set
{
this._minutes = value;
if( this.Type == TaskType.Normal || this.Type == TaskType.Total )
{
this._minutes = Math.Max( 0, this._minutes ); // don't allow negative values, except for unaccounted field
}
this.IsDirty = true;
}
}
// Properties corresponding to buttons in ObjectListView
public string Plus15
{
get {
if( this.Type == TaskType.Total )
{
if ( Settings.ClockButtonsGoToNearest )
{
return "< " + Settings.MinutesOnClockButtons;
}
return "-" + Settings.MinutesOnTaskButton1;
}
if( this.Type == TaskType.Normal )
return "+" + Settings.MinutesOnTaskButton1;
else
return "";
}
}
public string Plus30
{
get
{
if( this.Type == TaskType.Normal )
return "+" + Settings.MinutesOnTaskButton2;
else
return "";
}
}
public string Plus60
{
get {
if( this.Type == TaskType.Total )
{
if( Settings.ClockButtonsGoToNearest )
{
return Settings.MinutesOnClockButtons + " >";
}
return "+" + +Settings.MinutesOnClockButtons;
}
if( this.Type == TaskType.Normal )
return "+" + Settings.MinutesOnTaskButton3;
else
return "";
}
}
}
}