Hi Anil,
ZoomLevelSet is not Enum type, so there maybe some problems when we pass typeof(ZoomLevelSet) to Enum.Parse(Type enumType, String value). You can try the following code to see if it fits your requirement.
public static ZoomLevelSet GetZoomLevelSet(int beginZoomLevel,int endZoomLevel)
{
ZoomLevelSet zoomLevelSet = new ZoomLevelSet();
switch (beginZoomLevel)
{
case 1:
zoomLevelSet.ZoomLevel01.IsActive = false;
ApplyUntilZoomLevelDynamically(zoomLevelSet.ZoomLevel01, endZoomLevel);
break;
case 2:
zoomLevelSet.ZoomLevel02.IsActive = false;
ApplyUntilZoomLevelDynamically(zoomLevelSet.ZoomLevel02, endZoomLevel);
break;
case 3:
……………
case 20:
zoomLevelSet.ZoomLevel20.IsActive = false;
ApplyUntilZoomLevelDynamically(zoomLevelSet.ZoomLevel20, endZoomLevel);
break;
default:
break;
}
return zoomLevelSet;
}
private static void ApplyUntilZoomLevelDynamically(ZoomLevel zoomLevel, int endZoomLevel)
{
switch (endZoomLevel)
{
case 1:
zoomLevel.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level01;
break;
case 2:
zoomLevel.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level02;
break;
case 3:
………………………
case 20:
zoomLevel.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
break;
default:
break;
}
}
Any other questions please let us know.
Thanks,
Johnny