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.Model;
using HySoft.IVRFlowEditor.Utility;
using HySoft.IVRFlowEditor.IVRControl;
namespace HySoft.IVRFlowEditor.Propretity
{
///
/// 留言控件
///
public partial class CtlIVRAudioDTMF : UserControl
{
public CtlIVRAudioDTMF()
{
InitializeComponent();
}
public CtlIVRAudioDTMF(IVRAudioDTMF obj)
{
InitializeComponent();
_IVRAudioDTMF = obj;
this.Load += new EventHandler(CtlIVRTransfeOut_Load);
}
void CtlIVRTransfeOut_Load(object sender, EventArgs e)
{
this.cmb_KeyVar.DataSource = GlobalController.GetFlowVar().ToList();
this.cmb_KeyVar.DisplayMember = "VarName";
this.cmb_KeyVar.ValueMember = "VarName";
if (_IVRAudioDTMF.KeyVar != null&& _IVRAudioDTMF.KeyVar!="")
this.cmb_KeyVar.Text = _IVRAudioDTMF.KeyVar;//2017-5-10SelectedText改为Text
else
cmb_KeyVar.SelectedItem = null;
this.tcb_TTSSpeed.Value = _IVRAudioDTMF.TTSSpeed;
this.tcb_TTSVolume.Value = _IVRAudioDTMF.TTSVolume;
GlobalController.BindComBoBoxOfEnumDesc(cmb_ContentType, _IVRAudioDTMF.ContentType);
GlobalController.BindComBoBoxOfEnumDesc(cmb_FinishKey, _IVRAudioDTMF.FinishKey);
cmb_HangupPos.DataSource = GlobalController.GetComBoBoxofIVR();
this.cmb_HangupPos.DisplayMember = "Note";//2017-5-8将Name改为Note
this.cmb_HangupPos.ValueMember = "ID";
if (_IVRAudioDTMF.HangupPos != null)
cmb_HangupPos.SelectedItem = _IVRAudioDTMF.HangupPos;
this.cmb_successNextNode.DataSource = GlobalController.GetComBoBoxofIVR();
this.cmb_successNextNode.DisplayMember = "Note";//2017-5-8将Name改为Note
this.cmb_successNextNode.ValueMember = "ID";
if (_IVRAudioDTMF.SuccessPos != null)
cmb_successNextNode.SelectedItem = _IVRAudioDTMF.SuccessPos;
this.cmb_failNextNode.DataSource = GlobalController.GetComBoBoxofIVR();
this.cmb_failNextNode.DisplayMember = "Note";//2017-5-8将Name改为Note
this.cmb_failNextNode.ValueMember = "ID";
if (_IVRAudioDTMF.FailPos != null)
cmb_failNextNode.SelectedItem = _IVRAudioDTMF.FailPos;
GlobalController.BindComBoBoxOfEnumDesc(cmb_PlayType, _IVRAudioDTMF.PlayType);
GlobalController.BindComBoBoxOfEnumDesc(cmb_TTSEngine, _IVRAudioDTMF.TTSEngine);
GlobalController.BindComBoBoxOfEnumDesc(cmb_TTSNumMode, _IVRAudioDTMF.TTSNumMode);
this.tb_NodeID.Text = _IVRAudioDTMF.Pos;
this.tb_NodeName.Text = _IVRAudioDTMF.Name;
this.rtb_Note.Text = _IVRAudioDTMF.Note;
this.num_KeyPressInterval.Value = _IVRAudioDTMF.KeyPressInterval;
this.num_MaxKeyCount.Value = _IVRAudioDTMF.MaxKeyCount;
//2017-5-10
this.rtb_Content.Text = _IVRAudioDTMF.Content;
//2017-5-10
if (_IVRAudioDTMF.StopWhenDtmf == "1")
{
cb_StopWhenDtmf.Checked = true;
}
else if (_IVRAudioDTMF.StopWhenDtmf == "2")
{
cb_StopWhenDtmf.Checked = false ;
}
}
private IVRAudioDTMF _IVRAudioDTMF;
private void btn_enter_Click(object sender, EventArgs e)
{
_IVRAudioDTMF.TTSEngine = GlobalController.GetEnumByComBoBoxValueOFDesc(cmb_TTSEngine.Text);
_IVRAudioDTMF.TTSNumMode = GlobalController.GetEnumByComBoBoxValueOFDesc(cmb_TTSNumMode.Text);
_IVRAudioDTMF.PlayType = GlobalController.GetEnumByComBoBoxValueOFDesc(cmb_PlayType.Text);
_IVRAudioDTMF.ContentType = GlobalController.GetEnumByComBoBoxValueOFDesc(cmb_ContentType.Text);
_IVRAudioDTMF.FinishKey = GlobalController.GetEnumByComBoBoxValueOFDesc(cmb_FinishKey.Text);
_IVRAudioDTMF.HangupPos = cmb_HangupPos.SelectedItem as IVRControlBase;
_IVRAudioDTMF.SuccessPos = this.cmb_successNextNode.SelectedItem as IVRControlBase;
_IVRAudioDTMF.FailPos = this.cmb_failNextNode.SelectedItem as IVRControlBase;
_IVRAudioDTMF.TTSSpeed = tcb_TTSSpeed.Value;
_IVRAudioDTMF.MaxKeyCount = (int)num_MaxKeyCount.Value;
_IVRAudioDTMF.KeyPressInterval = (int)num_KeyPressInterval.Value;
_IVRAudioDTMF.TTSVolume = tcb_TTSVolume.Value;
_IVRAudioDTMF.Content = rtb_Content.Text;//2017-5-10
_IVRAudioDTMF.KeyVar = this.cmb_KeyVar.Text;// this.cmb_KeyVar.SelectedText;//2017-5-10
_IVRAudioDTMF.Note = rtb_Note.Text;
_IVRAudioDTMF.Name = tb_NodeName.Text;
_IVRAudioDTMF.Pos = tb_NodeID.Text;
//2017-5-10
if (cb_StopWhenDtmf.Checked == true)
{
_IVRAudioDTMF.StopWhenDtmf = "1";
}
else
{
_IVRAudioDTMF.StopWhenDtmf = "2";
}
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();
}
///
/// 双击鼠标进行变量的选择和文本框内容的编写
///
///
///
private void _Content_MouseDoubleClick(object sender, MouseEventArgs e)
{
FrmIVREdit frm = new FrmIVREdit(_IVRAudioDTMF.Content);
frm.Text = "播放内容定义";
if (frm.ShowDialog() == DialogResult.OK)
{
this.rtb_Content.Text = frm.GetText();
}
}
private void tcb_TTSSpeed_Scroll(object sender, EventArgs e)
{
this.label20.Text = tcb_TTSSpeed.Value.ToString();
}
private void tcb_TTSVolume_Scroll(object sender, EventArgs e)
{
this.label19.Text = tcb_TTSVolume.Value.ToString();
}
private void cmb_PlayType_SelectedIndexChanged(object sender, EventArgs e)
{
//if (cmb_PlayType.Text == "仅放音")
//{
// cmb_KeyVar.SelectedItem =null ;
//}
}
private void button1_Click(object sender, EventArgs e)
{
cmb_KeyVar.SelectedItem =null ;
}
}
}