DataHistoryViewModel.cs 24 KB

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