diff options
author | Rob Mensching <rob@firegiant.com> | 2022-03-31 11:56:14 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2022-03-31 18:01:06 -0700 |
commit | 47582b162368e8edf7a3b11c13b8e9dabc5f0a26 (patch) | |
tree | 2c4063eff325684bed39de0edacd7866a257ae02 /src/test/dtf/EmbeddedUI/SetupWizard.xaml.cs | |
parent | 167296c42497c4e95f0d5d71168542d747655981 (diff) | |
download | wix-47582b162368e8edf7a3b11c13b8e9dabc5f0a26.tar.gz wix-47582b162368e8edf7a3b11c13b8e9dabc5f0a26.tar.bz2 wix-47582b162368e8edf7a3b11c13b8e9dabc5f0a26.zip |
Provide managed CA and Embedded UI DTF libraries via NuGet
Lots of refactoring to bring the SFX tooling back into the 'dtf'
layer since they are (in the end) tightly coupled to some DTF
assemblies. Also refactored the DTF tests into their own folder
and added a couple integration tests to build using the new CA/UI
NuGet package.
Closes wixtoolset/issues#6080
Diffstat (limited to 'src/test/dtf/EmbeddedUI/SetupWizard.xaml.cs')
-rw-r--r-- | src/test/dtf/EmbeddedUI/SetupWizard.xaml.cs | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/src/test/dtf/EmbeddedUI/SetupWizard.xaml.cs b/src/test/dtf/EmbeddedUI/SetupWizard.xaml.cs new file mode 100644 index 00000000..b846d61f --- /dev/null +++ b/src/test/dtf/EmbeddedUI/SetupWizard.xaml.cs | |||
@@ -0,0 +1,109 @@ | |||
1 | namespace WixToolset.Samples.EmbeddedUI | ||
2 | { | ||
3 | using System; | ||
4 | using System.Collections.Generic; | ||
5 | using System.Linq; | ||
6 | using System.Text; | ||
7 | using System.Threading; | ||
8 | using System.Windows; | ||
9 | using System.Windows.Controls; | ||
10 | using System.Windows.Data; | ||
11 | using System.Windows.Documents; | ||
12 | using System.Windows.Input; | ||
13 | using System.Windows.Media; | ||
14 | using System.Windows.Media.Imaging; | ||
15 | using System.Windows.Navigation; | ||
16 | using System.Windows.Shapes; | ||
17 | using WixToolset.Dtf.WindowsInstaller; | ||
18 | |||
19 | /// <summary> | ||
20 | /// Interaction logic for SetupWizard.xaml | ||
21 | /// </summary> | ||
22 | public partial class SetupWizard : Window | ||
23 | { | ||
24 | private ManualResetEvent installStartEvent; | ||
25 | private InstallProgressCounter progressCounter; | ||
26 | private bool canceled; | ||
27 | |||
28 | public SetupWizard(ManualResetEvent installStartEvent) | ||
29 | { | ||
30 | this.installStartEvent = installStartEvent; | ||
31 | this.progressCounter = new InstallProgressCounter(0.5); | ||
32 | } | ||
33 | |||
34 | public MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, | ||
35 | MessageButtons buttons, MessageIcon icon, MessageDefaultButton defaultButton) | ||
36 | { | ||
37 | try | ||
38 | { | ||
39 | this.progressCounter.ProcessMessage(messageType, messageRecord); | ||
40 | this.progressBar.Value = this.progressBar.Minimum + | ||
41 | this.progressCounter.Progress * (this.progressBar.Maximum - this.progressBar.Minimum); | ||
42 | this.progressLabel.Content = "" + (int) Math.Round(100 * this.progressCounter.Progress) + "%"; | ||
43 | |||
44 | switch (messageType) | ||
45 | { | ||
46 | case InstallMessage.Error: | ||
47 | case InstallMessage.Warning: | ||
48 | case InstallMessage.Info: | ||
49 | string message = String.Format("{0}: {1}", messageType, messageRecord); | ||
50 | this.LogMessage(message); | ||
51 | break; | ||
52 | } | ||
53 | |||
54 | if (this.canceled) | ||
55 | { | ||
56 | this.canceled = false; | ||
57 | return MessageResult.Cancel; | ||
58 | } | ||
59 | } | ||
60 | catch (Exception ex) | ||
61 | { | ||
62 | this.LogMessage(ex.ToString()); | ||
63 | this.LogMessage(ex.StackTrace); | ||
64 | } | ||
65 | |||
66 | return MessageResult.OK; | ||
67 | } | ||
68 | |||
69 | private void LogMessage(string message) | ||
70 | { | ||
71 | this.messagesTextBox.Text += Environment.NewLine + message; | ||
72 | this.messagesTextBox.ScrollToEnd(); | ||
73 | } | ||
74 | |||
75 | internal void EnableExit() | ||
76 | { | ||
77 | this.progressBar.Visibility = Visibility.Hidden; | ||
78 | this.progressLabel.Visibility = Visibility.Hidden; | ||
79 | this.cancelButton.Visibility = Visibility.Hidden; | ||
80 | this.exitButton.Visibility = Visibility.Visible; | ||
81 | } | ||
82 | |||
83 | private void installButton_Click(object sender, RoutedEventArgs e) | ||
84 | { | ||
85 | this.installButton.Visibility = Visibility.Hidden; | ||
86 | this.progressBar.Visibility = Visibility.Visible; | ||
87 | this.progressLabel.Visibility = Visibility.Visible; | ||
88 | this.installStartEvent.Set(); | ||
89 | } | ||
90 | |||
91 | private void exitButton_Click(object sender, RoutedEventArgs e) | ||
92 | { | ||
93 | this.Close(); | ||
94 | } | ||
95 | |||
96 | private void cancelButton_Click(object sender, RoutedEventArgs e) | ||
97 | { | ||
98 | if (this.installButton.Visibility == Visibility.Visible) | ||
99 | { | ||
100 | this.Close(); | ||
101 | } | ||
102 | else | ||
103 | { | ||
104 | this.canceled = true; | ||
105 | this.cancelButton.IsEnabled = false; | ||
106 | } | ||
107 | } | ||
108 | } | ||
109 | } | ||