终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

74 line
3.6 KiB

  1. using FryPot_DosingSystem.Attributes;
  2. using FryPot_DosingSystem.Model;
  3. using BPA.Helper;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Collections.ObjectModel;
  7. using System.Linq;
  8. using System.Reflection;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. namespace FryPot_DosingSystem.ViewModel
  12. {
  13. internal class FryPotMonitorViewModel:NotifyBase
  14. {
  15. public ObservableCollection<VariableMonitorModel> variableMonitorModels { get; set; } = new ObservableCollection<VariableMonitorModel>();
  16. public int id { get; set; } = 0;
  17. public FryPotMonitorViewModel()
  18. {
  19. variableMonitorModels = FryPotInfoManage.GetInstance.variableInfos;
  20. // if (variableMonitorModels.Count > 0)
  21. // {
  22. // variableMonitorModels.Clear();
  23. // }
  24. //PropertyInfo[] pros= FryPotMonitorManage.GetInstance.fryOne.GetType().GetProperties();
  25. // foreach (var item in pros)
  26. // {
  27. // var monitor = item.GetCustomAttribute<VariableAttribute>();
  28. // if (monitor != null)
  29. // {
  30. // variableMonitorModels.Add(new VariableMonitorModel { Id=id+1,VarName=monitor.VarName,PLCAddress=monitor.PLCAddress,Notes=monitor.Notes,ModbusTcpAddress=monitor.ModbusTcpAddress });
  31. // }
  32. // }
  33. // PropertyInfo[] pros2 = FryPotMonitorManage.GetInstance.fryTwo.GetType().GetProperties();
  34. // foreach (var item in pros2)
  35. // {
  36. // var monitor = item.GetCustomAttribute<VariableAttribute>();
  37. // if (monitor != null)
  38. // {
  39. // variableMonitorModels.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress });
  40. // }
  41. // }
  42. // PropertyInfo[] pros3 = FryPotMonitorManage.GetInstance.fryThree.GetType().GetProperties();
  43. // foreach (var item in pros3)
  44. // {
  45. // var monitor = item.GetCustomAttribute<VariableAttribute>();
  46. // if (monitor != null)
  47. // {
  48. // variableMonitorModels.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress });
  49. // }
  50. // }
  51. // PropertyInfo[] pros4 = FryPotMonitorManage.GetInstance.fryFour.GetType().GetProperties();
  52. // foreach (var item in pros4)
  53. // {
  54. // var monitor = item.GetCustomAttribute<VariableAttribute>();
  55. // if (monitor != null)
  56. // {
  57. // variableMonitorModels.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress });
  58. // }
  59. // }
  60. // PropertyInfo[] pros5 = FryPotMonitorManage.GetInstance.fryFive.GetType().GetProperties();
  61. // foreach (var item in pros5)
  62. // {
  63. // var monitor = item.GetCustomAttribute<VariableAttribute>();
  64. // if (monitor != null)
  65. // {
  66. // variableMonitorModels.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress });
  67. // }
  68. // }
  69. }
  70. }
  71. }