1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- 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.Shapes;
- namespace AGV_WPF.ExtraUI
- {
- /// <summary>
- /// ReadCheckRecordWindow.xaml 的交互逻辑
- /// </summary>
- public partial class ReadCheckRecordWindow : Window
- {
- public ReadCheckRecordWindow()
- {
- InitializeComponent();
- dataGrid1.LoadingRow += new EventHandler<DataGridRowEventArgs>(dataGrid1_LoadingRow);
- this.DataContext = new ReadCheckRecordWindowModel(this);
- }
- void dataGrid1_LoadingRow(object sender, DataGridRowEventArgs e)
- {
- e.Row.Header = e.Row.GetIndex() + 1;
- }
- public event RoutedEventHandler DateChanged;
- public void OnDateChanged(object sender, RoutedEventArgs e)
- {
- if (DateChanged != null)
- {
- DateChanged(sender, e);
- }
- }
- private void calendar1_SelectedDatesChanged(object sender, SelectionChangedEventArgs e)
- {
- OnDateChanged(this, null);
- }
- private void comboBoxCarID_DropDownClosed(object sender, EventArgs e)
- {
- if (calendar1.SelectedDate != null)
- {
- if (this.DataContext != null)
- {
- ReadCheckRecordWindowModel model = this.DataContext as ReadCheckRecordWindowModel;
- model.LoadExcelData(calendar1.SelectedDate.Value.ToString("yyyy-MM-dd"), int.Parse(comboBoxCarID.SelectedValue.ToString()));
- }
- }
- else
- {
- if (this.DataContext != null)
- {
- ReadCheckRecordWindowModel model = this.DataContext as ReadCheckRecordWindowModel;
- model.LoadExcelData(DateTime.Now.ToString("yyyy-MM-dd"), int.Parse(comboBoxCarID.SelectedValue.ToString()));
- }
- }
- }
- private void comboBoxType_DropDownClosed(object sender, EventArgs e)
- {
- int kind = 0;
- if(checkBox1.IsChecked.Value && checkBox2.IsChecked.Value)
- {
- kind = 3;
- }
- else if(checkBox1.IsChecked.Value)
- {
- kind = 1;
- }
- else if(checkBox2.IsChecked.Value)
- {
- kind = 2;
- }
-
- if (calendar1.SelectedDate != null)
- {
- if (this.DataContext != null)
- {
- ReadCheckRecordWindowModel model = this.DataContext as ReadCheckRecordWindowModel;
- model.LoadRankData(calendar1.SelectedDate.Value.ToString("yyyy-MM-dd"),comboBoxType.Text,kind);
- }
- }
- else
- {
- if (this.DataContext != null)
- {
- ReadCheckRecordWindowModel model = this.DataContext as ReadCheckRecordWindowModel;
- model.LoadRankData(DateTime.Now.ToString("yyyy-MM-dd"), comboBoxType.Text,kind);
- }
- }
- }
- }
- }
|