How to Fetch install directory from WPF Application

Dec 12, 2016 at 11:52 AM
I am working on bootstrapper UI as my benchmark and created new UI in WPF.
When the "Install Directory " property is changed ,I have added it in Static variables so that it can be accessed in setup.cs file.
__
Here Data variables is my static Class .I filled the values in the main screen .
But Msi file is created before user filling values.

It will be beneficial to many users as lots of user required this functionality.
__
static public void Main(string[] args)
{

    System.Windows.Forms.MessageBox.Show(DataVariables.installationFolder);


    var productProj =
        new Project("My Product",
            new Dir(DataVariables.installationFolder +@"\My Company\My Product",
                new File("readme.txt")
                )
                ) { InstallScope = InstallScope.perMachine };
    productProj.GUID = new Guid("6f330b47-2577-43ad-9095-1861bb258778");
    string productMsi = productProj.BuildMsi();

    //------------------------------------
    var bootstrapper =
            new Bundle("My Product",                    
                new MsiPackage(productMsi) { Id = "MyProductPackageId", DisplayInternalUI = false });

    System.Windows.Forms.MessageBox.Show(System.Reflection.Assembly.GetExecutingAssembly().Location.ToString());
    bootstrapper.Version = new Version("1.0.0.0");
    bootstrapper.UpgradeCode = new Guid("6f330b47-2577-43ad-9095-1861bb25889a");
    bootstrapper.Application = new ManagedBootstrapperApplication("%this%"); // you can also use System.Reflection.Assembly.GetExecutingAssembly().Location
    bootstrapper.PreserveTempFiles = true;
    bootstrapper.Build();    
    io.File.Delete(productMsi);
}