using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using BPA.Helper; using System.Collections.Concurrent; using System.Collections.ObjectModel; using System.Windows; using BPA.Helper; using BPASmartClient.JXJFoodBigStation.Model; using BPASmartClient.JXJFoodBigStation.View; using System.Windows.Forms; using BPASmartClient.JXJFoodBigStation.Model.HK_PLC; using System.Reflection; namespace BPASmartClient.JXJFoodBigStation.ViewModel { public class HardwareStatusViewModel : NotifyBase { public HardwareStatusViewModel() { foreach (PropertyInfo mi in typeof(StockBinName).GetProperties()) { object ab = GVL_BigStation.stockBinName.GetType().GetProperty(mi.Name).GetValue(GVL_BigStation.stockBinName, null); if (mi.Name=="RawMaterialName1" || mi.Name == "RawMaterialName2" || mi.Name == "RawMaterialName3" || mi.Name == "RawMaterialName4" || mi.Name == "RawMaterialName5" || mi.Name == "RawMaterialName6" || mi.Name == "RawMaterialName7") { TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus() { DeviceName = ab.ToString(), DeviceNum = TopDeviceCurrentStatuses.Count + 1, RunStatus = true, Weight = new Random().Next(0, 100) }); } else { BottomDeviceCurrentStatuses.Add(new DeviceCurrentStatus() { DeviceName = ab.ToString(), DeviceNum = BottomDeviceCurrentStatuses.Count + 8, RunStatus = false, Weight = new Random().Next(0, 100) }); } } } public ObservableCollection TopDeviceCurrentStatuses { get; set; } = new ObservableCollection(); public ObservableCollection BottomDeviceCurrentStatuses { get; set; } = new ObservableCollection(); public BPARelayCommand UpdateRawMaterName { get; set; } public BPARelayCommand StartCommand { get; set; } public BPARelayCommand StopCommand { get; set; } } }