Ok! So I've implemented this code in the my class for solve the my problem
public class AssisTouchScreen : AbstractUserControl
{
enum userControlNames : byte
{
ClassicUC,
TouchScreenUC,
}
UserControl _UserControl;
string[] userControlStrings;
public AssisTouchScreen()
{
userControlStrings = new string[]
{
userControlNames.ClassicUC.ToString(),
userControlNames.TouchScreenUC.ToString()
};
}
public override UserControl GetUserControl(string userControlName)
{
Disposing();
switch (userControlName)
{
case "ClassicUC":
_UserControl = new ClassicUC();
break;
case "TouchScreenUC":
_UserControl = new TouchScreenUC();
break;
default:
_UserControl = new TouchScreenUC();
break;
}
return _UserControl;
}
public override string[] GetUserControlNames
{
get { return userControlStrings; }
}
protected override void Disposing()
{
_UserControl = null;
}
}