| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using HySoft.IVRFlowEditor.IVRControlUtility;
- using HySoft.IVRFlowEditor.Utility;
- namespace HySoft.IVRFlowEditor.IVRControl
- {
- public partial class CtlIVRBranch : UserControl
- {
- IVRBranch _IVRBranch;
- public CtlIVRBranch(IVRBranch obj)
- {
- InitializeComponent();
- _IVRBranch = obj;
- this.Load += new EventHandler(CtlIVRBranch_Load);
- }
- void CtlIVRBranch_Load(object sender, EventArgs e)
- {
- this.tb_NodeID.Text = _IVRBranch.Pos;
- this.tb_NodeName.Text = _IVRBranch.Name;
- this.rtb_Note.Text = _IVRBranch.Note;
- this.cmb_NextNode.DataSource = GlobalController.GetComBoBoxofIVR();
- this.cmb_NextNode.DisplayMember = "Note";//2017-5-8将Name改为Note
- this.cmb_NextNode.ValueMember = "ID";
- //2017-5-9加载变量
- this.textBox1.Text = _IVRBranch.Var;
- int j = 0;
- if (_IVRBranch.DefaultPos != null)
- this.cmb_NextNode.SelectedItem = _IVRBranch.DefaultPos;
- if (_IVRBranch.Branch != null)
- foreach (IVRBranchVar i in _IVRBranch.Branch)
- {
- //_IVRBranch.Control.Width = this.panel1.Width;
- //_IVRBranch.Control.Height = 30;
- //_IVRBranch.Control.Location = new Point(0, 30 * (this.panel1.Controls.Count));
- i.Control.Width = this.panel1.Width;
- i.Control.Height = 30;
- i.Control.Location = new Point(0, 30 * j);// (this.panel1.Controls.Count));//2017-5-9修改
- this.panel1.Controls.Add(i.Control);
- j++;
- }
- }
- private void btn_add_Click(object sender, EventArgs e)
- {
- IVRBranchVar var = new IVRBranchVar();
- var.Control.Width = this.panel1.Width;
- var.Control.Height = 30;
- var.Control.Location = new Point(0, 30 * (this.panel1.Controls.Count ));
- this.panel1.Controls.Add(var.Control);
- _IVRBranch.Branch.Add(var);
- }
- private void btn_delete_Click(object sender, EventArgs e)
- {
- if (_IVRBranch.Branch.Count > 0)
- {
- this.panel1.Controls.Remove(_IVRBranch.Branch[_IVRBranch.Branch.Count - 1].Control);
- _IVRBranch.Branch.Remove(_IVRBranch.Branch[_IVRBranch.Branch.Count - 1]);
- }
- }
- private void btn_enter_Click(object sender, EventArgs e)
- {
- _IVRBranch.Name = tb_NodeName.Text;
- _IVRBranch.Note = rtb_Note.Text;
- //2017-5-9变量
- _IVRBranch.Var = textBox1.Text;
- foreach (IVRBranchVar i in _IVRBranch.Branch)
- {
- i.Control.Enter();
- }
- if (this.cmb_NextNode.SelectedItem != null)
- _IVRBranch.DefaultPos = (this.cmb_NextNode.SelectedItem as IVRControlBase);
- this.FindForm().DialogResult = DialogResult.OK;
- panel1.Controls.Clear();
- this.FindForm().Close();
- }
- private void btn_cancel_Click(object sender, EventArgs e)
- {
- this.FindForm().DialogResult = DialogResult.No;
- panel1.Controls.Clear();
- this.FindForm().Close();
- }
- }
- }
|