| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- 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.Utility;
- using HySoft.IVRFlowEditor.IVRControlUtility;
- using IVRFlowEditor.IVRControlUtility;
- namespace IVRFlowEditor
- {
- public partial class CtlMenu : UserControl
- {
- public CtlMenu()
- {
- InitializeComponent();
- BindMenu();
- }
- Dictionary<string,string> Buttons = new Dictionary<string,string>();
- /// <summary>
- /// 绑定菜单控件
- /// </summary>
- public void BindMenu()
- {
- Buttons.Add("开始", "answer.gif");
- Buttons.Add("外呼号码", "dial.gif");
- Buttons.Add("呼叫转移", "trans.gif");
- Buttons.Add("变量", "var.gif");
- Buttons.Add("跳转子流程", "SubFlow.gif");
- Buttons.Add("放音收按键", "dtmf.gif");
- Buttons.Add("传真发送", "StringOperate.gif");
- Buttons.Add("传真接收", "StringOperate.gif");
- Buttons.Add("留言", "record.gif");
- Buttons.Add("请求排队", "WaitQueue.gif");
- Buttons.Add("继续排队", "QueueWait.gif");
- Buttons.Add("取消排队", "DropQueue.gif");
- Buttons.Add("转人工", "CreateData.gif");
- Buttons.Add("数据比较", "if.gif");
- Buttons.Add("算数运算", "CountCal.gif");
- Buttons.Add("分支节点", "case.gif");
- Buttons.Add("字符串操作", "StringOperate.gif");
- Buttons.Add("数据库读写", "DataBase.gif");
- Buttons.Add("数据集映射", "ParseData.gif");
- Buttons.Add("定时器", "timer.gif");
- Buttons.Add("SOCKET通讯", "AskQueue.gif");
- Buttons.Add("挂机", "onhook.gif");
- Buttons.Add("结束", "onhook.gif");
-
- int width = 90;
- int height = 60;
- int i=0;
- foreach (string key in Buttons.Keys)
- {
- Button btn = new Button();
- btn.Size = new System.Drawing.Size(width, height);
- btn.Text = key;
- btn.Click+=new EventHandler(btn_Click);
- btn.Location = new Point(i % 2 * width, i / 2 * height);
- if (!string.IsNullOrEmpty(Buttons[key]) && GlobalController.ControlImageList.Images.ContainsKey(Buttons[key]))
- {
- btn.Image = GlobalController.ControlImageList.Images[Buttons[key]];
- btn.ImageAlign = ContentAlignment.TopCenter;
- btn.TextAlign = ContentAlignment.BottomCenter;
- }
- this.Controls.Add(btn);
- i++;
- }
-
- }
-
- bool isCreate;
- /// <summary>
- /// 根据发生点击事件的控件名称创建相应的节点控件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btn_Click(object sender, EventArgs e)
- {
-
- isCreate = true;
- this.Cursor = Cursors.Hand;
- var button=(sender as Button);
-
- switch (button.Text)
- {
- case "开始": GlobalController.SetCreateNodeType(new IVRStartNode(button.Text), Buttons[button.Text]); break;
- case "外呼号码": GlobalController.SetCreateNodeType(new IVROutbound(button.Text), Buttons[button.Text]); break;
- case "呼叫转移": GlobalController.SetCreateNodeType(new IVRTransfeOut(button.Text), Buttons[button.Text]); break;
- case "变量": GlobalController.SetCreateNodeType(new IVRDefinevar(button.Text), Buttons[button.Text]); break;
- case "跳转子流程": GlobalController.SetCreateNodeType(new IVRSubflow(button.Text), Buttons[button.Text]); break;
- case "放音收按键": GlobalController.SetCreateNodeType(new IVRAudioDTMF(button.Text), Buttons[button.Text]); break;
- // case "排队组号": GlobalController.SetCreateNodeType(new IVRQueueBuildNumber(button.Text)); break;
- case "传真接收": GlobalController.SetCreateNodeType(new IVRRecvfax(button.Text), Buttons[button.Text]); break;
- case "传真发送": GlobalController.SetCreateNodeType(new IVRSendfax(button.Text), Buttons[button.Text]); break;
- case "留言": GlobalController.SetCreateNodeType(new IVRLeaveWord(button.Text), Buttons[button.Text]); break;
- case "请求排队": GlobalController.SetCreateNodeType(new IVRQueue(button.Text), Buttons[button.Text]); break;
- case "继续排队": GlobalController.SetCreateNodeType(new IVRContinueQueue(button.Text), Buttons[button.Text]); break;
- case "取消排队": GlobalController.SetCreateNodeType(new IVRCancelQueue(button.Text), Buttons[button.Text]); break;
- case "转人工": GlobalController.SetCreateNodeType(new IVRTurnagent(button.Text), Buttons[button.Text]); break;
- case "数据比较": GlobalController.SetCreateNodeType(new IVRCompare(button.Text), Buttons[button.Text]); break;
- case "算数运算": GlobalController.SetCreateNodeType(new IVRCalculate(button.Text), Buttons[button.Text]); break;
- case "分支节点": GlobalController.SetCreateNodeType(new IVRBranch(button.Text), Buttons[button.Text]); break;
- case "字符串操作": GlobalController.SetCreateNodeType(new IVRStringop(button.Text), Buttons[button.Text]); break;
- case "数据库读写": GlobalController.SetCreateNodeType(new IVRSql(button.Text), Buttons[button.Text]); break;
- case "数据集映射": GlobalController.SetCreateNodeType(new IVRRecordSet(button.Text), Buttons[button.Text]); break;
- case "定时器": GlobalController.SetCreateNodeType(new IVRTimer(button.Text), Buttons[button.Text]); break;
- case "挂机": GlobalController.SetCreateNodeType(new IVRHangUp(button.Text), Buttons[button.Text]); break;
- case "SOCKET通讯": GlobalController.SetCreateNodeType(new IVRSocket(button.Text), Buttons[button.Text]); break;
- case "结束": GlobalController.SetCreateNodeType(new IVREndNode(button.Text), Buttons[button.Text]); break;
-
- }
-
- }
- private void listView1_MouseLeave(object sender, EventArgs e)
- {
- if (isCreate)
- this.Cursor = Cursors.No;
- isCreate = false;
- }
- private void listView1_MouseMove(object sender, MouseEventArgs e)
- {
- this.Cursor = Cursors.Arrow;
- }
- }
- }
|