Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLogWorkForm.cs
More file actions
Latest commit
84 lines (73 loc) · 2.52 KB
/
Copy pathLogWorkForm.cs
File metadata and controls
84 lines (73 loc) · 2.52 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
usingSystem;
usingSystem.Globalization;
usingEto.Drawing;
usingEto.Forms;
namespacedevtime
{
publicclassLogWorkForm:Dialog<bool>
{
publicstringLog{get;privateset;}="";
privatereadonlyTextArea_textArea;
publicLogWorkForm(stringinitialLog,stringwhen)
{
Title="Log work";
Icon=IconLoader.LoadIcon("log.png");
MinimumSize=newSize(268,190);
Resizable=true;
_textArea=newTextArea{Text=initialLog,AcceptsTab=true,AcceptsReturn=true,Width=232,Height=115};
stringsuffix;
if(DateTime.TryParseExact(when,"yyyy-MM-dd",CultureInfo.InvariantCulture,DateTimeStyles.None,outDateTimedate))
{
if(date==DateTime.Today)
{
suffix="today";
}
elseif(date==DateTime.Today.AddDays(-1))
{
suffix="yesterday";
}
elseif(date==DateTime.Today.AddDays(1))
{
suffix="tomorrow";
}
else
{
suffix="on "+when;
}
}
else
{
suffix="on "+when;
}
vargroup=newGroupBox{Text=$"What did you do {suffix}?"};
group.Content=_textArea;
varokButton=newButton{Text="OK"};
okButton.Click+=(sender,e)=>OkClick();
varcancelButton=newButton{Text="Cancel"};
cancelButton.Click+=(sender,e)=>Close(false);
DefaultButton=okButton;
AbortButton=cancelButton;
varbuttonLayout=newStackLayout
{
Orientation=Orientation.Horizontal,
Spacing=5,
Items={okButton,cancelButton}
};
Content=newTableLayout
{
Padding=newPadding(5),
Spacing=newSize(3,3),
Rows=
{
newTableRow(newTableCell(group,true)){ScaleHeight=true},
newTableRow(newStackLayout{HorizontalContentAlignment=HorizontalAlignment.Right,Items={buttonLayout}})
}
};
}
privatevoidOkClick()
{
Log=_textArea.Text??"";
Close(true);
}
}
}