12345678910111213141516171819202122232425262728293031323334353637 |
- using Prism.Events;
- using ProjectManagementSystem.Common.Core;
- using ProjectManagementSystemView.Infrastructure.Events;
- using ProjectManagementSystemView.Infrastructure.Extensions;
- using ProjectManagementSystemView.Infrastructure.Models;
- using PropertyChanged;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ProjectManagementSystemView.ViewModels
- {
- [AddINotifyPropertyChangedInterface]
- public class DebugPackV2ViewModel
- {
- public bool IsVisible { get; set; }
- public double TimeConsumption { get; set; }
- public ObservableCollection<VmPackStationV2> VmDatas { get; set; } = new ObservableCollection<VmPackStationV2>();
- public DebugPackV2ViewModel(IEventAggregator eventAggregator)
- {
- eventAggregator.GetEvent<UpdateViewEvent>().Subscribe(UpdateView);
- }
- private void UpdateView()
- {
- if (!IsVisible) return;
- TimeConsumption = PackControlCrms.Instance.TimeConsumption;
- var dataList = PackControlCrms.Instance.StationDictionary.Values.OrderBy(d => d.Id);
- VmDatas.Update(dataList, (s, v) => s.Id == v.Id);
- }
- }
- }
|