aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/test/dtf/EmbeddedUI/AssemblyInfo.cs3
-rw-r--r--src/test/dtf/EmbeddedUI/EmbeddedUI.config10
-rw-r--r--src/test/dtf/EmbeddedUI/EmbeddedUI.csproj43
-rw-r--r--src/test/dtf/EmbeddedUI/SampleEmbeddedUI.cs19
-rw-r--r--src/test/dtf/EmbeddedUI/SetupWizard.xaml2
-rw-r--r--src/test/dtf/EmbeddedUI/SetupWizard.xaml.cs47
-rw-r--r--src/test/dtf/SampleCA/CustomAction.config10
-rw-r--r--src/test/dtf/SampleCA/SampleCA.csproj8
-rw-r--r--src/test/dtf/SampleCA/testsub/testfile.txt1
9 files changed, 100 insertions, 43 deletions
diff --git a/src/test/dtf/EmbeddedUI/AssemblyInfo.cs b/src/test/dtf/EmbeddedUI/AssemblyInfo.cs
deleted file mode 100644
index 27aeb535..00000000
--- a/src/test/dtf/EmbeddedUI/AssemblyInfo.cs
+++ /dev/null
@@ -1,3 +0,0 @@
1using System.Reflection;
2
3[assembly: AssemblyDescription("Sample managed embedded external UI")]
diff --git a/src/test/dtf/EmbeddedUI/EmbeddedUI.config b/src/test/dtf/EmbeddedUI/EmbeddedUI.config
new file mode 100644
index 00000000..700aff6f
--- /dev/null
+++ b/src/test/dtf/EmbeddedUI/EmbeddedUI.config
@@ -0,0 +1,10 @@
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
5<configuration>
6 <startup useLegacyV2RuntimeActivationPolicy="true">
7 <supportedRuntime version="v4.0" />
8 <supportedRuntime version="v2.0.50727" />
9 </startup>
10</configuration>
diff --git a/src/test/dtf/EmbeddedUI/EmbeddedUI.csproj b/src/test/dtf/EmbeddedUI/EmbeddedUI.csproj
index 9f745a19..a6339220 100644
--- a/src/test/dtf/EmbeddedUI/EmbeddedUI.csproj
+++ b/src/test/dtf/EmbeddedUI/EmbeddedUI.csproj
@@ -1,49 +1,24 @@
1<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 1<Project Sdk="Microsoft.NET.Sdk">
2 <PropertyGroup> 2 <PropertyGroup>
3 <ProjectGuid>{864B8C50-7895-4485-AC89-900D86FD8C0D}</ProjectGuid> 3 <TargetFramework>net35</TargetFramework>
4 <OutputType>Library</OutputType> 4 <Description>Sample managed embedded external UI</Description>
5 <RootNamespace>WixToolset.Samples.EmbeddedUI</RootNamespace> 5 <UseWPF>true</UseWPF>
6 <AssemblyName>WixToolset.Samples.EmbeddedUI</AssemblyName>
7 <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
8 <FileAlignment>512</FileAlignment>
9 </PropertyGroup> 6 </PropertyGroup>
10 7
11 <ItemGroup> 8 <ItemGroup>
12 <Compile Include="AssemblyInfo.cs" /> 9 <Content Include="EmbeddedUI.config" CopyToOutputDirectory="PreserveNewest" />
13 <Compile Include="InstallProgressCounter.cs" />
14 <Compile Include="SampleEmbeddedUI.cs" />
15 <Compile Include="SetupWizard.xaml.cs">
16 <DependentUpon>SetupWizard.xaml</DependentUpon>
17 </Compile>
18 </ItemGroup> 10 </ItemGroup>
19 11
20 <ItemGroup> 12 <ItemGroup>
21 <Page Include="SetupWizard.xaml"> 13 <Reference Include="PresentationCore" />
22 <Generator>MSBuild:Compile</Generator> 14 <Reference Include="PresentationFramework" />
23 <SubType>Designer</SubType>
24 </Page>
25 </ItemGroup>
26
27 <ItemGroup>
28 <Reference Include="PresentationCore">
29 <RequiredTargetFramework>3.0</RequiredTargetFramework>
30 </Reference>
31 <Reference Include="PresentationFramework">
32 <RequiredTargetFramework>3.0</RequiredTargetFramework>
33 </Reference>
34 <Reference Include="System" /> 15 <Reference Include="System" />
35 <Reference Include="System.Core"> 16 <Reference Include="System.Core" />
36 <RequiredTargetFramework>3.5</RequiredTargetFramework>
37 </Reference>
38 <Reference Include="System.Xml" /> 17 <Reference Include="System.Xml" />
39 <Reference Include="WindowsBase"> 18 <Reference Include="WindowsBase" />
40 <RequiredTargetFramework>3.0</RequiredTargetFramework>
41 </Reference>
42 </ItemGroup> 19 </ItemGroup>
43 20
44 <ItemGroup> 21 <ItemGroup>
45 <PackageReference Include="WixToolset.Dtf.CustomAction" /> 22 <PackageReference Include="WixToolset.Dtf.CustomAction" />
46 </ItemGroup> 23 </ItemGroup>
47
48 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
49</Project> 24</Project>
diff --git a/src/test/dtf/EmbeddedUI/SampleEmbeddedUI.cs b/src/test/dtf/EmbeddedUI/SampleEmbeddedUI.cs
index b9cd213a..ae86dc97 100644
--- a/src/test/dtf/EmbeddedUI/SampleEmbeddedUI.cs
+++ b/src/test/dtf/EmbeddedUI/SampleEmbeddedUI.cs
@@ -11,6 +11,7 @@ namespace WixToolset.Samples.EmbeddedUI
11 11
12 public class SampleEmbeddedUI : IEmbeddedUI 12 public class SampleEmbeddedUI : IEmbeddedUI
13 { 13 {
14 private bool isMaintenance;
14 private Thread appThread; 15 private Thread appThread;
15 private Application app; 16 private Application app;
16 private SetupWizard setupWizard; 17 private SetupWizard setupWizard;
@@ -46,11 +47,11 @@ namespace WixToolset.Samples.EmbeddedUI
46 47
47 if (String.Equals(session["REMOVE"], "All", StringComparison.OrdinalIgnoreCase)) 48 if (String.Equals(session["REMOVE"], "All", StringComparison.OrdinalIgnoreCase))
48 { 49 {
49 // Don't show custom UI when uninstalling. 50 // Don't show custom UI when uninstall was specified on the command line.
50 return false; 51 return false;
51
52 // An embedded UI could display an uninstall wizard, it's just not imlemented here.
53 } 52 }
53
54 this.isMaintenance = session.EvaluateCondition("Installed");
54 } 55 }
55 56
56 // Start the setup wizard on a separate thread. 57 // Start the setup wizard on a separate thread.
@@ -69,6 +70,16 @@ namespace WixToolset.Samples.EmbeddedUI
69 } 70 }
70 else 71 else
71 { 72 {
73 switch (this.setupWizard.Operation)
74 {
75 case SetupOperationType.Repair:
76 session["REINSTALL"] = "ALL";
77 break;
78 case SetupOperationType.Uninstall:
79 session["REMOVE"] = "ALL";
80 break;
81 }
82
72 // Start the installation with a silenced internal UI. 83 // Start the installation with a silenced internal UI.
73 // This "embedded external UI" will handle message types except for source resolution. 84 // This "embedded external UI" will handle message types except for source resolution.
74 internalUILevel = InstallUIOptions.NoChange | InstallUIOptions.SourceResolutionOnly; 85 internalUILevel = InstallUIOptions.NoChange | InstallUIOptions.SourceResolutionOnly;
@@ -121,7 +132,7 @@ namespace WixToolset.Samples.EmbeddedUI
121 private void Run() 132 private void Run()
122 { 133 {
123 this.app = new Application(); 134 this.app = new Application();
124 this.setupWizard = new SetupWizard(this.installStartEvent); 135 this.setupWizard = new SetupWizard(this.installStartEvent, this.isMaintenance);
125 this.setupWizard.InitializeComponent(); 136 this.setupWizard.InitializeComponent();
126 this.app.Run(this.setupWizard); 137 this.app.Run(this.setupWizard);
127 this.installExitEvent.Set(); 138 this.installExitEvent.Set();
diff --git a/src/test/dtf/EmbeddedUI/SetupWizard.xaml b/src/test/dtf/EmbeddedUI/SetupWizard.xaml
index 9fd493a7..97e406c2 100644
--- a/src/test/dtf/EmbeddedUI/SetupWizard.xaml
+++ b/src/test/dtf/EmbeddedUI/SetupWizard.xaml
@@ -8,6 +8,8 @@
8 Title="Sample Embedded UI" Height="400" Width="540" Visibility="Visible"> 8 Title="Sample Embedded UI" Height="400" Width="540" Visibility="Visible">
9 <Grid> 9 <Grid>
10 <TextBox Margin="8,8,8,63" Name="messagesTextBox" IsReadOnly="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Auto" FontFamily="Lucida Console" FontSize="10" /> 10 <TextBox Margin="8,8,8,63" Name="messagesTextBox" IsReadOnly="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Auto" FontFamily="Lucida Console" FontSize="10" />
11 <Button Height="23" HorizontalAlignment="Left" Name="repairButton" VerticalAlignment="Bottom" Width="75" Visibility="Hidden" Click="repairButton_Click" Margin="8,0,0,8">Repair</Button>
12 <Button Height="23" HorizontalAlignment="Left" Name="uninstallButton" VerticalAlignment="Bottom" Width="75" Visibility="Hidden" Click="uninstallButton_Click" Margin="91,0,0,8">Uninstall</Button>
11 <Button Height="23" HorizontalAlignment="Right" Name="installButton" VerticalAlignment="Bottom" Width="75" Click="installButton_Click" Margin="0,0,91,8">Install</Button> 13 <Button Height="23" HorizontalAlignment="Right" Name="installButton" VerticalAlignment="Bottom" Width="75" Click="installButton_Click" Margin="0,0,91,8">Install</Button>
12 <Button Height="23" HorizontalAlignment="Right" Name="exitButton" VerticalAlignment="Bottom" Width="75" Visibility="Hidden" Click="exitButton_Click" Margin="0,0,8,8">Exit</Button> 14 <Button Height="23" HorizontalAlignment="Right" Name="exitButton" VerticalAlignment="Bottom" Width="75" Visibility="Hidden" Click="exitButton_Click" Margin="0,0,8,8">Exit</Button>
13 <Button Height="23" Margin="0,0,8,8" Name="cancelButton" VerticalAlignment="Bottom" Width="75" HorizontalAlignment="Right" Click="cancelButton_Click">Cancel</Button> 15 <Button Height="23" Margin="0,0,8,8" Name="cancelButton" VerticalAlignment="Bottom" Width="75" HorizontalAlignment="Right" Click="cancelButton_Click">Cancel</Button>
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();
diff --git a/src/test/dtf/SampleCA/CustomAction.config b/src/test/dtf/SampleCA/CustomAction.config
new file mode 100644
index 00000000..700aff6f
--- /dev/null
+++ b/src/test/dtf/SampleCA/CustomAction.config
@@ -0,0 +1,10 @@
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
5<configuration>
6 <startup useLegacyV2RuntimeActivationPolicy="true">
7 <supportedRuntime version="v4.0" />
8 <supportedRuntime version="v2.0.50727" />
9 </startup>
10</configuration>
diff --git a/src/test/dtf/SampleCA/SampleCA.csproj b/src/test/dtf/SampleCA/SampleCA.csproj
index fb6d8dca..866b7575 100644
--- a/src/test/dtf/SampleCA/SampleCA.csproj
+++ b/src/test/dtf/SampleCA/SampleCA.csproj
@@ -1,10 +1,16 @@
1<Project Sdk="Microsoft.NET.Sdk"> 1<Project Sdk="Microsoft.NET.Sdk">
2 <PropertyGroup> 2 <PropertyGroup>
3 <TargetFramework>net472</TargetFramework> 3 <TargetFramework>net20</TargetFramework>
4 <Description>Sample managed custom actions</Description> 4 <Description>Sample managed custom actions</Description>
5 </PropertyGroup> 5 </PropertyGroup>
6 6
7 <ItemGroup> 7 <ItemGroup>
8 <Content Include="CustomAction.config" CopyToOutputDirectory="PreserveNewest" />
9 <None Include="testsub\testfile.txt" CopyToOutputDirectory="PreserveNewest" />
10 <CustomActionContents Include="testsub\SampleCAs.cs=$(OutputDirectory)testsub\testfile.txt" />
11 </ItemGroup>
12
13 <ItemGroup>
8 <PackageReference Include="WixToolset.Dtf.CustomAction" /> 14 <PackageReference Include="WixToolset.Dtf.CustomAction" />
9 </ItemGroup> 15 </ItemGroup>
10</Project> 16</Project>
diff --git a/src/test/dtf/SampleCA/testsub/testfile.txt b/src/test/dtf/SampleCA/testsub/testfile.txt
new file mode 100644
index 00000000..8056aefd
--- /dev/null
+++ b/src/test/dtf/SampleCA/testsub/testfile.txt
@@ -0,0 +1 @@
test file for testing subdirectory support and binary stream reading