20230724_MBJC_upperpc/Views/AnchorPointView.xaml.cs
2024-02-27 17:21:02 +08:00

57 lines
2.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace _20230724_MBJC_upperpc.Views
{
/// <summary>
/// AnchorPointView.xaml 的交互逻辑
/// </summary>
public partial class AnchorPointView : UserControl
{
public AnchorPointView()
{
InitializeComponent();
}
private void DataPicker1_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
{
//如果结束时间没有选
if (DataPicker2.SelectedDate == null)
return;
if (DataPicker1.SelectedDate > DataPicker2.SelectedDate)
{
MessageBox.Show("所选日期不能在起始日期之后!");
DataPicker1.SelectedDate = null;
}
//通过日期查询历史数据
MainWindow.viewModel.SearchHisData((DateTime)DataPicker1.SelectedDate, ((DateTime)DataPicker2.SelectedDate).AddHours(23).AddMinutes(59).AddSeconds(59), int.Parse(ID.Text));
}
private void DatePicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
{
//如果起始时间没有选
if (DataPicker1.SelectedDate == null)
return;
//如果起始时间大于结束时间
if (DataPicker1.SelectedDate > DataPicker2.SelectedDate)
{
MessageBox.Show("所选日期不能在起始日期之前!");
DataPicker2.SelectedDate = null;
}
//通过日期查询历史数据
MainWindow.viewModel.SearchHisData((DateTime)DataPicker1.SelectedDate, ((DateTime)DataPicker2.SelectedDate).AddHours(23).AddMinutes(59).AddSeconds(59), int.Parse(ID.Text));
}
}
}