Hi,

I have an installer that will install either a client only, or both the
client and the server. The way I determine which one to install is by having
a custom ui with two check boxes. A variable is set and checked in the chain
to decide if one or both (client and server) is to be installed. When the ui
is started the the install button is disabled. 

What I need to have happen is when either of the check boxes is checked I
need the install button to enable. When the button is clicked I need to have
the install start.

The program is not currently listed in Programs and Features.

How do I enable the install button programmatically in C#?

*Bundle.wxs...*

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension";>
  <Bundle Copyright="Copyright© 2014, Guru Dental, LLC"
    Manufacturer="Guru Dental"
    Name="Guru"
    UpgradeCode="{00BA23D8-FB98-43CD-A8A5-CB019552B375}"
    Version="6.0.4">

    <BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
      <Payload SourceFile="\\SERVER\RedirectedFolders\gary.monk\My
Documents\Visual Studio 2013\Projects\Guru Install
Solution\GuruBA\bin\Debug\GuruBA.dll"/>
      <Payload SourceFile="\\SERVER\RedirectedFolders\gary.monk\My
Documents\Visual Studio 2013\Projects\Guru Install
Solution\GuruBA\bin\Debug\BootstrapperCore.config"/>
      <Payload SourceFile="\\SERVER\RedirectedFolders\gary.monk\My
Documents\Visual Studio 2013\Projects\Guru Install
Solution\GuruBA\bin\Debug\Microsoft.Practices.Prism.dll"/>
    </BootstrapperApplicationRef>

    <WixVariable Id="WixMbaPrereqPackageId" Value=""/>
    <WixVariable Id="WixMbaPrereqLicenseUrl" Value=""/>
    
    <Chain>
      <ExePackage Cache="no"
                  InstallCondition="InstallGuruServer"
                  Description="SQL Server and Guru Server Bundle"
                  Id="GuruSQLBundle"
                  SourceFile="\\SERVER\RedirectedFolders\gary.monk\My
Documents\Visual Studio 2013\Projects\Guru Install
Solution\GuruSQLBundle\bin\Debug\GuruSQLBundle.exe"/>
        
      <MsiPackage Cache="no"
                  InstallCondition="InstallGuruClient"
                  Description="Guru Client"
                  Id="GuruClient"
                  SourceFile="\\SERVER\RedirectedFolders\gary.monk\My
Documents\Visual Studio 2013\Projects\Guru Install
Solution\GuruClientInstall\bin\Debug\GuruClientInstall.msi" />
    </Chain>
  </Bundle>
</Wix>

*InstallView.xaml...*

<Window x:Name="GuruInstaller" x:Class="GuruBA.Views.InstallView"
            
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation";
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml";
            
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"; 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"; 
             mc:Ignorable="d" 
             d:DesignHeight="460" d:DesignWidth="700" ResizeMode="NoResize"
Height="460" Width="700" 
                Icon="\\SERVER\RedirectedFolders\gary.monk\My
Documents\Visual Studio 2013\Projects\Guru Install
Solution\GuruBA\Images\guru.ico">

    <Window.Resources>
        
        
        
        
    </Window.Resources>

    <Grid ShowGridLines="False">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
            <RowDefinition Height="40"/>
            <RowDefinition Height="12"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <StackPanel Grid.ColumnSpan="3" Margin="0,0,0,0"
Style="{StaticResource headerStyle}">
            <Border BorderBrush="#FF7FBA00" BorderThickness="2"
CornerRadius="8,8,3,3"/>
            <WrapPanel  Grid.Row="0" Grid.Column="0" Height="100" >
                <WrapPanel Margin="0,10,10,10">
                    <Image Width="30" Margin="10,0,0,0" 
                           Source="\\SERVER\RedirectedFolders\gary.monk\My
Documents\Visual Studio 2013\Projects\Guru Install
Solution\GuruBA\Images\guru.ico"/>
                </WrapPanel>
                <StackPanel Grid.Row="0" Grid.Column="0" Margin="0,5,0,0" >
                    <TextBlock Text="Guru Installer" VerticalAlignment="Top"
Style="{StaticResource headerBoldText}" />
                    <TextBlock Text="You have chosen to install this
software on your system" VerticalAlignment="Top" FontSize="14"
Foreground="White"/>
                </StackPanel>
            </WrapPanel>
            <Border BorderBrush="#FF7FBA00" BorderThickness="2"
CornerRadius="8,8,3,3"/>
        </StackPanel>
        <DockPanel Grid.Row="0" Grid.Column="3" LastChildFill="False">
            <Image Width="180" Height="48" DockPanel.Dock="Right"
VerticalAlignment="Bottom" Margin="0,0,0,5"
                                Source="\\SERVER\RedirectedFolders\gary.monk\My
Documents\Visual Studio 2013\Projects\Guru Install
Solution\GuruBA\Images\guru fax logo.png"/>
        </DockPanel>
        <DockPanel Grid.Row="1" Grid.Column="0" Style="{StaticResource
headerStyle}">
            <Grid>
                <TextBlock HorizontalAlignment="Center"
VerticalAlignment="Center" TextWrapping="Wrap" Margin="8,0,0,0"
Foreground="White" FontSize="13" FontWeight="Bold"
                       Text="Please call Guru if you encounter any problems
at (888) 331-4878"/>
                <Image Width="100" Height="48" VerticalAlignment="Bottom"
HorizontalAlignment="Center"
                                Source="\\SERVER\RedirectedFolders\gary.monk\My
Documents\Visual Studio 2013\Projects\Guru Install
Solution\GuruBA\Images\guru fax logo.png"/>
            </Grid>
        </DockPanel>
        <DockPanel Grid.Row="1" Grid.Column="1" Style="{StaticResource
installPanelStyle}">
            <Border BorderBrush="#FF7FBA00" BorderThickness="2"
CornerRadius="8,8,3,3"/>
            <Grid ShowGridLines="False">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <TextBlock Margin="5,5,5,5" HorizontalAlignment="Center"
VerticalAlignment="Center" TextWrapping="Wrap" Text="Guru Client Only"
FontSize="14" FontWeight="ExtraBold" Foreground="Green"/>
                <StackPanel Grid.Row="1">
                    <TextBlock Margin="5,5,5,5" VerticalAlignment="Center"
TextWrapping="Wrap" Text="Check this checkbox to install the Guru Client and
media components."/>
                    <TextBlock Margin="5,5,5,5" VerticalAlignment="Center"
TextWrapping="Wrap" Text="*Please note you will need the name or IP address
of the machine running the Guru Server." FontSize="9"/>
                </StackPanel>
                <CheckBox x:Name="cbInstallGuruClient" Grid.Row="2"
VerticalAlignment="Bottom" HorizontalAlignment="Center" FontFamily="Times
New Roman" Click="cbInstallGuruClient_Click">Install Guru Client</CheckBox>
            </Grid>
        </DockPanel>
        <DockPanel Grid.Row="1" Grid.Column="2" Style="{StaticResource
installPanelStyle}">
            <Border BorderBrush="#FF7FBA00" BorderThickness="2"
CornerRadius="8,8,3,3"/>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <TextBlock Margin="5,5,5,5" HorizontalAlignment="Center"
VerticalAlignment="Center" TextWrapping="Wrap" Text="Guru Client and Server"
FontSize="14" FontWeight="ExtraBold" Foreground="Green"/>
                <StackPanel Grid.Row="1">
                    <TextBlock Margin="5,5,5,5" VerticalAlignment="Center"
TextWrapping="Wrap" Text="Check this checkbox to install the Guru Client,
Server, Database, and media components."/>
                </StackPanel>
                <CheckBox x:Name="cbInstallClientServer" Grid.Row="2"
VerticalAlignment="Bottom" HorizontalAlignment="Center" FontFamily="Times
New Roman" Click="cbInstallClientServer_Click">Install Guru
Client/Server</CheckBox>
            </Grid>
        </DockPanel>
        <DockPanel Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2"
Margin="50,0,20,0">
            <Button x:Name="btnInstall" Width="100" Height="20"
Margin="0,0,20,0" Command="{Binding InstallCommand}">Install</Button>
            <Button x:Name="btnUninstall" Width="100" Height="20"
Command="{Binding UninstallCommand}">Uninstall</Button>
            <Button x:Name="btnCancel" Width="100" Height="20"
Command="{Binding CancelCommand}">Cancel</Button>
        </DockPanel>
        <WrapPanel Grid.Row="2" Margin="0,5,0,0">
            <Label VerticalAlignment="Center">Progress:</Label>
            <Label Content="{Binding Progress}" />
            <ProgressBar Grid.ColumnSpan="3" VerticalAlignment="Stretch"
Height="20" Value="{Binding Progress}" Minimum="0" Maximum="100"/>
        </WrapPanel>
        <StackPanel Grid.Row="3" Grid.ColumnSpan="3">
            <Label Content="{Binding Message}" />
        </StackPanel>
    </Grid>
</Window>

*InstallViewModel.cs...*

public InstallViewModel( BootstrapperApplicationModel model)
        {
            this.model = model;
            this.State = InstallState.Initialzing;

            this.WireUpEventHandlers();

            this.InstallCommand = new DelegateCommand(() =>
this.model.PlanAction(LaunchAction.Install), () => this.State ==
InstallState.NotPresent);
            this.UninstallCommand = new DelegateCommand(() =>
this.model.PlanAction(LaunchAction.Uninstall), () => this.State ==
InstallState.Present);
            this.CancelCommand = new DelegateCommand(() => 
                {
                    this.model.LogMessage("Canceling...");
                    if(this.State == InstallState.Applying)
                        this.State = InstallState.Cancelled;
                    else
                       
CustomBootstrapperApplication.Dispatcher.InvokeShutdown();
                }, () => this.State != InstallState.Cancelled);

            this.model.BootstrapperApplication.CacheAcquireProgress +=
(sender, args) =>
                {
                    this.cacheProgress = args.OverallPercentage;
                    this.Progress = (this.cacheProgress +
this.executeProgress) / 2;
                };

            this.model.BootstrapperApplication.ExecuteProgress += (sender,
args) =>
                {
                    this.executeProgress = args.OverallPercentage;
                    this.Progress = (this.cacheProgress +
this.executeProgress) / 2;
                };
        }

I'm not sure what other part of the code to post to help resolve the
problem.

Thanks for the help,
Gary




--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Unable-to-get-install-button-to-enable-tp7597419.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to