| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- 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;
- using HySoft.IVRFlowEditor.Utility;
- using HySoft.IVRFlowEditor.IVRControlUtility;
- using HySoft.IVRFlowEditor.Model;
- namespace HySoft.IVRFlowEditor.IVRControl
- {
- public partial class CtlIVRSocket : UserControl
- {
- IVRSocket _IVRSocket;
- public CtlIVRSocket(IVRSocket obj)
- {
- InitializeComponent();
- _IVRSocket = obj;
- this.Load += new EventHandler(CtlIVRSocket_Load);
- }
- void CtlIVRSocket_Load(object sender, EventArgs e)
- {
- this.ctlDefaultListVar1.SetData(_IVRSocket.OutputVar.Select(a => a.Var).ToList());
- this.tb_NodeID.Text = _IVRSocket.Pos;
- this.tb_NodeName.Text = _IVRSocket.Name;
- this.rtb_Note.Text = _IVRSocket.Note;
- this.cmb_SuccessPos.DataSource = GlobalController.GetComBoBoxofIVR();
- this.cmb_SuccessPos.DisplayMember = "Note";//2017-5-8将Name改为Note
- this.cmb_SuccessPos.ValueMember = "ID";
- if (_IVRSocket.SuccessPos != null)
- this.cmb_SuccessPos.SelectedItem = _IVRSocket.SuccessPos;
- this.cmb_FailPos.DataSource = GlobalController.GetComBoBoxofIVR();
- this.cmb_FailPos.DisplayMember = "Note";//2017-5-8将Name改为Note
- this.cmb_FailPos.ValueMember = "ID";
- if (_IVRSocket.FailPos != null)
- this.cmb_FailPos.SelectedItem = _IVRSocket.FailPos;
- GlobalController.BindComBoBoxOfEnumDesc(this.cmb_OpType, _IVRSocket.OpType);
- this.tb_FarIp.Text = _IVRSocket.FarIp;
- this.num_Port.Value = _IVRSocket.FarPort;
- this.num_timeOut.Value = _IVRSocket.RecvTimeOut;
- this.panel1.Controls.Clear();
- if (_IVRSocket.IVRInputVar != null)
- {
- foreach (IVRInputVar i in _IVRSocket.IVRInputVar)
- {
- i.Control.Width = this.panel1.Width;
- i.Control.Height = 30;
- i.Control.Location = new Point(0, 30 * (this.panel1.Controls.Count));
- this.panel1.Controls.Add(i.Control);
- }
- }
-
-
- }
- private void rtb_Rvar_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- FrmIVREdit frm = new FrmIVREdit(_IVRSocket.OutputVar);
- if (frm.ShowDialog() == DialogResult.OK)
- {
- _IVRSocket.OutputVar = frm.Vars;
- }
- }
- private void btn_add_Click(object sender, EventArgs e)
- {
- IVRInputVar var = new IVRInputVar();
- 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);
- _IVRSocket.IVRInputVar.Add(var);
- }
- private void btn_delete_Click(object sender, EventArgs e)
- {
- if (_IVRSocket.IVRInputVar.Count > 0)
- {
- this.panel1.Controls.Remove(_IVRSocket.IVRInputVar[_IVRSocket.IVRInputVar.Count - 1].Control);
- _IVRSocket.IVRInputVar.Remove(_IVRSocket.IVRInputVar[_IVRSocket.IVRInputVar.Count - 1]);
- }
- }
- private void btn_enter_Click(object sender, EventArgs e)
- {
- _IVRSocket.Name = tb_NodeName.Text;
- _IVRSocket.Note = rtb_Note.Text;
- foreach (IVRInputVar i in _IVRSocket.IVRInputVar)
- {
- i.Control.Enter();
- }
- _IVRSocket.OutputVar.Clear();
- _IVRSocket.OutputVar.AddRange(this.ctlDefaultListVar1.GetListVar());
- if (this.cmb_SuccessPos.SelectedItem != null)
- _IVRSocket.SuccessPos = (this.cmb_SuccessPos.SelectedItem as IVRControlBase);
- if (this.cmb_FailPos.SelectedItem != null)
- _IVRSocket.FailPos = (this.cmb_FailPos.SelectedItem as IVRControlBase);
- _IVRSocket.OpType = GlobalController.GetEnumByComBoBoxValueOFDesc<OpType>(this.cmb_OpType.Text);
- _IVRSocket.FarIp = this.tb_FarIp.Text;
- _IVRSocket.FarPort = (int)this.num_Port.Value;
- _IVRSocket.RecvTimeOut = (int)this.num_timeOut.Value;
- this.FindForm().DialogResult = DialogResult.OK;
- this.FindForm().Close();
-
- }
- private void btn_cancel_Click(object sender, EventArgs e)
- {
- this.FindForm().DialogResult = DialogResult.No;
- this.FindForm().Close();
- }
-
- }
- }
|