aboutsummaryrefslogtreecommitdiff
path: root/src/test/dtf/EmbeddedUI/SetupWizard.xaml.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/dtf/EmbeddedUI/SetupWizard.xaml.cs')
-rw-r--r--src/test/dtf/EmbeddedUI/SetupWizard.xaml.cs47
1 files changed, 46 insertions, 1 deletions
diff --git a/src/test/dtf/EmbeddedUI/SetupWizard.xaml.cs b/src/test/dtf/EmbeddedUI/SetupWizard.xaml.cs
index b846d61f..a4345481 100644
--- a/src/test/dtf/EmbeddedUI/SetupWizard.xaml.cs
+++ b/src/test/dtf/EmbeddedUI/SetupWizard.xaml.cs
@@ -16,19 +16,44 @@ namespace WixToolset.Samples.EmbeddedUI
16 using System.Windows.Shapes; 16 using System.Windows.Shapes;
17 using WixToolset.Dtf.WindowsInstaller; 17 using WixToolset.Dtf.WindowsInstaller;
18 18
19 public enum SetupOperationType
20 {
21 Install,
22 Repair,
23 Uninstall
24 }
25
19 /// <summary> 26 /// <summary>
20 /// Interaction logic for SetupWizard.xaml 27 /// Interaction logic for SetupWizard.xaml
21 /// </summary> 28 /// </summary>
22 public partial class SetupWizard : Window 29 public partial class SetupWizard : Window
23 { 30 {
31 private bool isMaintenance;
24 private ManualResetEvent installStartEvent; 32 private ManualResetEvent installStartEvent;
25 private InstallProgressCounter progressCounter; 33 private InstallProgressCounter progressCounter;
26 private bool canceled; 34 private bool canceled;
27 35
28 public SetupWizard(ManualResetEvent installStartEvent) 36 public SetupOperationType Operation { get; private set; }
37
38 public SetupWizard(ManualResetEvent installStartEvent, bool isMaintenance)
29 { 39 {
30 this.installStartEvent = installStartEvent; 40 this.installStartEvent = installStartEvent;
31 this.progressCounter = new InstallProgressCounter(0.5); 41 this.progressCounter = new InstallProgressCounter(0.5);
42 this.isMaintenance = isMaintenance;
43
44 this.Loaded += this.SetupWizard_Loaded;
45 }
46
47 private void SetupWizard_Loaded(object sender, RoutedEventArgs e)
48 {
49 this.Loaded -= this.SetupWizard_Loaded;
50
51 if (this.isMaintenance)
52 {
53 this.installButton.Visibility = Visibility.Hidden;
54 this.repairButton.Visibility = Visibility.Visible;
55 this.uninstallButton.Visibility = Visibility.Visible;
56 }
32 } 57 }
33 58
34 public MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord, 59 public MessageResult ProcessMessage(InstallMessage messageType, Record messageRecord,
@@ -82,7 +107,27 @@ namespace WixToolset.Samples.EmbeddedUI
82 107
83 private void installButton_Click(object sender, RoutedEventArgs e) 108 private void installButton_Click(object sender, RoutedEventArgs e)
84 { 109 {
110 this.Operation = SetupOperationType.Install;
111 this.StartInstall();
112 }
113
114 private void repairButton_Click(object sender, RoutedEventArgs e)
115 {
116 this.Operation = SetupOperationType.Repair;
117 this.StartInstall();
118 }
119
120 private void uninstallButton_Click(object sender, RoutedEventArgs e)
121 {
122 this.Operation = SetupOperationType.Uninstall;
123 this.StartInstall();
124 }
125
126 private void StartInstall()
127 {
85 this.installButton.Visibility = Visibility.Hidden; 128 this.installButton.Visibility = Visibility.Hidden;
129 this.repairButton.Visibility = Visibility.Hidden;
130 this.uninstallButton.Visibility = Visibility.Hidden;
86 this.progressBar.Visibility = Visibility.Visible; 131 this.progressBar.Visibility = Visibility.Visible;
87 this.progressLabel.Visibility = Visibility.Visible; 132 this.progressLabel.Visibility = Visibility.Visible;
88 this.installStartEvent.Set(); 133 this.installStartEvent.Set();