Finally I resolve this issue I don't know whether it is right or wrong but for the time I have implemented it and it is working fine for me.
here is the code following event in manged BA
private void PlanPackageBegin(object sender, PlanPackageBeginEventArgs e)
{
if (e.PackageId.Equals("Setup1.msi", StringComparison.Ordinal))
{
this.model.LogMessage("PlanPackageBegin Setup1 : " + e.State);
string IsSetup1= this.model.BootstrapperApplication.Engine.StringVariables["chkSetup1"];
if (IsSetup1== "True")
{
e.State = RequestState.Present;
}
else
{
e.State = RequestState.Absent;
}
this.model.LogMessage("PlanPackageBegin Setup1 : " + e.State);
}
if (e.PackageId.Equals("Setup2.msi", StringComparison.Ordinal))
{
this.model.LogMessage("PlanPackageBegin Setup2 : " + e.State);
string IsSetup2= this.model.BootstrapperApplication.Engine.StringVariables["chkSetup2"];
if (IsSetup2== "True")
{
e.State = RequestState.Present;
}
else
{
e.State = RequestState.Absent;
}
this.model.LogMessage("PlanPackageBegin Setup2 : " + e.State);
}
}
Add below line to WireUpEventHandlers() function
this.model.BootstrapperApplication.PlanPackageBegin +=this.PlanPackageBegin;
here chkSetup1 and chkSetup2 values are setting to True or False from custom UI made for feature tree and SetBurnVariable function. I hope it will help some one.