public MacroControlBase2 CreateMacroControl(Tag tag) { Type type = Type.GetType(tag.ControlType) ?? Type.GetType("Roll20PowerCardMacroGenerator.Forms.CustomControls." + tag.ControlType); MacroControlBase2 control = null; if (type != null) { control = Activator.CreateInstance(type) as MacroControlBase2; if (control != null) { control.Init(tag); } else { throw new Exception(string.Format("Failed to create control '{0}'", tag.ControlType)); } } else { throw new Exception(string.Format("Failed to create control '{0}'", tag.ControlType)); } return(control); }
public void InitControl(MacroControlBase2 control, Tag tag) { control.Init(tag); }