public GroupBox create() { ui_gbBufToFile= new GroupBox(); ui_gbBufToFile.Name = "ui_gbBufToFile"; ui_gbBufToFile.Text = "Paramètres"; ui_gbBufToFile.Size = new Size(802, 420); ctlParamName ui_ctlParamName = new ctlParamName("SAVE"); ui_ctlParamName.Location = new Point(7, 23); ui_ctlParamName.Name = "ui_ctlParamName"; ctlParamBuffer ui_ctlParamBuffer = new ctlParamBuffer("FROM"); ui_ctlParamBuffer.Location = new Point(ui_ctlParamName.Location.X, ui_ctlParamName.Location.Y + ui_ctlParamName.Size.Height); ui_ctlParamBuffer.Name = "ui_ctlParamTo"; Button ui_btnAdd = new Button(); ui_btnAdd.Name = "ui_btnAdd"; ui_btnAdd.AutoSize = true; ui_btnAdd.Text = "Ajouter"; ui_btnAdd.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left); ui_btnAdd.Location = new Point(ui_ctlParamName.Location.X, ui_gbBufToFile.Size.Height - 35); ui_btnAdd.Click += new EventHandler(ui_btnAdd_Click); ui_gbBufToFile.Controls.Add(ui_ctlParamBuffer); ui_gbBufToFile.Controls.Add(ui_ctlParamName); ui_gbBufToFile.Controls.Add(ui_btnAdd); return ui_gbBufToFile; }
private void ui_btnAdd_Click(Object sender, EventArgs e) { ctlParamName ctlName = new ctlParamName("OPEN"); ctlParamBuffer ctlBuffer = new ctlParamBuffer("TO"); ctlName = (ctlParamName)(ui_gbFileLoad.Controls["ui_ctlParamName"]); ctlBuffer = (ctlParamBuffer)(ui_gbFileLoad.Controls["ui_ctlParamTo"]); try { // Contrôle des valeurs saisies if (!ctlBuffer.controlEnter()) RaiseAddMessageEvent("Le numéro du buffer n'est pas renseigné !", pcs_name, Color.Red); else if (!ctlName.controlEnter()) RaiseAddMessageEvent("Le nom du fichier n'est pas renseigné !", pcs_name, Color.Red); else { ps_fileName = ctlName.VALUE; bool result = Int32.TryParse(ctlBuffer.VALUE, out pi_to); // Ajouter le numéro de l'index dans la liste pb_buffer.add(null, pi_to); // Ajouter l'objet dans le treeview RaiseAddActionEvent(new fileLoad(ps_fileName, pi_to)); } } catch (Exception ex) { RaiseAddMessageEvent(string.Format("Erreur lors de l'ajout au workflow : {0}", ex.Message), pcs_name, Color.Red); } }