using GalaSoft.MvvmLight.Command; using Install.Core.Common; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Media.Imaging; using System.Windows.Navigation; using Update.Core; namespace Update.View { public class PgUpdateVm : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; public Dictionary Icons { get; private set; } public ObservableCollection Items { get; } = new ObservableCollection(); public RelayCommand DownloadCmd { get; private set; } InstallWizard installWizard; public InstallWizard InstallWizard => installWizard; public PgUpdateVm() { DownloadCmd = new RelayCommand(Download); } private void Download() { //打开 下载进度界面 WdDownload w = new WdDownload(); w.Init(); w.ShowDialog(); } public void Init() { installWizard = Application.Current.Properties[nameof(InstallWizard)] as InstallWizard; Icons = installWizard.Icons; foreach (var installInfo in installWizard.HasInstalled) { Items.Add(new ListItem() { Item = installInfo, IsSelected = installInfo.NeedToUpdate }); } } } }