Beispiel #1
0
        private void btnadd_Click(object sender, EventArgs e)
        {
            uc_template control = new uc_template();

            control.DeleteControlHandler += tmp_DeleteControlHandler;
            control.Dock = DockStyle.Top;
            pnl_main.Controls.Add(control);
        }
Beispiel #2
0
 private void TemplateForm_Load(object sender, EventArgs e)
 {
     if (DesignMode)
     {
         return;
     }
     try
     {
         string a = FileHelper.ReadFile("//temp//templateconfig.json");
         if (!string.IsNullOrWhiteSpace(a))
         {
             var list = JsonConvert.DeserializeObject <List <uc_template_source> >(a);
             foreach (var li in list)
             {
                 uc_template tmp = new uc_template();
                 tmp.Dock       = DockStyle.Top;
                 tmp.DataSource = new uc_template_source()
                 {
                     Enable        = li.Enable,
                     TemplateName  = li.TemplateName,
                     TemplatePath  = li.TemplatePath,
                     BuildPath     = li.BuildPath,
                     NameSpaceName = li.NameSpaceName,
                     Format        = li.Format
                 };
                 tmp.DataBind();
                 tmp.DeleteControlHandler += tmp_DeleteControlHandler;
                 pnl_main.Controls.Add(tmp);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(" 读取配置失败!详细信息:" + ex.ToString());
     }
 }