DataHistoryViewModel.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  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 void OnStart()
  254. {
  255. if (Keys.Count > 10)
  256. {
  257. WPFMessageBox.ShowWarning("最多显示10个数据");
  258. return;
  259. }
  260. this.DataHistoryView.MyDrawGraphicsControl.ClearPlotPoints();
  261. Dispatcher dispatcher = Dispatcher.CurrentDispatcher;
  262. Task.Run(() =>
  263. {
  264. dispatcher.Invoke(new Action(() =>
  265. {
  266. var result = GetData(Keys.Distinct().ToList(), this.DataHistoryView.wfTimeFrom.Value, this.DataHistoryView.wfTimeTo.Value);
  267. if (result == null)
  268. {
  269. return;
  270. }
  271. List<PointCollection> cls = new List<PointCollection>();
  272. for (int i = 0; i < Keys.Count; i++)
  273. {
  274. PointCollection points = new PointCollection();
  275. int k = 1;
  276. result[Keys[i]].ForEach(point =>
  277. {
  278. points.Add(new Point() { X = point.dateTime.ToOADate(), Y = point.value });
  279. k += 1;
  280. });
  281. cls.Add(points);
  282. }
  283. //for (int i = 0; i < KeyDataObservableCollection.Count(); i++)
  284. //{
  285. // var _color = KeyDataObservableCollection[i].Color.Color;
  286. // this.DataHistoryView.MyDrawGraphicsControl.m_PenCollencteions[i] = new System.Drawing.Pen(System.Drawing.Color.FromArgb(_color.A, _color.R, _color.G, _color.B), 2);
  287. //}
  288. //ColorChanged();
  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. TimeSpan sp = to.Subtract(from);
  409. if (sp.TotalHours > 24)
  410. {
  411. WPFMessageBox.ShowWarning("数据差不能超过24小时");
  412. return null;
  413. }
  414. string sql = "";
  415. if (from.ToString("yyyyMMdd") == to.ToString("yyyyMMdd"))
  416. {
  417. sql += "select time AS InternalTimeStamp";
  418. foreach (var dataId in keys)
  419. {
  420. sql += "," + string.Format("\"{0}\"", dataId);
  421. }
  422. sql += string.Format(" from \"{0}\" where time > {1} and time <= {2} order by time asc",
  423. from.ToString("yyyyMMdd") + "." + "Data", from.Ticks, to.Ticks);
  424. }
  425. else
  426. {
  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. from.ToString("yyyyMMdd") + "." + "Data", from.Ticks);
  434. sql += " UNION ";
  435. sql += "select time AS InternalTimeStamp";
  436. foreach (var dataId in keys)
  437. {
  438. sql += "," + string.Format("\"{0}\"", dataId);
  439. }
  440. sql += string.Format(" from \"{0}\" where time < {1}",
  441. to.ToString("yyyyMMdd") + "." + "Data", to.Ticks);
  442. }
  443. DataTable dataTable = QueryDataClient.Instance.Service.QueryData(sql);
  444. Dictionary<string, List<HistoryDataItem>> historyData = new Dictionary<string, List<HistoryDataItem>>();
  445. if (dataTable == null || dataTable.Rows.Count == 0)
  446. return null;
  447. DateTime dt = new DateTime();
  448. Dictionary<int, string> colName = new Dictionary<int, string>();
  449. for (int colNo = 0; colNo < dataTable.Columns.Count; colNo++)
  450. {
  451. colName.Add(colNo, dataTable.Columns[colNo].ColumnName);
  452. historyData[dataTable.Columns[colNo].ColumnName] = new List<HistoryDataItem>();
  453. }
  454. for (int rowNo = 0; rowNo < dataTable.Rows.Count; rowNo++)
  455. {
  456. PointCollection points = new PointCollection();
  457. var row = dataTable.Rows[rowNo];
  458. for (int i = 0; i < dataTable.Columns.Count; i++)
  459. {
  460. HistoryDataItem data = new HistoryDataItem();
  461. if (i == 0)
  462. {
  463. long ticks = (long)row[i];
  464. dt = new DateTime(ticks);
  465. continue;
  466. }
  467. else
  468. {
  469. string dataId = colName[i];
  470. if (row[i] is DBNull || row[i] == null)
  471. {
  472. data.dateTime = dt;
  473. data.dbName = colName[i];
  474. data.value = 0;
  475. }
  476. else if (row[i] is bool)
  477. {
  478. data.dateTime = dt;
  479. data.dbName = colName[i];
  480. data.value = (bool)row[i] ? 1 : 0;
  481. }
  482. else
  483. {
  484. data.dateTime = dt;
  485. data.dbName = colName[i];
  486. data.value = float.Parse(row[i].ToString());
  487. }
  488. }
  489. historyData[data.dbName].Add(data);
  490. }
  491. }
  492. foreach (var item in historyData)
  493. {
  494. item.Value.Sort((x, y) => DateTime.Compare(x.dateTime, y.dateTime));
  495. }
  496. return historyData;
  497. }
  498. private void CalKeys(ParameterNode parameterNode)
  499. {
  500. if (parameterNode.ChildNodes.Count > 0)
  501. {
  502. foreach (var item in parameterNode.ChildNodes)
  503. {
  504. CalKeys(item);
  505. }
  506. }
  507. else
  508. {
  509. if (parameterNode.Selected == true)
  510. {
  511. Keys.Add(parameterNode.Name);
  512. }
  513. }
  514. }
  515. private void Timer_Tick(object sender, EventArgs e)
  516. {
  517. if (!m_IsEnter)
  518. {
  519. return;
  520. }
  521. if (Keys.Count > 10)
  522. {
  523. WPFMessageBox.ShowWarning("最多显示10个数据");
  524. timer.Stop();
  525. return;
  526. }
  527. this.DataHistoryView.MyDrawGraphicsControl.ClearPlotPoints();
  528. var result = GetData(Keys.Distinct().ToList(), currentTime.AddMinutes(-1), DateTime.Now);
  529. if (result == null)
  530. {
  531. return;
  532. }
  533. List<PointCollection> cls = new List<PointCollection>();
  534. for (int i = 0; i < Keys.Count; i++)
  535. {
  536. PointCollection points = new PointCollection();
  537. int k = 1;
  538. result[Keys[i]].ForEach(point =>
  539. {
  540. points.Add(new Point() { X = point.dateTime.ToOADate(), Y = point.value });
  541. k += 1;
  542. });
  543. cls.Add(points);
  544. }
  545. this.DataHistoryView.MyDrawGraphicsControl.PointCollections = cls;
  546. //if (this.DataHistoryView.MyDrawGraphicsControl.IsHorizontalNavigationEnabled == false && this.DataHistoryView.MyDrawGraphicsControl.IsVerticalNavigationEnabled == false)
  547. //{
  548. // this.DataHistoryView.MyDrawGraphicsControl.FitControlWithoutDrawing();
  549. //}
  550. //DateTime dateTimeNow = DateTime.Now;
  551. this.DataHistoryView.MyDrawGraphicsControl.YPoints.Clear();
  552. if (IsShowStep)
  553. {
  554. var item = QueryDataClient.Instance.Service.GetHistorySteps(startTime, DateTime.Now);
  555. if (item.Count > 0)
  556. {
  557. var pmList = new List<string>();
  558. if (IsPMAChecked)
  559. {
  560. pmList.Add("PMA");
  561. }
  562. if (IsPMBChecked)
  563. {
  564. pmList.Add("PMB");
  565. }
  566. if (IsPMCChecked)
  567. {
  568. pmList.Add("PMC");
  569. }
  570. if (IsPMDChecked)
  571. {
  572. pmList.Add("PMD");
  573. }
  574. item.ForEach(x =>
  575. {
  576. if (pmList.Contains(x.RecipeId))
  577. {
  578. 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")}" });
  579. }
  580. });
  581. }
  582. }
  583. else
  584. {
  585. this.DataHistoryView.MyDrawGraphicsControl.YPoints.Clear();
  586. }
  587. }
  588. public void ColorChanged()
  589. {
  590. for (int i = 0; i < KeyDataObservableCollection.Count(); i++)
  591. {
  592. var _color = KeyDataObservableCollection[i].Color.Color;
  593. this.DataHistoryView.MyDrawGraphicsControl.m_PenCollencteions[i] = new System.Drawing.Pen(System.Drawing.Color.FromArgb(_color.A, _color.R, _color.G, _color.B), 2);
  594. }
  595. }
  596. public void EnterExitView(bool isEnter)
  597. {
  598. if (isEnter)
  599. {
  600. m_IsEnter = true;
  601. }
  602. else
  603. {
  604. m_IsEnter = false;
  605. }
  606. }
  607. #endregion
  608. }
  609. public class QueryIndexer
  610. {
  611. public DateTime TimeToken { get; set; }
  612. public List<string> DataList { get; set; }
  613. public string Module { get; set; }
  614. }
  615. public class KeyData : BindableBase
  616. {
  617. public string Key { get; set; }
  618. public SolidColorBrush _Color;
  619. public SolidColorBrush Color
  620. {
  621. get { return _Color; }
  622. set { SetProperty(ref _Color, value); }
  623. }
  624. public int UniqueId { get; set; }
  625. }
  626. }