コード例 #1
0
        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);
        }
コード例 #2
0
 public void InitControl(MacroControlBase2 control, Tag tag)
 {
     control.Init(tag);
 }