1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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<string, BitmapSource> Icons { get; private set; }
public ObservableCollection<ListItem> Items { get; } = new ObservableCollection<ListItem>();
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 });
}
}
}
}