EventView.xaml.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Data;
  8. using System.Windows.Documents;
  9. using System.Windows.Input;
  10. using System.Windows.Media;
  11. using System.Windows.Media.Imaging;
  12. using System.Windows.Navigation;
  13. using System.Windows.Shapes;
  14. using Aitex.Core.Util;
  15. namespace Aitex.Core.UI.View.Common
  16. {
  17. /// <summary>
  18. /// Interaction logic for EventView.xaml
  19. /// </summary>
  20. public partial class EventView : UserControl
  21. {
  22. public EventView()
  23. {
  24. InitializeComponent();
  25. IsVisibleChanged += new DependencyPropertyChangedEventHandler(MainWindow_IsVisibleChanged);
  26. }
  27. void MainWindow_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
  28. {
  29. if ((bool)e.NewValue)
  30. {
  31. var vm = DataContext as EventViewModel;
  32. if (vm != null)
  33. {
  34. wfTimeFrom.Value = vm.SearchBeginTime;
  35. wfTimeTo.Value = vm.SearchEndTime;
  36. vm.Preload();
  37. }
  38. }
  39. }
  40. /// <summary>
  41. /// Query
  42. /// </summary>
  43. /// <param name="sender"></param>
  44. /// <param name="e"></param>
  45. private void Button_Click(object sender, RoutedEventArgs e)
  46. {
  47. var vm = DataContext as EventViewModel;
  48. vm.SearchBeginTime = wfTimeFrom.Value;
  49. vm.SearchEndTime = wfTimeTo.Value;
  50. vm.SearchCommand.Execute(this);
  51. }
  52. }
  53. }