| 123456789101112131415161718192021222324252627282930313233343536373839 |
- using System;
- using System.Windows;
- namespace DeviceCenter
- {
- /// <summary>
- /// AskDate.xaml 的交互逻辑
- /// </summary>
- public partial class AskDate : Window
- {
- public DateTime start;
- public DateTime end;
- public AskDate()
- {
- InitializeComponent();
- DateTime now = DateTime.Now;
- DateTime start = new DateTime(now.Year, now.Month, now.Day, 0, 0, 0);
- DateTime end = new DateTime(now.Year, now.Month, now.Day, 23, 59, 59);
- tb_start.Text = start.ToString("yyyy-MM-dd HH:mm:ss");
- tb_end.Text = end.ToString("yyyy-MM-dd HH:mm:ss");
- }
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- start = DateTime.ParseExact(tb_start.Text, "yyyy-MM-dd HH:mm:ss", null);
- end = DateTime.ParseExact(tb_end.Text, "yyyy-MM-dd HH:mm:ss", null);
- DialogResult = true;
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message); DialogResult = false;
- }
- }
- }
- }
|