-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrerequisite.cpp
More file actions
266 lines (216 loc) · 6.05 KB
/
Prerequisite.cpp
File metadata and controls
266 lines (216 loc) · 6.05 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
#include "stdafx.h"
#include "Prerequisite.h"
#if __has_include("Prerequisite.g.cpp")
#include "Prerequisite.g.cpp"
#endif
using namespace winrt;
using namespace Microsoft::UI::Xaml;
using namespace Microsoft::UI::Xaml::Media;
namespace
{
constexpr const wchar_t * const kInstalledProp = L"Installed";
constexpr const wchar_t * const kTitleProp = L"Title";
constexpr const wchar_t * const kDescriptionProp = L"Description";
constexpr const wchar_t * const kPublisherProp = L"Publisher";
constexpr const wchar_t * const kCategoryProp = L"Category";
constexpr const wchar_t * const kAdditionalTermsProp = L"AdditionalTerms";
constexpr const wchar_t * const kCurrentActionProp = L"CurrentAction";
constexpr const wchar_t * const kProgressValueProp = L"ProgressValue";
constexpr const wchar_t * const kProgressRangeProp = L"TotalRange";
constexpr const wchar_t * const kInstallInProgressProp = L"InstallInProgress";
constexpr const wchar_t * const kDownloadInProgressProp = L"DownloadInProgress";
constexpr const wchar_t * const kWaitingForInstallProp = L"WaitingForInstall";
constexpr const wchar_t * const kHasOpenPathProp = L"HasOpenPath";
} // namespace
namespace winrt::SuiteInstaller::implementation
{
Prerequisite::Prerequisite(
hstring aId,
hstring aTitle,
hstring aDescription,
hstring aPublisher,
hstring aCategory,
hstring aAdditionalInformation,
bool aInstalled,
Imaging::BitmapImage aIcon,
Windows::Foundation::Collections::IObservableVector<Imaging::BitmapImage> aImages)
: mId(aId)
, mTitle(aTitle)
, mDescription(aDescription)
, mPublisher(aPublisher)
, mCategory(aCategory)
, mAdditionalTerms(aAdditionalInformation)
, mInstalled(aInstalled)
, mIcon(aIcon)
, mImages(aImages)
, mHasOpenPath(false)
{
}
hstring Prerequisite::Id() const
{
return mId;
}
hstring Prerequisite::Title() const
{
return mTitle;
}
void Prerequisite::Title(hstring const & aValue)
{
mTitle = aValue;
OnPropertyChanged(kTitleProp);
}
hstring Prerequisite::Description() const
{
return mDescription;
}
void Prerequisite::Description(hstring const & aValue)
{
mDescription = aValue;
OnPropertyChanged(kDescriptionProp);
}
hstring Prerequisite::Publisher() const
{
return mPublisher;
}
void Prerequisite::Publisher(hstring const & aValue)
{
mPublisher = aValue;
OnPropertyChanged(kPublisherProp);
}
hstring Prerequisite::Category() const
{
return mCategory;
}
void Prerequisite::Category(hstring const & aValue)
{
mCategory = aValue;
OnPropertyChanged(kCategoryProp);
}
hstring Prerequisite::AdditionalTerms() const
{
return mAdditionalTerms;
}
void Prerequisite::AdditionalTerms(hstring const & aValue)
{
mAdditionalTerms = aValue;
OnPropertyChanged(kAdditionalTermsProp);
}
bool Prerequisite::Installed()
{
return mInstalled;
}
void Prerequisite::Installed(bool aInstalled)
{
mInstalled = aInstalled;
OnPropertyChanged(kInstalledProp);
}
hstring Prerequisite::OpenPath() const
{
return mOpenPath;
}
void Prerequisite::OpenPath(hstring const & aValue)
{
mOpenPath = aValue;
HasOpenPath(!aValue.empty());
}
bool Prerequisite::HasOpenPath()
{
return mHasOpenPath;
}
void Prerequisite::HasOpenPath(bool aHasOpenPath)
{
mHasOpenPath = aHasOpenPath;
OnPropertyChanged(kHasOpenPathProp);
}
hstring Prerequisite::CurrentAction() const
{
return mCurrentAction;
}
void Prerequisite::CurrentAction(hstring const & aValue)
{
mCurrentAction = aValue;
OnPropertyChanged(kCurrentActionProp);
}
int Prerequisite::ProgressValue() const
{
return mProgressValue;
}
void Prerequisite::ProgressValue(int const & aValue)
{
mProgressValue = aValue;
OnPropertyChanged(kProgressValueProp);
}
int Prerequisite::TotalRange() const
{
return mTotalRange;
}
void Prerequisite::TotalRange(int const & aValue)
{
mTotalRange = aValue;
OnPropertyChanged(kProgressRangeProp);
}
bool Prerequisite::InstallInProgress()
{
return mInstallInProgress;
}
void Prerequisite::InstallInProgress(bool aInstallInProgress)
{
mInstallInProgress = aInstallInProgress;
OnPropertyChanged(kInstallInProgressProp);
}
bool Prerequisite::DownloadInProgress()
{
return mDownloadInProgress;
}
void Prerequisite::DownloadInProgress(bool aValue)
{
mDownloadInProgress = aValue;
OnPropertyChanged(kDownloadInProgressProp);
}
bool Prerequisite::WaitingForInstall()
{
return mWaitingForInstall || mInstalled;
}
void Prerequisite::WaitingForInstall(bool aWaitingForInstall)
{
mWaitingForInstall = aWaitingForInstall;
OnPropertyChanged(kWaitingForInstallProp);
}
void Prerequisite::ShowRemoveBtn(bool aShowRemoveBtn)
{
if (mShowRemoveBtn != aShowRemoveBtn)
{
mShowRemoveBtn = aShowRemoveBtn;
OnPropertyChanged(L"ShowRemoveBtn");
}
}
bool Prerequisite::ShowRemoveBtn()
{
return mShowRemoveBtn;
}
Windows::Foundation::Collections::IObservableVector<Imaging::BitmapImage> Prerequisite::Images()
{
return mImages;
}
Imaging::BitmapImage Prerequisite::Icon()
{
return mIcon;
}
winrt::Microsoft::UI::Xaml::Media::Imaging::BitmapImage Prerequisite::CarouselImage()
{
return *mImages.First();
}
winrt::event_token Prerequisite::PropertyChanged(
Microsoft::UI::Xaml::Data::PropertyChangedEventHandler const & aHandler)
{
return mPropertyChanged.add(aHandler);
}
void Prerequisite::PropertyChanged(winrt::event_token const & aToken)
{
mPropertyChanged.remove(aToken);
}
void Prerequisite::OnPropertyChanged(hstring aPropertyName)
{
mPropertyChanged(*this, Microsoft::UI::Xaml::Data::PropertyChangedEventArgs{ aPropertyName });
}
} // namespace winrt::SuiteInstaller::implementation