Launch app on exit checkbox need to be checked by default - winforms

We customized the WIX Installer UI.
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
......
<CustomAction Id="StartAppOnExit" FileKey="AdminAppExe" ExeCommand="" Execute="immediate" Impersonate="yes" Return="asyncNoWait" />
<Property Id="LAUNCHAPPONEXIT" Value="1"/>
<Control Id="LAUNCHAPPONEXIT" Type="CheckBox" X="10" Y="243" Width="170" Height="17" Property="StartAppOnExit" Hidden="yes" CheckBoxValue="1" Text=" Launch App?">
<Condition Action="show">NOT Installed</Condition>
</Control>
.....
</Wix>
But the Checkbox to Launch app is not enabled by default? Pls let me know what i am doing wrong!

You're setting the property LAUNCHAPPONEXIT, presumably to check the box by default. However the Control is using a different property - StartAppOnExit.
You'll need to set the value of the property that the checkbox is using, or change the checkbox to use the property that you are setting.

Related

WPF Prism 5.0 Interaction popup - how to make it not to display in TaskBar?

If you have Prism 5.0 - it has a sample solution
Quickstarts\Interactivity\InteractivityQuickstart
it shows how to use popup UserControls that have their views defined
InteractivityQuickstart\Views\InteractionRequestView.xaml:
<prism:InteractionRequestTrigger SourceObject="{Binding CustomPopupViewRequest, Mode=OneWay}">
<!-- This PopupWindowAction has a custom view defined. When this action is executed the view will be shown inside a new window -->
<!-- Take into account that the view is created only once and will be reused each time the action is executed -->
<prism:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True">
<prism:PopupWindowAction.WindowContent>
<views:CustomPopupView />
</prism:PopupWindowAction.WindowContent>
</prism:PopupWindowAction>
</prism:InteractionRequestTrigger>
It all works fine, except that this popup shows its own taskbar button.
And it can only be a UserControl, not a Window - can't set ShowInTaskBar="False".
Anyone can help - how to make it not to display its own taskbar button?
UserControl have not a property ShowInTaskBar.
Just set the property ShowInTaskBar of the window to False it should works, like this :
<prism:InteractionRequestTrigger SourceObject="{Binding CustomPopupViewRequest, Mode=OneWay}">
<!-- This PopupWindowAction has a custom view defined. When this action is executed the view will be shown inside a new window -->
<!-- Take into account that the view is created only once and will be reused each time the action is executed -->
<prism:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True">
<prism:PopupWindowAction.WindowStyle>
<Style TargetType="Window">
<Setter Property="ShowInTaskbar" Value="False"/>
</Style>
</prism:PopupWindowAction.WindowStyle>
<prism:PopupWindowAction.WindowContent>
<views:CustomPopupView />
</prism:PopupWindowAction.WindowContent>
</prism:PopupWindowAction>
</prism:InteractionRequestTrigger>
best regards.
There are some limitation in Prism popupwindow, so you cannot control it.
Instead of that you can try using
http://blogs.southworks.net/dcherubini/2012/05/24/popupwindowaction-using-custom-views-instead-of-windows-in-wpf-and-prism/
Great thing about this solution is - that you can use custom pop-ups and not only Notification or Confirmation pop-ups.
Also - You can pass information back to the class the invoked the 'InteractionRequest'.

Caliburn.Micro.Telerik RadTab convention for IsEnabled

I am using Caliburn.Micro.Telerik conventions project.
I have view that dynamically loads telerik Tabs view models:
<telerik:RadTabControl x:Name="Items" Grid.Row="1" Margin="10,0,0,0" />
I have set IsEnabled property onone of the Tabs view models to false, but that Tab is always enabled.
Is this supported? If not, how can I add it?
I'm pretty sure that CM doesn't allow more than a single property for element conventions and I'm not sure what the default property for RadTabItem is. You can always use an explicit binding using a style on the tab control
<telerik:RadTabControl x:Name="Items" Grid.Row="1" Margin="10,0,0,0">
<telerik:RadTabControl.Resources>
<Style TargetType="telerik:RadTabItem">
<Setter Property="IsEnabled" Value="{Binding IsEnabled}" />
</Style>
</telerik:RadTabControl.Resources>
</telerik:RadTabControl>
Or try using ConventionManager and setting the default convention for them (though this is probably already set to something in the Telerik CM framework)
ConventionManager.AddElementConvention<RadTabItem>(RadTabItem.IsEnabledProperty, "IsEnabled", "?");
(You might have noticed the "?", I'm not sure what events RadTabItem has available and which should be the default event to trigger actions so you'd have to fill this one in yourself, see here for more info: Caliburn element convention)
Edit:
Actually looking at the src, it seems no default convention is supplied for RadTabItem
https://github.com/vcaraulean/Caliburn.Micro.Telerik/blob/master/WPF/Caliburn.Micro.Telerik/TelerikConventions.cs
So it looks like you should go down the ConventionManager route
I have tried using ConventionManager but was not successful.
I ended up using this XAML as suggested by Charleh and Valeriu at github Issue page (https://github.com/vcaraulean/Caliburn.Micro.Telerik/issues/12#issuecomment-11840602):
<telerik:RadTabControl x:Name="Items">
<telerik:RadTabControl.ItemContainerStyle>
<Style TargetType="telerik:RadTabItem">
<Setter Property="IsEnabled" Value="{Binding IsEnabled}" />
</Style>
</telerik:RadTabControl.ItemContainerStyle>
</telerik:RadTabControl>

Storing the value of CheckBox in WiX

I have authored an installer using Wix 3.6 RC. I have a checkbox in the dialog UI which is disabled and unchecked initially. There is a "Verify" button next to it. When I press this button a custom action gets executed (immediate) and sets a value of parameter which decides whether check box gets enabled or not. Here is the code:
<Control Id="VirtualCheckBox"
Type="CheckBox"
CheckBoxValue="1"
X="35" Y="100"
Width="160" Height="20"
Disabled="yes"
Text="!(loc.VirtualizationDlg_ChkBox)" Property="ENABLEVIRTUALIZATION">
<Condition Action="enable"><![CDATA[INTEGRATED = "1"]]></Condition>
<Condition Action="disable"><![CDATA[INTEGRATED = "0"]]></Condition>
</Control>
I am storing this value of checkbox in registry:
<Component Id="Virtualization_RegistryEntries" Guid="GUID-IS-HERE">
<Condition>Not Installed</Condition>
<RegistryKey Root="HKCU"
Key="Software\!(loc.CompanyName)\!(loc.ProductName)">
<RegistryValue Type="string" Name="Virtualization" Value="[ENABLEVIRTUALIZATION]" KeyPath="yes"/>
</RegistryKey>
</Component>
Now I have to do this:
1) If user does not click the Verify button : Registry gets value 0
2) If he clicks button (CA gets false and checkbox remains disabled) : Registry gets value 0
3) If he clicks button and checkbox enables but he does not check the checkbox : Registry gets value 0
4) If he clicks button and checkbox enables and he does check the check box : Registry gets value 1
Mine is not working at only one condition, when he checks this, registry does get 1 but either it is disabled or remains unchecked the registry gets nothing.
How can I resolve this issue?
Have you tried giving your variables a default value?
<Property Id="ENABLEVIRTUALIZATION" Value="0" />
Something as simple as that should do the trick!

Call custom action in WIX on change of value in Combox

Am stuck with combo box and custom action in WIX installer.
I have a combo box(drop down) containing few values. I want to show some text on the screen (unique for each item in dropdown) when the user selects a value from this drop down.
In .Net we can do this easily as we have different events pre-defined. But in WIX I don't see any such event.
Has someone faced the same problem? Or can guide me on how can I get it done.
Windows Installer (the underlying technology) doesn't let you do so. Literally, it doesn't publish any event when the combobox (dropdown) value changes. You'll have to add a button, for instance, for user to click when he/she changed the value in the combobox...
Alternatively, you can switch to the EmbeddedUI technique (WiX element and MSI table), but it is much more advanced...
UPDATE: a sample of using button click to update the text.
<UI>
...
<ComboBox Property="WIX_VERSIONS">
<ListItem Value="Windows Installer XML 3.0" />
<ListItem Value="Windows Installer XML 3.5" />
<ListItem Value="Windows Installer XML 3.6" />
</ComboBox>
...
<Dialog Id="MyCustomDlg">
...
<Control Id="ComboBoxMain" Type="ComboBox" X="10" Y="60" Width="300" Height="17" Property="WIX_VERSIONS" />
<Control Id="ButtonMain" Type="PushButton" X="320" Y="60" Width="40" Height="17" Text="Show">
<Publish Property="COMBOVALUEFORMATTED" Value="You've chosen the [WIX_VERSIONS] version of the toolset" />
</Control>
<Control Id="LabelMain" Type="Text" X="10" Y="80" Width="360" Height="17" Property="COMBOVALUEFORMATTED" Text="[COMBOVALUEFORMATTED]" />
...
</Dialog>
</UI>
PushButton can publish more events, for instance, DoAction, which is used to run a custom action on button click. This might be more relevant in your case.
There is a way to do this in WiX. You just need to manufacture your own changed event.
We compare our DoAction condition to another property which will hold the previous state of the Combobox - VIRTUALWEBSITEOLD
Execute a custom action in the ComboBox when old does not equal new:
<Control Id="WebSite" Type="ComboBox" Width="180" Height="18" X="120" Y="48" ComboList="no" Property="VIRTUALWEBSITE">
<Publish Event="DoAction" Value="LansaInitVirtualFolders"><![CDATA[VIRTUALWEBSITE <> VIRTUALWEBSITEOLD]]></Publish>
</Control>
Then the Custom Action performs the same comparison as the DoAction (probably not required) and then saves the Combobox value in the OLD property.
Tstring wszWebsite = ReadProperty( _T( "VIRTUALWEBSITE") );
Tstring wszWebsiteOld = ReadProperty( _T ( "VIRTUALWEBSITEOLD" ) );
// If unchanged ignore request
if ( wszWebsite == wszWebsiteOld ) return true ;
[Do Some stuff]
// Set the saved state of the combobox so we don't get called again until it changes
if ( nResult == ERROR_SUCCESS || nResult == ERROR_NO_MORE_ITEMS)
{
WriteProperty( _T("VIRTUALWEBSITEOLD" ), wszWebsite.c_str () );
}
(Note: Also need to use Twin Dialog Pattern if updating, say, a listbox control. If your control doesn't update but Next and Back DOES update it, then Twin Dialog Pattern will ensure it updates)

Microsoft WPF ribbon - how can I add a RibbonTab stored in a Resources.xaml file?

I have a RibbonTab defined in a Resource file (xaml resources) and i need to add it to the ribbon's tabs collection.
How do i do that? (In xaml)
The Ribbon in xaml is something like that:
<Ribbon>
<Ribbon.Tabs><Ribbon.Tabs/>
</Ribbon>
So it holds a collection of tabs, i don't know how to insert a tab stored in the static resources.
Thank you in advance :)
Teodor
edit: This is the WPF Microsoft ribbon
Edit 2: I tried using <DynamicResource ResourceKey="MyTabKey" /> but i get this error:
Property 'Tabs' does not support
values of type
'DynamicResourceExtension'
First you place the RibbonTabs as resources in whatever ResourceDictionary you want:
<Application.Resources>
<r:RibbonTab Label="Tab_A" x:Key="RibControl_A">
<r:RibbonGroup>
<r:RibbonButton>
<r:RibbonButton.Command>
<r:RibbonCommand LabelTitle="CommandA"/>
</r:RibbonButton.Command>
</r:RibbonButton>
</r:RibbonGroup>
</r:RibbonTab>
<r:RibbonTab Label="Tab_B" x:Key="RibControl_B">
<r:RibbonGroup>
<r:RibbonButton>
<r:RibbonButton.Command>
<r:RibbonCommand LabelTitle="CommandB"/>
</r:RibbonButton.Command>
</r:RibbonButton>
</r:RibbonGroup>
</r:RibbonTab>
</Application.Resources>
Then you can just reference them as StaticResources
<r:Ribbon>
<r:Ribbon.Tabs>
<StaticResource ResourceKey="RibControl_A" />
<StaticResource ResourceKey="RibControl_B" />
</r:Ribbon.Tabs>
</r:Ribbon>
That compiles and runs successfully for me.

Resources