public static UserControl CreateBoardControlByDesignerType(Type type, DesignerControl dc) { if (ClassToClassDictionary.Keys.Contains(type)) { Type controlType = ClassToClassDictionary[type]; ICandy candy = (ICandy)controlType.Assembly.CreateInstance(controlType.FullName); return(candy.GetCandy(dc)); } else { throw new Exception("未注册的类名"); } }
public static Board.Factory.ControlWrapper CreateCandyByName(string name) { if (StringToClassDictionary.Keys.Contains(name)) { Type type = StringToClassDictionary[name]; ICandy candy = (ICandy)type.Assembly.CreateInstance(type.FullName); return(candy.GetCandy()); } else { throw new Exception("未注册的类名"); } }