DataHistoryViewModel.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. using Aitex.Core.UI.ControlDataContext;
  2. using ExcelLibrary.BinaryFileFormat;
  3. using MECF.Framework.Common.DataCenter;
  4. using Newtonsoft.Json;
  5. using Prism.Commands;
  6. using Prism.Mvvm;
  7. using System;
  8. using System.Collections.Concurrent;
  9. using System.Collections.Generic;
  10. using System.Collections.ObjectModel;
  11. using System.Data;
  12. using System.Linq;
  13. using System.Threading.Tasks;
  14. using System.Windows;
  15. using System.Windows.Media;
  16. using System.Windows.Threading;
  17. using Venus_MainPages.Unity;
  18. using Venus_MainPages.Views;
  19. using WPF.Themes.UserControls;
  20. namespace Venus_MainPages.ViewModels
  21. {
  22. public class DataHistoryViewModel : BindableBase
  23. {
  24. #region 私有字段
  25. private DataHistoryView DataHistoryView;
  26. private ObservableCollection<ParameterNode> _ParameterNodes;
  27. RealtimeProvider _provider = new RealtimeProvider();
  28. //private object _lockSelection = new object();
  29. //ConcurrentBag<QueryIndexer> _lstTokenTimeData = new ConcurrentBag<QueryIndexer>();
  30. ObservableCollection<string> m_Keys = new ObservableCollection<string>();
  31. ObservableCollection<KeyData> m_KeyDataObservableCollection = new ObservableCollection<KeyData>();
  32. DispatcherTimer timer = new DispatcherTimer();
  33. public List<SolidColorBrush> solidColorBrushes = new List<SolidColorBrush>();
  34. DateTime currentTime;
  35. private bool firstFlag = true;
  36. private DateTime startTime = DateTime.Now;
  37. private bool m_IsShowStep;
  38. private bool m_IsPMAChecked = true;
  39. private bool m_IsPMBChecked = true;
  40. private bool m_IsPMCChecked = true;
  41. private bool m_IsPMDChecked = true;
  42. private bool m_PMAIsInstalled;
  43. private bool m_PMBIsInstalled;
  44. private bool m_PMCIsInstalled;
  45. private bool m_PMDIsInstalled;
  46. private bool m_IsEnter;
  47. #endregion
  48. #region 属性
  49. public ObservableCollection<KeyData> OldKeyDataCollection { get; set; }
  50. public ObservableCollection<ParameterNode> ParameterNodes
  51. {
  52. get { return _ParameterNodes; }
  53. set { SetProperty(ref _ParameterNodes, value); }
  54. }
  55. public ObservableCollection<string> Keys
  56. {
  57. get { return m_Keys; }
  58. set { SetProperty(ref m_Keys, value); }
  59. }
  60. public ObservableCollection<KeyData> KeyDataObservableCollection
  61. {
  62. get { return m_KeyDataObservableCollection; }
  63. set { SetProperty(ref m_KeyDataObservableCollection, value); }
  64. }
  65. public bool IsShowStep
  66. {
  67. get { return m_IsShowStep; }
  68. set { SetProperty(ref m_IsShowStep, value); }
  69. }
  70. public bool IsPMAChecked
  71. {
  72. get { return m_IsPMAChecked; }
  73. set { SetProperty(ref m_IsPMAChecked, value); }
  74. }
  75. public bool IsPMBChecked
  76. {
  77. get { return m_IsPMBChecked; }
  78. set { SetProperty(ref m_IsPMBChecked, value); }
  79. }
  80. public bool IsPMCChecked
  81. {
  82. get { return m_IsPMCChecked; }
  83. set { SetProperty(ref m_IsPMCChecked, value); }
  84. }
  85. public bool IsPMDChecked
  86. {
  87. get { return m_IsPMDChecked; }
  88. set { SetProperty(ref m_IsPMDChecked, value); }
  89. }
  90. public bool PMAIsInstalled
  91. {
  92. get { return m_PMAIsInstalled; }
  93. set { SetProperty(ref m_PMAIsInstalled, value); }
  94. }
  95. public bool PMBIsInstalled
  96. {
  97. get { return m_PMBIsInstalled; }
  98. set { SetProperty(ref m_PMBIsInstalled, value); }
  99. }
  100. public bool PMCIsInstalled
  101. {
  102. get { return m_PMCIsInstalled; }
  103. set { SetProperty(ref m_PMCIsInstalled, value); }
  104. }
  105. public bool PMDIsInstalled
  106. {
  107. get { return m_PMDIsInstalled; }
  108. set { SetProperty(ref m_PMDIsInstalled, value); }
  109. }
  110. #endregion
  111. #region 命令
  112. private DelegateCommand<object> _LoadCommand;
  113. public DelegateCommand<object> LoadCommand =>
  114. _LoadCommand ?? (_LoadCommand = new DelegateCommand<object>(OnLoad));
  115. private DelegateCommand _UnLoadCommand;
  116. public DelegateCommand UnLoadCommand =>
  117. _UnLoadCommand ?? (_UnLoadCommand = new DelegateCommand(OnUnLoad));
  118. private DelegateCommand<object> _ParameterCheckCommand;
  119. public DelegateCommand<object> ParameterCheckCommand =>
  120. _ParameterCheckCommand ?? (_ParameterCheckCommand = new DelegateCommand<object>(OnParameterCheck));
  121. private DelegateCommand _StartCommand;
  122. public DelegateCommand StartCommand =>
  123. _StartCommand ?? (_StartCommand = new DelegateCommand(OnStart));
  124. private DelegateCommand _ClearCommand;
  125. public DelegateCommand ClearCommand =>
  126. _ClearCommand ?? (_ClearCommand = new DelegateCommand(OnClear));
  127. private DelegateCommand<object> _StartRealTimeCommand;
  128. public DelegateCommand<object> StartRealTimeCommand =>
  129. _StartRealTimeCommand ?? (_StartRealTimeCommand = new DelegateCommand<object>(OnStartRealTime));
  130. private DelegateCommand _StopRealTimeCommand;
  131. public DelegateCommand StopRealTimeCommand =>
  132. _StopRealTimeCommand ?? (_StopRealTimeCommand = new DelegateCommand(OnStopRealTime));
  133. #endregion
  134. #region 构造函数
  135. public DataHistoryViewModel()
  136. {
  137. OldKeyDataCollection = new ObservableCollection<KeyData>();
  138. ParameterNodes = _provider.GetParameters();
  139. timer.Interval = TimeSpan.FromSeconds(1);
  140. timer.Tick += Timer_Tick;
  141. solidColorBrushes.Add(new SolidColorBrush(Colors.Green));
  142. solidColorBrushes.Add(new SolidColorBrush(Colors.Red));
  143. solidColorBrushes.Add(new SolidColorBrush(Colors.Blue));
  144. solidColorBrushes.Add(new SolidColorBrush(Colors.Orange));
  145. solidColorBrushes.Add(new SolidColorBrush(Colors.Yellow));
  146. solidColorBrushes.Add(new SolidColorBrush(Colors.YellowGreen));
  147. solidColorBrushes.Add(new SolidColorBrush(Colors.AliceBlue));
  148. solidColorBrushes.Add(new SolidColorBrush(Colors.Chocolate));
  149. solidColorBrushes.Add(new SolidColorBrush(Colors.Cyan));
  150. solidColorBrushes.Add(new SolidColorBrush(Colors.DarkGreen));
  151. string allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString();
  152. PMAIsInstalled = allModules.Contains("PMA");
  153. PMBIsInstalled = allModules.Contains("PMB");
  154. PMCIsInstalled = allModules.Contains("PMC");
  155. PMDIsInstalled = allModules.Contains("PMD");
  156. }
  157. #endregion
  158. #region 命令方法
  159. private void OnLoad(Object eventView)
  160. {
  161. if (firstFlag)
  162. {
  163. this.DataHistoryView = (DataHistoryView)eventView;
  164. this.DataHistoryView.wfTimeFrom.Value = DateTime.Today;
  165. this.DataHistoryView.wfTimeTo.Value = new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, 23, 59, 59, 999);
  166. //this.DataHistoryView.MyDrawGraphicsControl.PointCollections=new PointCollection(new Point[] {})
  167. firstFlag = false;
  168. }
  169. }
  170. private void OnUnLoad()
  171. {
  172. GC.Collect(); // This should pick up the control removed at a previous MouseDown
  173. GC.WaitForPendingFinalizers(); // Doesn't help either
  174. GC.Collect();
  175. GC.WaitForPendingFinalizers(); // Doesn't help either
  176. }
  177. private void OnParameterCheck(object obj)
  178. {
  179. startTime = DateTime.Now;
  180. ParameterNode node = obj as ParameterNode;
  181. if (!RefreshTreeStatusToChild(node))
  182. {
  183. node.Selected = !node.Selected;
  184. }
  185. else
  186. {
  187. RefreshTreeStatusToParent(node);
  188. }
  189. Keys.Clear();
  190. for (int i = 0; i < ParameterNodes.Count; i++)
  191. {
  192. CalKeys(ParameterNodes[i]);
  193. }
  194. OldKeyDataCollection.Clear();
  195. OldKeyDataCollection = DeepCopyJson(KeyDataObservableCollection);
  196. KeyDataObservableCollection.Clear();
  197. for (int i = 0; i < Keys.Count; i++)
  198. {
  199. if (i == 10)
  200. {
  201. break;
  202. }
  203. KeyDataObservableCollection.Add(new KeyData() { Key = Keys[i], Color = solidColorBrushes[i], UniqueId = i });
  204. }
  205. Compare(OldKeyDataCollection, KeyDataObservableCollection);
  206. KeyDataObservableCollection = DeepCopyJson(OldKeyDataCollection);
  207. }
  208. public void Compare(ObservableCollection<KeyData> olddata, ObservableCollection<KeyData> newdata)
  209. {
  210. if (newdata != null)
  211. {
  212. for (int i = 0; i < newdata.Count; i++)
  213. {
  214. var lists = olddata.ToList().Find(t => t.Key == newdata[i].Key);
  215. if (lists == null)
  216. {
  217. olddata.Add(new KeyData() { Key = newdata[i].Key, Color = solidColorBrushes[i], UniqueId = olddata.Count + 1 });
  218. }
  219. }
  220. for (int i = 0; i < olddata.Count; i++)
  221. {
  222. var lists = newdata.ToList().Find(t => t.Key == olddata[i].Key);
  223. if (lists == null)
  224. {
  225. olddata.Remove(olddata[i]);
  226. }
  227. }
  228. }
  229. }
  230. public static T DeepCopyJson<T>(T obj)
  231. {
  232. // 序列化
  233. string json = JsonConvert.SerializeObject(obj);
  234. // 反序列化
  235. return JsonConvert.DeserializeObject<T>(json);
  236. }
  237. private void OnStartRealTime(object obj)
  238. {
  239. if (Keys.Count > 10)
  240. {
  241. ((System.Windows.Controls.CheckBox)obj).IsChecked = false;
  242. timer.Stop();
  243. WPFMessageBox.ShowWarning("最多显示10个数据");
  244. return;
  245. }
  246. currentTime = DateTime.Now;
  247. timer.Start();
  248. }
  249. private void OnStopRealTime()
  250. {
  251. timer.Stop();
  252. }
  253. public async void OnStart()
  254. {
  255. if (Keys.Count > 10)
  256. {
  257. WPFMessageBox.ShowWarning("最多显示10个数据");
  258. return;
  259. }
  260. TimeSpan sp = this.DataHistoryView.wfTimeTo.Value.Subtract(this.DataHistoryView.wfTimeFrom.Value);
  261. if (sp.TotalHours > 24)
  262. {
  263. WPFMessageBox.ShowWarning("数据差不能超过24小时");
  264. return;
  265. }
  266. this.DataHistoryView.MyDrawGraphicsControl.ClearPlotPoints();
  267. //Dispatcher dispatcher = Dispatcher.CurrentDispatcher;
  268. await Task.Run(() =>
  269. {
  270. var result = GetData(Keys.Distinct().ToList(), this.DataHistoryView.wfTimeFrom.Value, this.DataHistoryView.wfTimeTo.Value);
  271. DataHistoryView.Dispatcher.Invoke(new Action(() =>
  272. {
  273. if (result == null)
  274. {
  275. return;
  276. }
  277. List<PointCollection> cls = new List<PointCollection>();
  278. for (int i = 0; i < Keys.Count; i++)
  279. {
  280. PointCollection points = new PointCollection();
  281. int k = 1;
  282. result[Keys[i]].ForEach(point =>
  283. {
  284. points.Add(new Point() { X = point.dateTime.ToOADate(), Y = point.value });
  285. k += 1;
  286. });
  287. cls.Add(points);
  288. }
  289. this.DataHistoryView.MyDrawGraphicsControl.PointCollections = cls;
  290. this.DataHistoryView.MyDrawGraphicsControl.FitControl();
  291. this.DataHistoryView.MyDrawGraphicsControl.YPoints.Clear();
  292. if (IsShowStep)
  293. {
  294. var item = QueryDataClient.Instance.Service.GetHistorySteps(this.DataHistoryView.wfTimeFrom.Value, this.DataHistoryView.wfTimeTo.Value);
  295. if (item != null)
  296. {
  297. var pmList = new List<string>();
  298. if (IsPMAChecked)
  299. {
  300. pmList.Add("PMA");
  301. }
  302. if (IsPMBChecked)
  303. {
  304. pmList.Add("PMB");
  305. }
  306. if (IsPMCChecked)
  307. {
  308. pmList.Add("PMC");
  309. }
  310. if (IsPMDChecked)
  311. {
  312. pmList.Add("PMD");
  313. }
  314. item.ForEach(x =>
  315. {
  316. if (pmList.Contains(x.RecipeId))
  317. {
  318. this.DataHistoryView.MyDrawGraphicsControl.YPoints.Add(new Venus_Core.StepItem() { StartValue = x.StartTime.ToOADate(), Information = $"{x.RecipeId}\n{x.StepNo}\n{x.StartTime.ToString("HH:mm:ss:fff")}" });
  319. }
  320. });
  321. }
  322. }
  323. }));
  324. });
  325. }
  326. private void CloseAll(ObservableCollection<ParameterNode> parameterNodes)
  327. {
  328. foreach (var item in parameterNodes)
  329. {
  330. item.Selected = false;
  331. if (item.ChildNodes.Count > 0)
  332. {
  333. CloseAll(item.ChildNodes);
  334. }
  335. }
  336. }
  337. private void OnClear()
  338. {
  339. this.DataHistoryView.MyDrawGraphicsControl.ClearPlotPoints();
  340. this.DataHistoryView.MyDrawGraphicsControl.YPoints = new List<Venus_Core.StepItem>();
  341. KeyDataObservableCollection.Clear();
  342. CloseAll(ParameterNodes);
  343. Keys.Clear();
  344. this.DataHistoryView.MyDrawGraphicsControl.InitPens();
  345. }
  346. #endregion
  347. #region 私有方法
  348. private bool RefreshTreeStatusToChild(ParameterNode node)
  349. {
  350. if (node.ChildNodes.Count > 0)
  351. {
  352. for (int i = 0; i < node.ChildNodes.Count; i++)
  353. {
  354. ParameterNode n = node.ChildNodes[i];
  355. n.Selected = node.Selected;
  356. if (!RefreshTreeStatusToChild(n))
  357. {
  358. //uncheck left node
  359. for (int j = i; j < node.ChildNodes.Count; j++)
  360. {
  361. node.ChildNodes[j].Selected = !node.Selected;
  362. }
  363. //node.Selected = !node.Selected;
  364. return false;
  365. }
  366. }
  367. }
  368. //else
  369. //{
  370. // if (node.Selected == true)
  371. // {
  372. // keys.Add(node.Name);
  373. // }
  374. // else
  375. // {
  376. // keys.Remove(node.Name);
  377. // }
  378. //}
  379. return true;
  380. }
  381. private void RefreshTreeStatusToParent(ParameterNode node)
  382. {
  383. if (node.ParentNode != null)
  384. {
  385. if (node.Selected)
  386. {
  387. bool flag = true;
  388. for (int i = 0; i < node.ParentNode.ChildNodes.Count; i++)
  389. {
  390. if (!node.ParentNode.ChildNodes[i].Selected)
  391. {
  392. flag = false; //as least one child is unselected
  393. break;
  394. }
  395. }
  396. if (flag)
  397. node.ParentNode.Selected = true;
  398. }
  399. else
  400. {
  401. node.ParentNode.Selected = false;
  402. }
  403. RefreshTreeStatusToParent(node.ParentNode);
  404. }
  405. }
  406. private Dictionary<string, List<HistoryDataItem>> GetData(List<string> keys, DateTime from, DateTime to)
  407. {
  408. string sql = "";
  409. if (from.ToString("yyyyMMdd") == to.ToString("yyyyMMdd"))
  410. {
  411. sql += "select time AS InternalTimeStamp";
  412. foreach (var dataId in keys)
  413. {
  414. sql += "," + string.Format("\"{0}\"", dataId);
  415. }
  416. sql += string.Format(" from \"{0}\" where time > {1} and time <= {2} order by time asc",
  417. from.ToString("yyyyMMdd") + "." + "Data", from.Ticks, to.Ticks);
  418. }
  419. else
  420. {
  421. sql += "select time AS InternalTimeStamp";
  422. foreach (var dataId in keys)
  423. {
  424. sql += "," + string.Format("\"{0}\"", dataId);
  425. }
  426. sql += string.Format(" from \"{0}\" where time > {1}",
  427. from.ToString("yyyyMMdd") + "." + "Data", from.Ticks);
  428. sql += " UNION ";
  429. sql += "select time AS InternalTimeStamp";
  430. foreach (var dataId in keys)
  431. {
  432. sql += "," + string.Format("\"{0}\"", dataId);
  433. }
  434. sql += string.Format(" from \"{0}\" where time < {1}",
  435. to.ToString("yyyyMMdd") + "." + "Data", to.Ticks);
  436. }
  437. DataTable dataTable = QueryDataClient.Instance.Service.QueryData(sql);
  438. Dictionary<string, List<HistoryDataItem>> historyData = new Dictionary<string, List<HistoryDataItem>>();
  439. if (dataTable == null || dataTable.Rows.Count == 0)
  440. return null;
  441. DateTime dt = new DateTime();
  442. Dictionary<int, string> colName = new Dictionary<int, string>();
  443. for (int colNo = 0; colNo < dataTable.Columns.Count; colNo++)
  444. {
  445. colName.Add(colNo, dataTable.Columns[colNo].ColumnName);
  446. historyData[dataTable.Columns[colNo].ColumnName] = new List<HistoryDataItem>();
  447. }
  448. for (int rowNo = 0; rowNo < dataTable.Rows.Count; rowNo++)
  449. {
  450. PointCollection points = new PointCollection();
  451. var row = dataTable.Rows[rowNo];
  452. for (int i = 0; i < dataTable.Columns.Count; i++)
  453. {
  454. HistoryDataItem data = new HistoryDataItem();
  455. if (i == 0)
  456. {
  457. long ticks = (long)row[i];
  458. dt = new DateTime(ticks);
  459. continue;
  460. }
  461. else
  462. {
  463. string dataId = colName[i];
  464. if (row[i] is DBNull || row[i] == null)
  465. {
  466. data.dateTime = dt;
  467. data.dbName = colName[i];
  468. data.value = 0;
  469. }
  470. else if (row[i] is bool)
  471. {
  472. data.dateTime = dt;
  473. data.dbName = colName[i];
  474. data.value = (bool)row[i] ? 1 : 0;
  475. }
  476. else
  477. {
  478. data.dateTime = dt;
  479. data.dbName = colName[i];
  480. data.value = float.Parse(row[i].ToString());
  481. }
  482. }
  483. historyData[data.dbName].Add(data);
  484. }
  485. }
  486. foreach (var item in historyData)
  487. {
  488. item.Value.Sort((x, y) => DateTime.Compare(x.dateTime, y.dateTime));
  489. }
  490. return historyData;
  491. }
  492. private void CalKeys(ParameterNode parameterNode)
  493. {
  494. if (parameterNode.ChildNodes.Count > 0)
  495. {
  496. foreach (var item in parameterNode.ChildNodes)
  497. {
  498. CalKeys(item);
  499. }
  500. }
  501. else
  502. {
  503. if (parameterNode.Selected == true)
  504. {
  505. Keys.Add(parameterNode.Name);
  506. }
  507. }
  508. }
  509. private void Timer_Tick(object sender, EventArgs e)
  510. {
  511. if (!m_IsEnter)
  512. {
  513. return;
  514. }
  515. if (Keys.Count > 10)
  516. {
  517. WPFMessageBox.ShowWarning("最多显示10个数据");
  518. timer.Stop();
  519. return;
  520. }
  521. this.DataHistoryView.MyDrawGraphicsControl.ClearPlotPoints();
  522. var result = GetData(Keys.Distinct().ToList(), currentTime.AddMinutes(-1), DateTime.Now);
  523. if (result == null)
  524. {
  525. return;
  526. }
  527. List<PointCollection> cls = new List<PointCollection>();
  528. for (int i = 0; i < Keys.Count; i++)
  529. {
  530. PointCollection points = new PointCollection();
  531. int k = 1;
  532. result[Keys[i]].ForEach(point =>
  533. {
  534. points.Add(new Point() { X = point.dateTime.ToOADate(), Y = point.value });
  535. k += 1;
  536. });
  537. cls.Add(points);
  538. }
  539. this.DataHistoryView.MyDrawGraphicsControl.PointCollections = cls;
  540. //if (this.DataHistoryView.MyDrawGraphicsControl.IsHorizontalNavigationEnabled == false && this.DataHistoryView.MyDrawGraphicsControl.IsVerticalNavigationEnabled == false)
  541. //{
  542. // this.DataHistoryView.MyDrawGraphicsControl.FitControlWithoutDrawing();
  543. //}
  544. //DateTime dateTimeNow = DateTime.Now;
  545. this.DataHistoryView.MyDrawGraphicsControl.YPoints.Clear();
  546. if (IsShowStep)
  547. {
  548. var item = QueryDataClient.Instance.Service.GetHistorySteps(startTime, DateTime.Now);
  549. if (item.Count > 0)
  550. {
  551. var pmList = new List<string>();
  552. if (IsPMAChecked)
  553. {
  554. pmList.Add("PMA");
  555. }
  556. if (IsPMBChecked)
  557. {
  558. pmList.Add("PMB");
  559. }
  560. if (IsPMCChecked)
  561. {
  562. pmList.Add("PMC");
  563. }
  564. if (IsPMDChecked)
  565. {
  566. pmList.Add("PMD");
  567. }
  568. item.ForEach(x =>
  569. {
  570. if (pmList.Contains(x.RecipeId))
  571. {
  572. this.DataHistoryView.MyDrawGraphicsControl.YPoints.Add(new Venus_Core.StepItem() { StartValue = x.StartTime.ToOADate(), Information = $"{x.RecipeId}\n{x.StepNo}\n{x.StartTime.ToString("HH:mm:ss:fff")}" });
  573. }
  574. });
  575. }
  576. }
  577. else
  578. {
  579. this.DataHistoryView.MyDrawGraphicsControl.YPoints.Clear();
  580. }
  581. }
  582. public void ColorChanged()
  583. {
  584. for (int i = 0; i < KeyDataObservableCollection.Count(); i++)
  585. {
  586. var _color = KeyDataObservableCollection[i].Color.Color;
  587. this.DataHistoryView.MyDrawGraphicsControl.m_PenCollencteions[i] = new System.Drawing.Pen(System.Drawing.Color.FromArgb(_color.A, _color.R, _color.G, _color.B), 2);
  588. }
  589. }
  590. public void EnterExitView(bool isEnter)
  591. {
  592. if (isEnter)
  593. {
  594. m_IsEnter = true;
  595. }
  596. else
  597. {
  598. m_IsEnter = false;
  599. }
  600. }
  601. #endregion
  602. }
  603. public class QueryIndexer
  604. {
  605. public DateTime TimeToken { get; set; }
  606. public List<string> DataList { get; set; }
  607. public string Module { get; set; }
  608. }
  609. public class KeyData : BindableBase
  610. {
  611. public string Key { get; set; }
  612. public SolidColorBrush _Color;
  613. public SolidColorBrush Color
  614. {
  615. get { return _Color; }
  616. set { SetProperty(ref _Color, value); }
  617. }
  618. public int UniqueId { get; set; }
  619. }
  620. }