|
- using FryPot_DosingSystem.Attributes;
- using FryPot_DosingSystem.Model;
- using BPA.Helper;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Reflection;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace FryPot_DosingSystem.ViewModel
- {
- internal class FryPotMonitorViewModel:NotifyBase
- {
- public ObservableCollection<VariableMonitorModel> variableMonitorModels { get; set; } = new ObservableCollection<VariableMonitorModel>();
- public int id { get; set; } = 0;
- public FryPotMonitorViewModel()
- {
- variableMonitorModels = FryPotInfoManage.GetInstance.variableInfos;
- // if (variableMonitorModels.Count > 0)
- // {
- // variableMonitorModels.Clear();
- // }
- //PropertyInfo[] pros= FryPotMonitorManage.GetInstance.fryOne.GetType().GetProperties();
- // foreach (var item in pros)
- // {
- // var monitor = item.GetCustomAttribute<VariableAttribute>();
- // if (monitor != null)
- // {
- // variableMonitorModels.Add(new VariableMonitorModel { Id=id+1,VarName=monitor.VarName,PLCAddress=monitor.PLCAddress,Notes=monitor.Notes,ModbusTcpAddress=monitor.ModbusTcpAddress });
- // }
- // }
- // PropertyInfo[] pros2 = FryPotMonitorManage.GetInstance.fryTwo.GetType().GetProperties();
- // foreach (var item in pros2)
- // {
- // var monitor = item.GetCustomAttribute<VariableAttribute>();
- // if (monitor != null)
- // {
- // variableMonitorModels.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress });
- // }
- // }
- // PropertyInfo[] pros3 = FryPotMonitorManage.GetInstance.fryThree.GetType().GetProperties();
- // foreach (var item in pros3)
- // {
- // var monitor = item.GetCustomAttribute<VariableAttribute>();
- // if (monitor != null)
- // {
- // variableMonitorModels.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress });
- // }
- // }
- // PropertyInfo[] pros4 = FryPotMonitorManage.GetInstance.fryFour.GetType().GetProperties();
- // foreach (var item in pros4)
- // {
- // var monitor = item.GetCustomAttribute<VariableAttribute>();
- // if (monitor != null)
- // {
- // variableMonitorModels.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress });
- // }
- // }
- // PropertyInfo[] pros5 = FryPotMonitorManage.GetInstance.fryFive.GetType().GetProperties();
- // foreach (var item in pros5)
- // {
- // var monitor = item.GetCustomAttribute<VariableAttribute>();
- // if (monitor != null)
- // {
- // variableMonitorModels.Add(new VariableMonitorModel { Id = id + 1, VarName = monitor.VarName, PLCAddress = monitor.PLCAddress, Notes = monitor.Notes, ModbusTcpAddress = monitor.ModbusTcpAddress });
- // }
- // }
-
- }
- }
- }
|