public partial class CustomDialog : ManagedForm, IManagedDialog
{
public UserNameDialog()
{
//instantiate banner PictureBox and back/next/cancel Buttons
InitializeComponent();
}
void CustomDialog_Load(object sender, EventArgs e)
{
banner.Image = Runtime.Session.GetResourceBitmap("WixUI_Bmp_Banner");
}
void back_Click(object sender, EventArgs e)
{
Shell.GoPrev();
}
void next_Click(object sender, EventArgs e)
{
Shell.GoNext();
}
void cancel_Click(object sender, EventArgs e)
{
Shell.Cancel();
}
}
...
project.ManagedUI = new ManagedUI();
project.ManagedUI.InstallDialogs.Add(Dialogs.Welcome)
.Add(Dialogs.Licence)
.Add(Dialogs.SetupType)
.Add(Dialogs.Features)
.Add(Dialogs.InstallDir)
.Add(Dialogs.Progress)
.Add(Dialogs.Exit);
project.ManagedUI.ModifyDialogs.Add(Dialogs.MaintenanceType)
.Add(Dialogs.Features)
.Add(Dialogs.Progress)
.Add(Dialogs.Exit);
Win32 MSI API: EmbeddedUIHandler
Win32 MSI API: ShutdownEmbeddedUI
class Script
{
static public void Main(string[] args)
{
var project =
new Project("My Product",
new Dir(@"%ProgramFiles%\My Company\My Product",
new File(@"AppFiles\MyApp.exe",
new WixSharp.Shortcut("MyApp", @"%ProgramMenu%\My Company\My Product"),
new WixSharp.Shortcut("MyApp", @"%Desktop%")),
new File(@"AppFiles\Readme.txt"),
new ManagedAction(@"MyManagedAction"),
...
Compiler.BuildMsi(project);
}
}
public class CustomActions
{
[CustomAction]
public static ActionResult MyManagedAction(Session session)
{
MessageBox.Show("Hello World!", "Managed CA");
return ActionResult.Success;
}
}
var bootstrapper =
new Bundle("My Product",
new PackageGroupRef("NetFx40Web"),
new MsiPackage("product.msi"));
bootstrapper.AboutUrl = "https://github.com/oleg-shilo/wixsharp/";
bootstrapper.IconFile = "app_icon.ico";
bootstrapper.Version = new Version("1.0.0.0");
bootstrapper.UpgradeCode = new Guid("6f330b47-2577-43ad-9095-1861bb25889b");
bootstrapper.Application = new SilentBootstrapperApplication();
bootstrapper.Build();
static public void Main()
{
ManagedAction showDialog;
var project = new Project("CustomDialogTest",
showDialog = new ShowClrDialogAction("ShowProductActivationDialog"));
project.UI = WUI.WixUI_Common;
project.CustomUI = CustomUIBuilder.InjectPostLicenseClrDialog(showDialog.Id, " LicenseAccepted = \"1\"");
Compiler.BuildMsi(project);
}
...
public class CustomActions
{
[CustomAction]
public static ActionResult ShowProductActivationDialog(Session session)
{
return WixCLRDialog.ShowAsMsiDialog(new CustomDialog(session));
}
}
...
public partial class CustomDialog : WixCLRDialog
{
private GroupBox groupBox1;
private Button cancelBtn;
...
void cancelBtn_Click(object sender, EventArgs e)
{
MSICancel();
}
void nextBtn_Click(object sender, EventArgs e)
{
MSINext();
}
void backBtn_Click(object sender, EventArgs e)
{
MSIBack();
}