EventLogView.xaml.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. using System;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. using Aitex.Core.UI.MVVM;
  5. using Aitex.Core.UI.View.Common;
  6. using Aitex.Sorter.UI.ViewModel;
  7. namespace Aitex.Sorter.UI.Views
  8. {
  9. /// <summary>
  10. /// EventView.xaml 的交互逻辑
  11. /// </summary>
  12. public partial class EventLogView : UserControl, IBaseView
  13. {
  14. public EventLogView()
  15. {
  16. InitializeComponent();
  17. this.DataContext = new EventLogViewModel();
  18. this.IsVisibleChanged += JetEventView_IsVisibleChanged;
  19. var now = DateTime.Now;
  20. dateBegin.DisplayDate = new DateTime(now.Year, now.Month, now.Day, 0, 0, 0, 0);
  21. dateEnd.DisplayDate = now;
  22. dateBegin.SelectedDate = now;
  23. dateEnd.SelectedDate = now;
  24. timeBegin.Value = new DateTime(now.Year, now.Month, now.Day, 0, 0, 0, 0);
  25. timeEnd.Value = new DateTime(now.Year, now.Month, now.Day, 23, 59, 59, 999);
  26. }
  27. private DateTime BeginTime
  28. {
  29. get
  30. {
  31. var BeginDate = dateBegin.SelectedDate.HasValue ? dateBegin.SelectedDate.Value : DateTime.Now;
  32. return new DateTime(BeginDate.Year, BeginDate.Month, BeginDate.Day,
  33. timeBegin.Value.Value.Hour, timeBegin.Value.Value.Minute, timeBegin.Value.Value.Second);
  34. }
  35. }
  36. private DateTime EndTime
  37. {
  38. get
  39. {
  40. var EndDate = dateEnd.SelectedDate.HasValue ? dateEnd.SelectedDate.Value : DateTime.Now;
  41. return new DateTime(EndDate.Year, EndDate.Month, EndDate.Day,
  42. timeEnd.Value.Value.Hour, timeEnd.Value.Value.Minute, timeEnd.Value.Value.Second, 999);
  43. }
  44. }
  45. void JetEventView_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
  46. {
  47. (this.DataContext as TimerViewModelBase).EnableTimer(this.IsVisible);
  48. if ((bool)e.NewValue)
  49. {
  50. var vm = DataContext as EventLogViewModel;
  51. if (vm != null)
  52. {
  53. vm.SearchBeginTime = BeginTime;
  54. vm.SearchEndTime = EndTime;
  55. vm.Preload();
  56. }
  57. }
  58. }
  59. /// <summary>
  60. /// Query
  61. /// </summary>
  62. /// <param name="sender"></param>
  63. /// <param name="e"></param>
  64. private void Button_Click(object sender, RoutedEventArgs e)
  65. {
  66. var vm = DataContext as EventLogViewModel;
  67. vm.SearchBeginTime = BeginTime;
  68. vm.SearchEndTime = EndTime;
  69. vm.SearchCommand.Execute(this);
  70. }
  71. }
  72. [TemplateVisualState(Name = "Large", GroupName = "SizeStates")]
  73. [TemplateVisualState(Name = "Small", GroupName = "SizeStates")]
  74. [TemplateVisualState(Name = "Inactive", GroupName = "ActiveStates")]
  75. [TemplateVisualState(Name = "Active", GroupName = "ActiveStates")]
  76. public partial class CirclePointRingLoading : Control
  77. {
  78. // Token: 0x17000001 RID: 1
  79. // (get) Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250
  80. // (set) Token: 0x06000002 RID: 2 RVA: 0x00002072 File Offset: 0x00000272
  81. public double BindableWidth
  82. {
  83. get
  84. {
  85. return (double)base.GetValue(CirclePointRingLoading.BindableWidthProperty);
  86. }
  87. private set
  88. {
  89. base.SetValue(CirclePointRingLoading.BindableWidthProperty, value);
  90. }
  91. }
  92. // Token: 0x06000003 RID: 3 RVA: 0x00002088 File Offset: 0x00000288
  93. private static void BindableWidthCallback(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
  94. {
  95. CirclePointRingLoading circlePointRingLoading = dependencyObject as CirclePointRingLoading;
  96. bool flag = circlePointRingLoading == null;
  97. if (!flag)
  98. {
  99. circlePointRingLoading.SetEllipseDiameter((double)e.NewValue);
  100. circlePointRingLoading.SetEllipseOffset((double)e.NewValue);
  101. circlePointRingLoading.SetMaxSideLength((double)e.NewValue);
  102. }
  103. }
  104. // Token: 0x06000004 RID: 4 RVA: 0x000020E0 File Offset: 0x000002E0
  105. private void SetEllipseDiameter(double width)
  106. {
  107. this.EllipseDiameter = width / 8.0;
  108. }
  109. // Token: 0x06000005 RID: 5 RVA: 0x000020F5 File Offset: 0x000002F5
  110. private void SetEllipseOffset(double width)
  111. {
  112. this.EllipseOffset = new Thickness(0.0, width / 2.0, 0.0, 0.0);
  113. }
  114. // Token: 0x06000006 RID: 6 RVA: 0x0000212A File Offset: 0x0000032A
  115. private void SetMaxSideLength(double width)
  116. {
  117. this.MaxSideLength = ((width <= 20.0) ? 20.0 : width);
  118. }
  119. // Token: 0x17000002 RID: 2
  120. // (get) Token: 0x06000007 RID: 7 RVA: 0x0000214C File Offset: 0x0000034C
  121. // (set) Token: 0x06000008 RID: 8 RVA: 0x0000216E File Offset: 0x0000036E
  122. public bool IsActive
  123. {
  124. get
  125. {
  126. return (bool)base.GetValue(CirclePointRingLoading.IsActiveProperty);
  127. }
  128. set
  129. {
  130. base.SetValue(CirclePointRingLoading.IsActiveProperty, value);
  131. }
  132. }
  133. // Token: 0x06000009 RID: 9 RVA: 0x00002184 File Offset: 0x00000384
  134. private static void IsActiveChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
  135. {
  136. CirclePointRingLoading circlePointRingLoading = sender as CirclePointRingLoading;
  137. bool flag = circlePointRingLoading == null;
  138. if (!flag)
  139. {
  140. circlePointRingLoading.UpdateActiveState();
  141. }
  142. }
  143. // Token: 0x0600000A RID: 10 RVA: 0x000021AC File Offset: 0x000003AC
  144. private void UpdateActiveState()
  145. {
  146. bool isActive = this.IsActive;
  147. if (isActive)
  148. {
  149. VisualStateManager.GoToState(this, this.StateActive, true);
  150. }
  151. else
  152. {
  153. VisualStateManager.GoToState(this, this.StateInActive, true);
  154. }
  155. }
  156. // Token: 0x17000003 RID: 3
  157. // (get) Token: 0x0600000B RID: 11 RVA: 0x000021E4 File Offset: 0x000003E4
  158. // (set) Token: 0x0600000C RID: 12 RVA: 0x00002206 File Offset: 0x00000406
  159. public bool IsLarge
  160. {
  161. get
  162. {
  163. return (bool)base.GetValue(CirclePointRingLoading.IsLargeProperty);
  164. }
  165. set
  166. {
  167. base.SetValue(CirclePointRingLoading.IsLargeProperty, value);
  168. }
  169. }
  170. // Token: 0x0600000D RID: 13 RVA: 0x0000221C File Offset: 0x0000041C
  171. private static void IsLargeChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
  172. {
  173. CirclePointRingLoading circlePointRingLoading = sender as CirclePointRingLoading;
  174. bool flag = circlePointRingLoading == null;
  175. if (!flag)
  176. {
  177. circlePointRingLoading.UpdateLargeState();
  178. }
  179. }
  180. // Token: 0x0600000E RID: 14 RVA: 0x00002244 File Offset: 0x00000444
  181. private void UpdateLargeState()
  182. {
  183. bool isLarge = this.IsLarge;
  184. if (isLarge)
  185. {
  186. VisualStateManager.GoToState(this, this.StateLarge, true);
  187. }
  188. else
  189. {
  190. VisualStateManager.GoToState(this, this.StateSmall, true);
  191. }
  192. }
  193. // Token: 0x17000004 RID: 4
  194. // (get) Token: 0x0600000F RID: 15 RVA: 0x0000227C File Offset: 0x0000047C
  195. // (set) Token: 0x06000010 RID: 16 RVA: 0x0000229E File Offset: 0x0000049E
  196. public double MaxSideLength
  197. {
  198. get
  199. {
  200. return (double)base.GetValue(CirclePointRingLoading.MaxSideLengthProperty);
  201. }
  202. set
  203. {
  204. base.SetValue(CirclePointRingLoading.MaxSideLengthProperty, value);
  205. }
  206. }
  207. // Token: 0x17000005 RID: 5
  208. // (get) Token: 0x06000011 RID: 17 RVA: 0x000022B4 File Offset: 0x000004B4
  209. // (set) Token: 0x06000012 RID: 18 RVA: 0x000022D6 File Offset: 0x000004D6
  210. public double EllipseDiameter
  211. {
  212. get
  213. {
  214. return (double)base.GetValue(CirclePointRingLoading.EllipseDiameterProperty);
  215. }
  216. set
  217. {
  218. base.SetValue(CirclePointRingLoading.EllipseDiameterProperty, value);
  219. }
  220. }
  221. // Token: 0x17000006 RID: 6
  222. // (get) Token: 0x06000013 RID: 19 RVA: 0x000022EC File Offset: 0x000004EC
  223. // (set) Token: 0x06000014 RID: 20 RVA: 0x0000230E File Offset: 0x0000050E
  224. public Thickness EllipseOffset
  225. {
  226. get
  227. {
  228. return (Thickness)base.GetValue(CirclePointRingLoading.EllipseOffsetProperty);
  229. }
  230. set
  231. {
  232. base.SetValue(CirclePointRingLoading.EllipseOffsetProperty, value);
  233. }
  234. }
  235. // Token: 0x06000015 RID: 21 RVA: 0x00002324 File Offset: 0x00000524
  236. public CirclePointRingLoading()
  237. {
  238. base.SizeChanged += new SizeChangedEventHandler((object argument0, SizeChangedEventArgs argument1) => this.BindableWidth = base.ActualWidth);
  239. }
  240. // Token: 0x06000016 RID: 22 RVA: 0x00002378 File Offset: 0x00000578
  241. static CirclePointRingLoading()
  242. {
  243. FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(CirclePointRingLoading), new FrameworkPropertyMetadata(typeof(CirclePointRingLoading)));
  244. UIElement.VisibilityProperty.OverrideMetadata(typeof(CirclePointRingLoading), new FrameworkPropertyMetadata(delegate (DependencyObject ringObject, DependencyPropertyChangedEventArgs e)
  245. {
  246. bool flag = e.NewValue != e.OldValue;
  247. if (flag)
  248. {
  249. CirclePointRingLoading circlePointRingLoading = (CirclePointRingLoading)ringObject;
  250. bool flag2 = (Visibility)e.NewValue > Visibility.Visible;
  251. if (flag2)
  252. {
  253. circlePointRingLoading.SetCurrentValue(CirclePointRingLoading.IsActiveProperty, false);
  254. }
  255. else
  256. {
  257. circlePointRingLoading.IsActive = true;
  258. }
  259. }
  260. }));
  261. }
  262. // Token: 0x06000017 RID: 23 RVA: 0x00002531 File Offset: 0x00000731
  263. public override void OnApplyTemplate()
  264. {
  265. base.OnApplyTemplate();
  266. this.UpdateLargeState();
  267. this.UpdateActiveState();
  268. }
  269. // Token: 0x04000001 RID: 1
  270. private string StateActive = "Active";
  271. // Token: 0x04000002 RID: 2
  272. private string StateInActive = "InActive";
  273. // Token: 0x04000003 RID: 3
  274. private string StateLarge = "Large";
  275. // Token: 0x04000004 RID: 4
  276. private string StateSmall = "Small";
  277. // Token: 0x04000005 RID: 5
  278. public static readonly DependencyProperty BindableWidthProperty = DependencyProperty.Register("BindableWidth", typeof(double), typeof(CirclePointRingLoading), new PropertyMetadata(0.0, new PropertyChangedCallback(CirclePointRingLoading.BindableWidthCallback)));
  279. // Token: 0x04000006 RID: 6
  280. public static readonly DependencyProperty IsActiveProperty = DependencyProperty.Register("IsActive", typeof(bool), typeof(CirclePointRingLoading), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, new PropertyChangedCallback(CirclePointRingLoading.IsActiveChanged)));
  281. // Token: 0x04000007 RID: 7
  282. public static readonly DependencyProperty IsLargeProperty = DependencyProperty.Register("IsLarge", typeof(bool), typeof(CirclePointRingLoading), new PropertyMetadata(true, new PropertyChangedCallback(CirclePointRingLoading.IsLargeChangedCallback)));
  283. // Token: 0x04000008 RID: 8
  284. public static readonly DependencyProperty MaxSideLengthProperty = DependencyProperty.Register("MaxSideLength", typeof(double), typeof(CirclePointRingLoading), new PropertyMetadata(0.0));
  285. // Token: 0x04000009 RID: 9
  286. public static readonly DependencyProperty EllipseDiameterProperty = DependencyProperty.Register("EllipseDiameter", typeof(double), typeof(CirclePointRingLoading), new PropertyMetadata(0.0));
  287. // Token: 0x0400000A RID: 10
  288. public static readonly DependencyProperty EllipseOffsetProperty = DependencyProperty.Register("EllipseOffset", typeof(Thickness), typeof(CirclePointRingLoading), new PropertyMetadata(default(Thickness)));
  289. }
  290. }