Permalink
Browse files

Implemented install/repair/uninstall in the managed bootstrapper.

  • Loading branch information...
1 parent c06cdc0 commit 9699a003dfd6a4357a7915d3f8ec2f86c50ae4fd @distantcam committed Mar 2, 2012
View
Binary file not shown.
View
Binary file not shown.
View
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
+ <BinObj>$(ProjectDir)$(IntermediateOutputPath)</BinObj>
+ <FodyAssemblyPath>$(SolutionDir)Tools\Fody\Fody.dll</FodyAssemblyPath>
+ </PropertyGroup>
+ <UsingTask TaskName="Fody.WeavingTask" AssemblyFile="$(FodyAssemblyPath)" />
+ <Target AfterTargets="CopyFilesToOutputDirectory" Name="FodyTarget">
+ <Fody.WeavingTask AssemblyPath="$(TargetPath)" SolutionDir="$(SolutionDir)" ProjectPath="$(ProjectPath)" References="@(ReferencePath)" MessageImportance="Low"/>
+ <Copy SourceFiles="$(TargetPath)" DestinationFolder="$(BinObj)" />
+ <Copy SourceFiles="$(TargetDir)$(TargetName).pdb" DestinationFolder="$(BinObj)" Condition="Exists('$(TargetDir)$(TargetName).pdb')"/>
+ <Copy SourceFiles="$(TargetDir)$(TargetName).mdb" DestinationFolder="$(BinObj)" Condition="Exists('$(TargetDir)$(TargetName).mdb')"/>
+ </Target>
+</Project>
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
@@ -0,0 +1,41 @@
+using System;
+using System.Globalization;
+using System.Windows;
+
+namespace Analects.XAMLConverters
+{
+ public class BoolToVisibilityConverter : MarkupConverter
+ {
+ public bool Invert { get; set; }
+
+ protected override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ bool flag = false;
+ if (value is bool)
+ {
+ flag = (bool)value;
+ }
+ else
+ {
+ if (value is bool?)
+ {
+ bool? flag2 = (bool?)value;
+ flag = (flag2.HasValue && flag2.Value);
+ }
+ }
+ return (flag ^ Invert) ? Visibility.Visible : Visibility.Collapsed;
+ }
+
+ protected override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ bool result = false;
+
+ if (value is Visibility)
+ {
+ result = (Visibility)value == Visibility.Visible;
+ }
+
+ return result ^ Invert;
+ }
+ }
+}
@@ -0,0 +1,48 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Analects.XAMLConverters
+{
+ [MarkupExtensionReturnType(typeof(IValueConverter))]
+ public abstract class MarkupConverter : MarkupExtension, IValueConverter
+ {
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ return this;
+ }
+
+ protected abstract object Convert(object value, Type targetType, object parameter, CultureInfo culture);
+ protected abstract object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture);
+
+ #region IValueConverter Members
+
+ object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ try
+ {
+ return Convert(value, targetType, parameter, culture);
+ }
+ catch
+ {
+ return DependencyProperty.UnsetValue;
+ }
+ }
+
+ object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ try
+ {
+ return ConvertBack(value, targetType, parameter, culture);
+ }
+ catch
+ {
+ return DependencyProperty.UnsetValue;
+ }
+ }
+
+ #endregion
+ }
+}
@@ -0,0 +1,22 @@
+using System;
+using System.Globalization;
+using System.Windows;
+
+namespace Analects.XAMLConverters
+{
+ public class NullToVisibilityConverter : MarkupConverter
+ {
+ public bool Invert { get; set; }
+
+ protected override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ bool flag = value != null;
+ return (flag ^ Invert) ? Visibility.Visible : Visibility.Collapsed;
+ }
+
+ protected override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return value;
+ }
+ }
+}
@@ -0,0 +1,20 @@
+using System;
+
+namespace Analects.XAMLConverters
+{
+ public class ToLowerConverter : MarkupConverter
+ {
+ protected override object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ if (value is string)
+ return ((string)value).ToLower(culture);
+
+ return value;
+ }
+
+ protected override object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ return value;
+ }
+ }
+}
@@ -0,0 +1,20 @@
+using System;
+
+namespace Analects.XAMLConverters
+{
+ public class ToUpperConverter : MarkupConverter
+ {
+ protected override object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ if (value is string)
+ return ((string)value).ToUpper(culture);
+
+ return value;
+ }
+
+ protected override object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ return value;
+ }
+ }
+}
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<Weavers>
+ <PropertyChanged />
+</Weavers>
@@ -48,6 +48,9 @@
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
+ <Reference Include="PropertyChanged">
+ <HintPath>..\..\packages\PropertyChanged.Fody.1.11.0.0\Lib\NET\PropertyChanged.dll</HintPath>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
@@ -57,8 +60,15 @@
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
+ <None Include="FodyWeavers.xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Analects\XAMLConverters\BoolToVisibilityConverter.cs" />
+ <Compile Include="Analects\XAMLConverters\DebugConverter.cs" />
+ <Compile Include="Analects\XAMLConverters\MarkupConverter.cs" />
+ <Compile Include="Analects\XAMLConverters\NullToVisibilityConverter.cs" />
+ <Compile Include="Analects\XAMLConverters\ToLowerConverter.cs" />
+ <Compile Include="Analects\XAMLConverters\ToUpperConverter.cs" />
<Compile Include="CaliburnMicroBootstrapper.cs" />
<Compile Include="SampleBootstrapperApplication.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -86,4 +96,5 @@
<Target Name="AfterBuild">
</Target>
-->
+ <Import Project="$(SolutionDir)\Tools\Fody\Fody.targets" />
</Project>
@@ -1,13 +1,10 @@
using System.Windows;
-using Autofac;
using Microsoft.Tools.WindowsInstallerXml.Bootstrapper;
namespace SampleApp.BA
{
public class SampleBootstrapperApplication : BootstrapperApplication
{
- protected IContainer Container { get; private set; }
-
protected override void Run()
{
Application app = new Application();
@@ -1,12 +1,58 @@
-<Window x:Class="SampleApp.BA.ShellView"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
-
- <Grid Background="White">
- <TextBlock Text="Hello Caliburn Micro!"
- VerticalAlignment="Center"
- HorizontalAlignment="Center"
- FontSize="20" />
- </Grid>
+<Window
+ x:Class="SampleApp.BA.ShellView"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:converters="clr-namespace:Analects.XAMLConverters"
+ Width="600"
+ Height="200"
+>
+
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+
+ <Button
+ Grid.ColumnSpan="2"
+ x:Name="Install"
+ Content="install"
+ Visibility="{Binding CanInstall, Converter={converters:BoolToVisibilityConverter}}"
+ />
+
+ <Button
+ x:Name="Repair"
+ Content="repair"
+ Visibility="{Binding CanRepair, Converter={converters:BoolToVisibilityConverter}}"
+ />
+
+ <Button
+ Grid.Column="1"
+ x:Name="Uninstall"
+ Content="uninstall"
+ Visibility="{Binding CanUninstall, Converter={converters:BoolToVisibilityConverter}}"
+ />
+
+ <TextBlock
+ Grid.ColumnSpan="2"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center"
+ Text="Complete"
+ Visibility="{Binding CompleteEnabled, Converter={converters:BoolToVisibilityConverter}}"
+ />
+
+ <Button
+ Grid.ColumnSpan="2"
+ x:Name="TryAgain"
+ Content="Failed. Try again?"
+ Visibility="{Binding CanTryAgain, Converter={converters:BoolToVisibilityConverter}}"
+ />
+
+ <ProgressBar
+ Grid.ColumnSpan="2"
+ Value="{Binding Progress, Mode=OneWay}"
+ Visibility="{Binding ProgressEnabled, Converter={converters:BoolToVisibilityConverter}}"
+ />
+ </Grid>
</Window>
Oops, something went wrong.

0 comments on commit 9699a00

Please sign in to comment.