ivr流程编辑器

CtlIVRAudioDTMF.cs 6.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using HySoft.IVRFlowEditor.IVRControlUtility;
  10. using HySoft.IVRFlowEditor.Model;
  11. using HySoft.IVRFlowEditor.Utility;
  12. using HySoft.IVRFlowEditor.IVRControl;
  13. namespace HySoft.IVRFlowEditor.Propretity
  14. {
  15. /// <summary>
  16. /// 留言控件
  17. /// </summary>
  18. public partial class CtlIVRAudioDTMF : UserControl
  19. {
  20. public CtlIVRAudioDTMF()
  21. {
  22. InitializeComponent();
  23. }
  24. public CtlIVRAudioDTMF(IVRAudioDTMF obj)
  25. {
  26. InitializeComponent();
  27. _IVRAudioDTMF = obj;
  28. this.Load += new EventHandler(CtlIVRTransfeOut_Load);
  29. }
  30. void CtlIVRTransfeOut_Load(object sender, EventArgs e)
  31. {
  32. this.cmb_KeyVar.DataSource = GlobalController.GetFlowVar().ToList();
  33. this.cmb_KeyVar.DisplayMember = "VarName";
  34. this.cmb_KeyVar.ValueMember = "VarName";
  35. if (_IVRAudioDTMF.KeyVar != null&& _IVRAudioDTMF.KeyVar!="")
  36. this.cmb_KeyVar.Text = _IVRAudioDTMF.KeyVar;//2017-5-10SelectedText改为Text
  37. else
  38. cmb_KeyVar.SelectedItem = null;
  39. this.tcb_TTSSpeed.Value = _IVRAudioDTMF.TTSSpeed;
  40. this.tcb_TTSVolume.Value = _IVRAudioDTMF.TTSVolume;
  41. GlobalController.BindComBoBoxOfEnumDesc(cmb_ContentType, _IVRAudioDTMF.ContentType);
  42. GlobalController.BindComBoBoxOfEnumDesc(cmb_FinishKey, _IVRAudioDTMF.FinishKey);
  43. cmb_HangupPos.DataSource = GlobalController.GetComBoBoxofIVR();
  44. this.cmb_HangupPos.DisplayMember = "Note";//2017-5-8将Name改为Note
  45. this.cmb_HangupPos.ValueMember = "ID";
  46. if (_IVRAudioDTMF.HangupPos != null)
  47. cmb_HangupPos.SelectedItem = _IVRAudioDTMF.HangupPos;
  48. this.cmb_successNextNode.DataSource = GlobalController.GetComBoBoxofIVR();
  49. this.cmb_successNextNode.DisplayMember = "Note";//2017-5-8将Name改为Note
  50. this.cmb_successNextNode.ValueMember = "ID";
  51. if (_IVRAudioDTMF.SuccessPos != null)
  52. cmb_successNextNode.SelectedItem = _IVRAudioDTMF.SuccessPos;
  53. this.cmb_failNextNode.DataSource = GlobalController.GetComBoBoxofIVR();
  54. this.cmb_failNextNode.DisplayMember = "Note";//2017-5-8将Name改为Note
  55. this.cmb_failNextNode.ValueMember = "ID";
  56. if (_IVRAudioDTMF.FailPos != null)
  57. cmb_failNextNode.SelectedItem = _IVRAudioDTMF.FailPos;
  58. GlobalController.BindComBoBoxOfEnumDesc(cmb_PlayType, _IVRAudioDTMF.PlayType);
  59. GlobalController.BindComBoBoxOfEnumDesc(cmb_TTSEngine, _IVRAudioDTMF.TTSEngine);
  60. GlobalController.BindComBoBoxOfEnumDesc(cmb_TTSNumMode, _IVRAudioDTMF.TTSNumMode);
  61. this.tb_NodeID.Text = _IVRAudioDTMF.Pos;
  62. this.tb_NodeName.Text = _IVRAudioDTMF.Name;
  63. this.rtb_Note.Text = _IVRAudioDTMF.Note;
  64. this.num_KeyPressInterval.Value = _IVRAudioDTMF.KeyPressInterval;
  65. this.num_MaxKeyCount.Value = _IVRAudioDTMF.MaxKeyCount;
  66. //2017-5-10
  67. this.rtb_Content.Text = _IVRAudioDTMF.Content;
  68. //2017-5-10
  69. if (_IVRAudioDTMF.StopWhenDtmf == "1")
  70. {
  71. cb_StopWhenDtmf.Checked = true;
  72. }
  73. else if (_IVRAudioDTMF.StopWhenDtmf == "2")
  74. {
  75. cb_StopWhenDtmf.Checked = false ;
  76. }
  77. }
  78. private IVRAudioDTMF _IVRAudioDTMF;
  79. private void btn_enter_Click(object sender, EventArgs e)
  80. {
  81. _IVRAudioDTMF.TTSEngine = GlobalController.GetEnumByComBoBoxValueOFDesc<TTSEngineType>(cmb_TTSEngine.Text);
  82. _IVRAudioDTMF.TTSNumMode = GlobalController.GetEnumByComBoBoxValueOFDesc<TTSNumModeType>(cmb_TTSNumMode.Text);
  83. _IVRAudioDTMF.PlayType = GlobalController.GetEnumByComBoBoxValueOFDesc<PlayType>(cmb_PlayType.Text);
  84. _IVRAudioDTMF.ContentType = GlobalController.GetEnumByComBoBoxValueOFDesc<ContentType>(cmb_ContentType.Text);
  85. _IVRAudioDTMF.FinishKey = GlobalController.GetEnumByComBoBoxValueOFDesc<FinishKeyType>(cmb_FinishKey.Text);
  86. _IVRAudioDTMF.HangupPos = cmb_HangupPos.SelectedItem as IVRControlBase;
  87. _IVRAudioDTMF.SuccessPos = this.cmb_successNextNode.SelectedItem as IVRControlBase;
  88. _IVRAudioDTMF.FailPos = this.cmb_failNextNode.SelectedItem as IVRControlBase;
  89. _IVRAudioDTMF.TTSSpeed = tcb_TTSSpeed.Value;
  90. _IVRAudioDTMF.MaxKeyCount = (int)num_MaxKeyCount.Value;
  91. _IVRAudioDTMF.KeyPressInterval = (int)num_KeyPressInterval.Value;
  92. _IVRAudioDTMF.TTSVolume = tcb_TTSVolume.Value;
  93. _IVRAudioDTMF.Content = rtb_Content.Text;//2017-5-10
  94. _IVRAudioDTMF.KeyVar = this.cmb_KeyVar.Text;// this.cmb_KeyVar.SelectedText;//2017-5-10
  95. _IVRAudioDTMF.Note = rtb_Note.Text;
  96. _IVRAudioDTMF.Name = tb_NodeName.Text;
  97. _IVRAudioDTMF.Pos = tb_NodeID.Text;
  98. //2017-5-10
  99. if (cb_StopWhenDtmf.Checked == true)
  100. {
  101. _IVRAudioDTMF.StopWhenDtmf = "1";
  102. }
  103. else
  104. {
  105. _IVRAudioDTMF.StopWhenDtmf = "2";
  106. }
  107. this.FindForm().DialogResult = DialogResult.OK;
  108. this.FindForm().Close();
  109. }
  110. private void btn_cancel_Click(object sender, EventArgs e)
  111. {
  112. this.FindForm().DialogResult = DialogResult.No;
  113. this.FindForm().Close();
  114. }
  115. /// <summary>
  116. /// 双击鼠标进行变量的选择和文本框内容的编写
  117. /// </summary>
  118. /// <param name="sender"></param>
  119. /// <param name="e"></param>
  120. private void _Content_MouseDoubleClick(object sender, MouseEventArgs e)
  121. {
  122. FrmIVREdit frm = new FrmIVREdit(_IVRAudioDTMF.Content);
  123. frm.Text = "播放内容定义";
  124. if (frm.ShowDialog() == DialogResult.OK)
  125. {
  126. this.rtb_Content.Text = frm.GetText();
  127. }
  128. }
  129. private void tcb_TTSSpeed_Scroll(object sender, EventArgs e)
  130. {
  131. this.label20.Text = tcb_TTSSpeed.Value.ToString();
  132. }
  133. private void tcb_TTSVolume_Scroll(object sender, EventArgs e)
  134. {
  135. this.label19.Text = tcb_TTSVolume.Value.ToString();
  136. }
  137. private void cmb_PlayType_SelectedIndexChanged(object sender, EventArgs e)
  138. {
  139. //if (cmb_PlayType.Text == "仅放音")
  140. //{
  141. // cmb_KeyVar.SelectedItem =null ;
  142. //}
  143. }
  144. private void button1_Click(object sender, EventArgs e)
  145. {
  146. cmb_KeyVar.SelectedItem =null ;
  147. }
  148. }
  149. }