简体   繁体   中英

How to code for Custom Dialog in Setup Project?

I have created a Setup Project for my .net application. I want to add another dialog after installation folder selection. I have added that dialog from User Interface panel. 在此输入图像描述

It is showing me correctly.

在此输入图像描述

Now, I want to write some code as per selected option in CustomInstallerClass . But, I don't know how to fetch that value (Selected Radio Button) in Commit process. So, i can do my further process as per radio button selection.

I cannot use Wix or any other third party tool to create that package. I have also read some other post like this on SO. But, I could not found any solution from these.

EDITED:

I am using these code to retrieve available parameter in the context. but in the result i couldn't find any parameter from my custom dialog.

protected override void OnCommitted(System.Collections.IDictionary savedState)
{
    string Values = string.Empty;
    foreach (string skey in this.Context.Parameters.Keys)
        Values += skey + Environment.NewLine;
    MessageBox.Show(Values);
    base.OnCommitted(savedState);            
}

The result are displaying like this.

action
installtype
assemblypath
logfile

MS seem to have deleted the walkthroughs on how to do this when setup projects were taken out of VS. However if you look at the property window of that RadioButtons(2) dialog you'll see there's an uppercase property name, probably BUTTON2. That will be set to 0 or 1. The way you pass parameters to your install method is like arguments, so you'd add something like /MyButton=[BUTTON2] and I think you need the brackets. Then inside the installer class you can say:

StringDictionary myStringDictionary = this.Context.Parameters;

and use the key MyButton on the dictionary to get the value. This should get you close.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM