-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetLearningPlanWindow.xaml.cs
More file actions
64 lines (55 loc) · 2.09 KB
/
SetLearningPlanWindow.xaml.cs
File metadata and controls
64 lines (55 loc) · 2.09 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
using System;
using System.Windows;
namespace TimeTask
{
public partial class SetLearningPlanWindow : Window
{
public string Subject { get; private set; }
public string Goal { get; private set; }
public string Duration { get; private set; }
public DateTime? StartDate { get; private set; }
public SetLearningPlanWindow()
{
InitializeComponent();
StartDatePicker.SelectedDate = DateTime.Today;
}
private void SubmitButton_Click(object sender, RoutedEventArgs e)
{
if (string.IsNullOrWhiteSpace(SubjectTextBox.Text))
{
MessageBox.Show("请输入学习科目", "输入错误", MessageBoxButton.OK, MessageBoxImage.Warning);
SubjectTextBox.Focus();
return;
}
if (string.IsNullOrWhiteSpace(GoalTextBox.Text))
{
MessageBox.Show("请输入学习目标", "输入错误", MessageBoxButton.OK, MessageBoxImage.Warning);
GoalTextBox.Focus();
return;
}
if (string.IsNullOrWhiteSpace(DurationTextBox.Text))
{
MessageBox.Show("请输入学习时长", "输入错误", MessageBoxButton.OK, MessageBoxImage.Warning);
DurationTextBox.Focus();
return;
}
if (!StartDatePicker.SelectedDate.HasValue)
{
MessageBox.Show("请选择开始日期", "输入错误", MessageBoxButton.OK, MessageBoxImage.Warning);
StartDatePicker.Focus();
return;
}
this.Subject = SubjectTextBox.Text.Trim();
this.Goal = GoalTextBox.Text.Trim();
this.Duration = DurationTextBox.Text.Trim();
this.StartDate = StartDatePicker.SelectedDate.Value;
this.DialogResult = true;
this.Close();
}
private void CancelButton_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}
}
}