diff options
Diffstat (limited to '')
-rw-r--r-- | src/WixToolset.WixBA/RootView.xaml | 420 | ||||
-rw-r--r-- | src/WixToolset.WixBA/RootView.xaml.cs | 51 |
2 files changed, 471 insertions, 0 deletions
diff --git a/src/WixToolset.WixBA/RootView.xaml b/src/WixToolset.WixBA/RootView.xaml new file mode 100644 index 00000000..bbf2f9f2 --- /dev/null +++ b/src/WixToolset.WixBA/RootView.xaml | |||
@@ -0,0 +1,420 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" ?> | ||
2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
3 | |||
4 | <Window x:Class="WixToolset.UX.RootView" | ||
5 | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
6 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
7 | xmlns:ux="clr-namespace:WixToolset.UX" | ||
8 | MinWidth="550" | ||
9 | MinHeight="400" | ||
10 | Width="750" | ||
11 | Height="400" | ||
12 | AllowsTransparency="False" | ||
13 | Background="{x:Null}" | ||
14 | Closing="Window_Closing" | ||
15 | ResizeMode="CanResizeWithGrip" | ||
16 | WindowStartupLocation="CenterScreen" | ||
17 | WindowStyle="ThreeDBorderWindow"> | ||
18 | |||
19 | <Window.Resources> | ||
20 | <ResourceDictionary> | ||
21 | <ResourceDictionary.MergedDictionaries> | ||
22 | <ResourceDictionary Source="pack://application:,,,/WixBA;component/Styles.xaml" /> | ||
23 | </ResourceDictionary.MergedDictionaries> | ||
24 | </ResourceDictionary> | ||
25 | </Window.Resources> | ||
26 | |||
27 | <Border Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" | ||
28 | BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" | ||
29 | BorderThickness="0"> | ||
30 | |||
31 | <DockPanel x:Name="AppArtBoardArea" | ||
32 | Margin="20, 10"> | ||
33 | |||
34 | <DockPanel x:Name="ActionArea" | ||
35 | DockPanel.Dock="Bottom"> | ||
36 | |||
37 | <Grid x:Name="ActionGrid"> | ||
38 | <Grid.RowDefinitions> | ||
39 | <RowDefinition Height="Auto" /> | ||
40 | </Grid.RowDefinitions> | ||
41 | <Grid.ColumnDefinitions> | ||
42 | <ColumnDefinition Width="*" MinWidth="150" /> | ||
43 | <ColumnDefinition Width="Auto" /> | ||
44 | </Grid.ColumnDefinitions> | ||
45 | |||
46 | <StackPanel x:Name="LeftMarqueeDcIsland" | ||
47 | Grid.Column="0" | ||
48 | VerticalAlignment="Center" | ||
49 | DataContext="{Binding UpdateViewModel}"> | ||
50 | <ProgressBar x:Name="CheckingUpdatesProgress" | ||
51 | MinHeight="10" | ||
52 | IsIndeterminate="{Binding CheckingEnabled}" | ||
53 | Style="{DynamicResource UpdateMarqueeStyle}" | ||
54 | Visibility="{Binding CheckingEnabled, | ||
55 | Converter={StaticResource BooleanToVisibilityConverter}}" /> | ||
56 | </StackPanel> | ||
57 | |||
58 | <StackPanel x:Name="InitiateActionArea" | ||
59 | Grid.Column="1" | ||
60 | Margin="30, 0, 0, 0" | ||
61 | HorizontalAlignment="Right" | ||
62 | Orientation="Horizontal"> | ||
63 | <!-- Displayed from left to right, when ordered from top to bottom. Most preferred is at the top. --> | ||
64 | <StackPanel x:Name="UpdateBtnDcIsland" | ||
65 | DataContext="{Binding UpdateViewModel}" | ||
66 | Style="{DynamicResource ActionBtnStkPnlStyle}"> | ||
67 | <Button AutomationProperties.HelpText="An update is available. Click to get the update" | ||
68 | AutomationProperties.Name="Update" | ||
69 | Command="{Binding UpdateCommand}" | ||
70 | Content="Update" | ||
71 | Style="{DynamicResource ActionButtonStyle}" | ||
72 | Visibility="{Binding CanUpdate, | ||
73 | Converter={StaticResource BooleanToVisibilityConverter}}" /> | ||
74 | </StackPanel> | ||
75 | <StackPanel x:Name="InstallBtnDcIsland" | ||
76 | DataContext="{Binding InstallationViewModel}" | ||
77 | Style="{DynamicResource ActionBtnStkPnlStyle}"> | ||
78 | <Button AutomationProperties.HelpText="Click to accept license and install" | ||
79 | AutomationProperties.Name="Install" | ||
80 | Command="{Binding InstallCommand}" | ||
81 | Content="_Install" | ||
82 | IsDefault="True" | ||
83 | Style="{DynamicResource ActionButtonStyle}" | ||
84 | Visibility="{Binding InstallEnabled, | ||
85 | Converter={StaticResource BooleanToVisibilityConverter}}" /> | ||
86 | </StackPanel> | ||
87 | <StackPanel x:Name="RepairBtnDcIsland" | ||
88 | DataContext="{Binding InstallationViewModel}" | ||
89 | Style="{DynamicResource ActionBtnStkPnlStyle}"> | ||
90 | <Button x:Name="RepairButton" | ||
91 | AutomationProperties.HelpText="Click to Repair" | ||
92 | AutomationProperties.Name="Repair" | ||
93 | Command="{Binding RepairCommand}" | ||
94 | Content="Repair" | ||
95 | Style="{DynamicResource ActionButtonStyle}" | ||
96 | Visibility="{Binding RepairEnabled, | ||
97 | Converter={StaticResource BooleanToVisibilityConverter}}" /> | ||
98 | </StackPanel> | ||
99 | <StackPanel x:Name="UninstallBtnDcIsland" | ||
100 | DataContext="{Binding InstallationViewModel}" | ||
101 | Style="{DynamicResource ActionBtnStkPnlStyle}"> | ||
102 | <Button AutomationProperties.HelpText="Click to Uninstall" | ||
103 | AutomationProperties.Name="Uninstall" | ||
104 | Command="{Binding UninstallCommand}" | ||
105 | Content="Uninstall" | ||
106 | Style="{DynamicResource ActionButtonStyle}" | ||
107 | Visibility="{Binding UninstallEnabled, | ||
108 | Converter={StaticResource BooleanToVisibilityConverter}}" /> | ||
109 | </StackPanel> | ||
110 | <StackPanel x:Name="TryAgainBtnDcIsland" | ||
111 | DataContext="{Binding InstallationViewModel}" | ||
112 | Style="{DynamicResource ActionBtnStkPnlStyle}"> | ||
113 | <Button HorizontalAlignment="Center" | ||
114 | VerticalAlignment="Center" | ||
115 | AutomationProperties.HelpText="Click to try again" | ||
116 | AutomationProperties.Name="Try Again?" | ||
117 | Command="{Binding TryAgainCommand}" | ||
118 | Content="Try Again?" | ||
119 | Style="{DynamicResource ActionButtonStyle}" | ||
120 | Visibility="{Binding IsFailedCompletion, | ||
121 | Converter={StaticResource BooleanToVisibilityConverter}}" /> | ||
122 | </StackPanel> | ||
123 | |||
124 | <!-- Final Actions - only one of these is expected to be displayed, if any --> | ||
125 | <StackPanel x:Name="CloseBtnDcIsland" | ||
126 | HorizontalAlignment="Right" | ||
127 | DataContext="{Binding InstallationViewModel}" | ||
128 | Style="{DynamicResource ActionBtnStkPnlStyle}"> | ||
129 | <Button x:Name="CloseButton" | ||
130 | AutomationProperties.HelpText="Click to Close" | ||
131 | AutomationProperties.Name="Close" | ||
132 | Command="{Binding CloseCommand}" | ||
133 | Content="Close" | ||
134 | Style="{DynamicResource FinalActionButtonStyle}" | ||
135 | Visibility="{Binding IsSuccessfulCompletion, | ||
136 | Converter={StaticResource BooleanToVisibilityConverter}}" /> | ||
137 | </StackPanel> | ||
138 | <StackPanel x:Name="CancelBtnDcIsland" | ||
139 | HorizontalAlignment="Right" | ||
140 | DataContext="{Binding}" | ||
141 | Style="{DynamicResource ActionBtnStkPnlStyle}"> | ||
142 | <Button AutomationProperties.HelpText="Press to Cancel" | ||
143 | AutomationProperties.Name="Cancel" | ||
144 | Command="{Binding CancelCommand}" | ||
145 | Content="Cancel" | ||
146 | Style="{DynamicResource FinalActionButtonStyle}" | ||
147 | Visibility="{Binding CancelAvailable, | ||
148 | Converter={StaticResource BooleanToVisibilityConverter}}" /> | ||
149 | </StackPanel> | ||
150 | </StackPanel> | ||
151 | </Grid> | ||
152 | </DockPanel> | ||
153 | |||
154 | <StackPanel x:Name="FinalStatusArea" | ||
155 | DataContext="{Binding InstallationViewModel}" | ||
156 | HorizontalAlignment="Right" | ||
157 | Margin="0,10,0,20" | ||
158 | Orientation="Horizontal" | ||
159 | Visibility="{Binding IsComplete, | ||
160 | Converter={StaticResource BooleanToVisibilityConverter}}" | ||
161 | DockPanel.Dock="Bottom"> | ||
162 | <TextBlock x:Name="StatusTextBlk" | ||
163 | Style="{DynamicResource LabelTextBlkStyle}" | ||
164 | Text="{Binding StatusText, StringFormat={}{0}:}" | ||
165 | TextBlock.FontWeight="Bold" /> | ||
166 | <Button x:Name="ViewLogLink" | ||
167 | Margin="10,2,10,0" | ||
168 | Command="{Binding OpenLogCommand}" | ||
169 | Style="{StaticResource HyperlinkedButtonStyle}"> | ||
170 | <TextBlock> | ||
171 | <Hyperlink Command="{Binding OpenLogCommand}"><Run FontSize="{DynamicResource FontSizeButton}" Text="View Log" /></Hyperlink> | ||
172 | </TextBlock> | ||
173 | </Button> | ||
174 | <Button x:Name="ViewLogFolderLink" | ||
175 | Command="{Binding OpenLogFolderCommand}" | ||
176 | Style="{StaticResource HyperlinkedButtonStyle}"> | ||
177 | <TextBlock> | ||
178 | <Hyperlink Command="{Binding OpenLogFolderCommand}"><Run FontSize="{DynamicResource FontSizeButton}" Text="View Log Folder" /></Hyperlink> | ||
179 | </TextBlock> | ||
180 | </Button> | ||
181 | </StackPanel> | ||
182 | |||
183 | <StackPanel x:Name="StatusStkPnlDcIsland" | ||
184 | Margin="0,10" | ||
185 | DataContext="{Binding ProgressViewModel}" | ||
186 | DockPanel.Dock="Bottom"> | ||
187 | |||
188 | <StackPanel x:Name="ActionPackageNameTextStkPnl" | ||
189 | VerticalAlignment="Top"> | ||
190 | <TextBlock Style="{StaticResource StatusTextStyle}" | ||
191 | Text="{Binding Message}" | ||
192 | TextWrapping="WrapWithOverflow" | ||
193 | Visibility="{Binding ProgressEnabled, | ||
194 | Converter={StaticResource BooleanToVisibilityConverter}}" /> | ||
195 | </StackPanel> | ||
196 | |||
197 | <StackPanel x:Name="ActionProgressStkPnl" | ||
198 | Margin="0,5,0,0"> | ||
199 | <ProgressBar x:Name="ActionProgress" | ||
200 | Height="20" | ||
201 | VerticalAlignment="Center" | ||
202 | Style="{DynamicResource ActionProgressStyle}" | ||
203 | Visibility="{Binding ProgressEnabled, | ||
204 | Converter={StaticResource BooleanToVisibilityConverter}}" | ||
205 | Value="{Binding Progress}" /> | ||
206 | </StackPanel> | ||
207 | </StackPanel> | ||
208 | |||
209 | <StackPanel x:Name="TitleAndLogoStkPnl" | ||
210 | DockPanel.Dock="Top"> | ||
211 | <Grid x:Name="TitleGrid"> | ||
212 | <Grid.RowDefinitions> | ||
213 | <RowDefinition Height="Auto" /> | ||
214 | </Grid.RowDefinitions> | ||
215 | <Grid.ColumnDefinitions> | ||
216 | <ColumnDefinition Width="Auto" /> | ||
217 | <ColumnDefinition Width="*" /> | ||
218 | <ColumnDefinition Width="Auto" /> | ||
219 | </Grid.ColumnDefinitions> | ||
220 | |||
221 | <TextBlock x:Name="TitleTextBlk" | ||
222 | Grid.Column="0" | ||
223 | Style="{DynamicResource TitleTextBlkStyle}" | ||
224 | Text="{Binding Title, | ||
225 | Mode=OneTime}" /> | ||
226 | <Image x:Name="Logo" | ||
227 | Grid.Column="2" | ||
228 | Style="{DynamicResource LogoStyle}"> | ||
229 | </Image> | ||
230 | </Grid> | ||
231 | </StackPanel> | ||
232 | |||
233 | <Grid x:Name="MainStkPnl"> | ||
234 | <Grid.RowDefinitions> | ||
235 | <RowDefinition Height="*" /> | ||
236 | <RowDefinition Height="Auto" /> | ||
237 | </Grid.RowDefinitions> | ||
238 | <Grid.ColumnDefinitions> | ||
239 | <ColumnDefinition Width="Auto" /> | ||
240 | <ColumnDefinition Width="1*" /> | ||
241 | <ColumnDefinition Width="4*" MinWidth="200" /> | ||
242 | </Grid.ColumnDefinitions> | ||
243 | |||
244 | <Grid x:Name="SkuInfo" | ||
245 | Grid.Column="0" | ||
246 | Grid.Row="0" | ||
247 | DataContext="{Binding InstallationViewModel}"> | ||
248 | <Grid.RowDefinitions> | ||
249 | <RowDefinition Height="Auto" /> | ||
250 | <RowDefinition Height="Auto" /> | ||
251 | <RowDefinition Height="Auto" /> | ||
252 | <RowDefinition Height="Auto" /> | ||
253 | <RowDefinition Height="Auto" /> | ||
254 | <RowDefinition Height="Auto" /> | ||
255 | <RowDefinition Height="Auto" /> | ||
256 | </Grid.RowDefinitions> | ||
257 | <Grid.ColumnDefinitions> | ||
258 | <ColumnDefinition Width="Auto" /> | ||
259 | <ColumnDefinition Width="*" /> | ||
260 | </Grid.ColumnDefinitions> | ||
261 | |||
262 | <TextBlock x:Name="SkuPublisherLabel" | ||
263 | Grid.Row="0" | ||
264 | Grid.Column="0" | ||
265 | Style="{DynamicResource LabelTextBlkStyle}" | ||
266 | Text="Publisher:" /> | ||
267 | <TextBlock x:Name="SkuPublisherData" | ||
268 | Grid.Row="0" | ||
269 | Grid.Column="1" | ||
270 | Style="{DynamicResource DataTextBlkStyle}" | ||
271 | Text="{Binding Publisher, | ||
272 | Mode=OneTime}" /> | ||
273 | |||
274 | <TextBlock x:Name="SkuVersionLabel" | ||
275 | Grid.Row="1" | ||
276 | Grid.Column="0" | ||
277 | Style="{DynamicResource LabelTextBlkStyle}" | ||
278 | Text="Version:" /> | ||
279 | <TextBlock Grid.Row="1" | ||
280 | Grid.Column="1" | ||
281 | Style="{DynamicResource DataTextBlkStyle}" | ||
282 | Text="{Binding Version}" /> | ||
283 | |||
284 | <TextBlock x:Name="SkuLicenseLabel" | ||
285 | Grid.Row="2" | ||
286 | Grid.Column="0" | ||
287 | Style="{DynamicResource LabelTextBlkStyle}" | ||
288 | Text="License:" /> | ||
289 | <Button x:Name="SkuLicenseBtn" | ||
290 | Grid.Row="2" | ||
291 | Grid.Column="1" | ||
292 | HorizontalAlignment="Left" | ||
293 | AutomationProperties.HelpText="View the license" | ||
294 | AutomationProperties.Name="License" | ||
295 | Command="{Binding LicenseCommand}" | ||
296 | KeyboardNavigation.IsTabStop="False" | ||
297 | Style="{StaticResource HyperlinkedButtonStyle}"> | ||
298 | <TextBlock HorizontalAlignment="Left"> | ||
299 | <Hyperlink Command="{Binding LicenseCommand}" | ||
300 | IsEnabled="True" | ||
301 | KeyboardNavigation.IsTabStop="False"><Run FontSize="{DynamicResource FontSizeButton}" Text="View License" /></Hyperlink> | ||
302 | </TextBlock> | ||
303 | </Button> | ||
304 | |||
305 | <TextBlock x:Name="SkuNewsLabel" | ||
306 | Grid.Row="3" | ||
307 | Grid.Column="0" | ||
308 | Style="{DynamicResource LabelTextBlkStyle}" | ||
309 | Text="News:" /> | ||
310 | <Button x:Name="SkuNewsBtn" | ||
311 | Grid.Row="3" | ||
312 | Grid.Column="1" | ||
313 | HorizontalAlignment="Left" | ||
314 | AutomationProperties.HelpText="Latest News" | ||
315 | AutomationProperties.Name="News" | ||
316 | Command="{Binding LaunchNewsCommand}" | ||
317 | KeyboardNavigation.IsTabStop="False" | ||
318 | Style="{StaticResource HyperlinkedButtonStyle}"> | ||
319 | <TextBlock HorizontalAlignment="Left"> | ||
320 | <Hyperlink Command="{Binding LaunchNewsCommand}" | ||
321 | IsEnabled="True" | ||
322 | KeyboardNavigation.IsTabStop="False"><Run FontSize="{DynamicResource FontSizeButton}" Text="Latest News" /></Hyperlink> | ||
323 | </TextBlock> | ||
324 | </Button> | ||
325 | |||
326 | <TextBlock x:Name="SkuSupportLabel" | ||
327 | Grid.Row="4" | ||
328 | Grid.Column="0" | ||
329 | Style="{DynamicResource LabelTextBlkStyle}" | ||
330 | Text="Support:" /> | ||
331 | <Button x:Name="SkuSupportBtn" | ||
332 | Grid.Row="4" | ||
333 | Grid.Column="1" | ||
334 | HorizontalAlignment="Left" | ||
335 | AutomationProperties.HelpText="View Home Page for Support" | ||
336 | AutomationProperties.Name="Home Page" | ||
337 | Command="{Binding LaunchHomePageCommand}" | ||
338 | KeyboardNavigation.IsTabStop="False" | ||
339 | Style="{StaticResource HyperlinkedButtonStyle}"> | ||
340 | <TextBlock HorizontalAlignment="Left"> | ||
341 | <Hyperlink Command="{Binding LaunchHomePageCommand}" | ||
342 | IsEnabled="True" | ||
343 | KeyboardNavigation.IsTabStop="False"><Run FontSize="{DynamicResource FontSizeButton}" Text="{Binding SupportUrl, Mode=OneTime}" /></Hyperlink> | ||
344 | </TextBlock> | ||
345 | </Button> | ||
346 | |||
347 | <TextBlock x:Name="SkuVSExtensionLabel1" | ||
348 | Grid.Row="5" | ||
349 | Grid.Column="0" | ||
350 | Style="{DynamicResource LabelTextBlkStyle}" | ||
351 | Text="Visual Studio" /> | ||
352 | <TextBlock x:Name="SkuVSExtensionLabel2" | ||
353 | Grid.Row="6" | ||
354 | Grid.Column="0" | ||
355 | Style="{DynamicResource LabelTextBlkStyle}" | ||
356 | Text="Extension:" /> | ||
357 | <Button x:Name="SkuVSExtensionBtn" | ||
358 | Grid.Row="6" | ||
359 | Grid.Column="1" | ||
360 | HorizontalAlignment="Left" | ||
361 | AutomationProperties.HelpText="View Releases Page for VS Extension" | ||
362 | AutomationProperties.Name="Releases Page" | ||
363 | Command="{Binding LaunchVSExtensionPageCommand}" | ||
364 | KeyboardNavigation.IsTabStop="False" | ||
365 | Style="{StaticResource HyperlinkedButtonStyle}"> | ||
366 | <TextBlock HorizontalAlignment="Left"> | ||
367 | <Hyperlink Command="{Binding LaunchVSExtensionPageCommand}" | ||
368 | IsEnabled="True" | ||
369 | KeyboardNavigation.IsTabStop="False"><Run FontSize="{DynamicResource FontSizeButton}" Text="{Binding VSExtensionUrl, Mode=OneTime}" /></Hyperlink> | ||
370 | </TextBlock> | ||
371 | </Button> | ||
372 | </Grid> | ||
373 | |||
374 | <DockPanel x:Name="UpdateChangesStkPnlDcIsland" | ||
375 | Grid.Row="0" | ||
376 | Grid.Column="2" | ||
377 | DataContext="{Binding UpdateViewModel}" | ||
378 | Visibility="{Binding IsUpdateAvailable, | ||
379 | Converter={StaticResource BooleanToVisibilityConverter}}"> | ||
380 | |||
381 | <Grid x:Name="UpdateInfoGrid" | ||
382 | DockPanel.Dock="Top"> | ||
383 | <Grid.RowDefinitions> | ||
384 | <RowDefinition Height="Auto" /> | ||
385 | </Grid.RowDefinitions> | ||
386 | <Grid.ColumnDefinitions> | ||
387 | <ColumnDefinition Width="Auto" /> | ||
388 | <ColumnDefinition Width="*" /> | ||
389 | </Grid.ColumnDefinitions> | ||
390 | |||
391 | <TextBlock x:Name="UpdateTitleLabel" | ||
392 | Grid.Row="0" | ||
393 | Grid.Column="0" | ||
394 | Style="{DynamicResource LabelTextBlkStyle}" | ||
395 | Text="Available Update:" /> | ||
396 | |||
397 | <TextBlock x:Name="UpdateVersionLabel" | ||
398 | Grid.Row="0" | ||
399 | Grid.Column="1" | ||
400 | Style="{DynamicResource DataTextBlkStyle}" | ||
401 | Text="{Binding UpdateVersion}" /> | ||
402 | </Grid> | ||
403 | |||
404 | <WebBrowser DockPanel.Dock="Bottom" | ||
405 | ux:BrowserProperties.HtmlDoc="{Binding UpdateChanges}" /> | ||
406 | </DockPanel> | ||
407 | |||
408 | <TextBlock x:Name="DowngradeMessageTextBlk" | ||
409 | Grid.Row="1" | ||
410 | Grid.Column="0" | ||
411 | Grid.ColumnSpan="3" | ||
412 | DataContext="{Binding InstallationViewModel}" | ||
413 | Style="{DynamicResource LabelTextBlkStyle}" | ||
414 | Text="{Binding DowngradeMessage}" | ||
415 | Visibility="{Binding Downgrade, | ||
416 | Converter={StaticResource BooleanToVisibilityConverter}}" /> | ||
417 | </Grid> | ||
418 | </DockPanel> | ||
419 | </Border> | ||
420 | </Window> | ||
diff --git a/src/WixToolset.WixBA/RootView.xaml.cs b/src/WixToolset.WixBA/RootView.xaml.cs new file mode 100644 index 00000000..1d4301f2 --- /dev/null +++ b/src/WixToolset.WixBA/RootView.xaml.cs | |||
@@ -0,0 +1,51 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.UX | ||
4 | { | ||
5 | using System.ComponentModel; | ||
6 | using System.Windows; | ||
7 | using System.Windows.Interop; | ||
8 | |||
9 | /// <summary> | ||
10 | /// Interaction logic for View.xaml | ||
11 | /// </summary> | ||
12 | public partial class RootView : Window | ||
13 | { | ||
14 | /// <summary> | ||
15 | /// Creates the view populated with it's model. | ||
16 | /// </summary> | ||
17 | /// <param name="viewModel">Model for the view.</param> | ||
18 | public RootView(RootViewModel viewModel) | ||
19 | { | ||
20 | this.DataContext = viewModel; | ||
21 | |||
22 | this.Loaded += (sender, e) => WixBA.Model.Engine.CloseSplashScreen(); | ||
23 | this.Closed += (sender, e) => this.Dispatcher.InvokeShutdown(); // shutdown dispatcher when the window is closed. | ||
24 | |||
25 | this.InitializeComponent(); | ||
26 | |||
27 | viewModel.Dispatcher = this.Dispatcher; | ||
28 | viewModel.ViewWindowHandle = new WindowInteropHelper(this).EnsureHandle(); | ||
29 | } | ||
30 | |||
31 | /// <summary> | ||
32 | /// Event is fired when the window is closing. | ||
33 | /// </summary> | ||
34 | /// <param name="sender"></param> | ||
35 | /// <param name="e"></param> | ||
36 | private void Window_Closing(object sender, CancelEventArgs e) | ||
37 | { | ||
38 | RootViewModel rvm = this.DataContext as RootViewModel; | ||
39 | if ((null != rvm) && (InstallationState.Applying == rvm.InstallState)) | ||
40 | { | ||
41 | rvm.CancelButton_Click(); | ||
42 | if (rvm.Canceled) | ||
43 | { | ||
44 | // Defer closing until the engine has canceled processing. | ||
45 | e.Cancel = true; | ||
46 | rvm.AutoClose = true; | ||
47 | } | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | } | ||