终端一体化运控平台
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

74 Zeilen
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. }