public static UserControl GetControlOfFieldType(Type type)
{
FieldInfo[] fields = NWN2Toolset.NWN2ToolsetMainForm.App.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);
foreach (FieldInfo field in fields)
{
if (field.FieldType == type)
return (UserControl)field.GetValue(NWN2Toolset.NWN2ToolsetMainForm.App);
}
throw new Exception(String.Format("Could not find UserControl of type {0}.", type.ToString()));
}