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 DebugPackViewModel { public bool IsVisible { get; set; } public ObservableCollection VmDatas { get; set; } = new ObservableCollection(); public DebugPackViewModel(IEventAggregator eventAggregator) { eventAggregator.GetEvent().Subscribe(UpdateView); } private void UpdateView() { if (!IsVisible) return; var dataList = PackControl.Instance.StationDictionary.Values.OrderBy(d => d.Id); VmDatas.Update(dataList, (s, v) => s.Id == v.Id); } } }