| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using HySoft.FlowEditor;
- using HySoft.IVRFlowEditor.Utility;
- using HySoft.IVRFlowEditor.IVRControl;
- using HySoft.IVRFlowEditor.Propretity;
- using System.Reflection;
- using HySoft.IVRFlowEditor.Model;
- using HySoft.IVRFlowEditor.IVRControlUtility;
- using IVRFlowEditor.IVRControlUtility;
- namespace IVRFlowUI
- {
- public partial class FrmMain : Form
- {
- public FrmMain()
- {
- InitializeComponent();
- CreateBaseTabPage();
- _Menu = new System.Windows.Forms.ContextMenu();
- BindRightMeun();
- BindSelectContextMenuControl();
- BindPic();
- }
- //2017-5-11绑定图标
- #region 绑定图标
- Dictionary<string, string> NodePic = new Dictionary<string, string>();
- private void BindPic()
- {
- #region 2019-7-25 注释掉
- NodePic.Add("开始", "answer.gif");
- NodePic.Add("外呼号码", "dial.gif");
- NodePic.Add("呼叫转移", "trans.gif");
- NodePic.Add("变量", "var.gif");
- NodePic.Add("跳转子流程", "SubFlow.gif");
- NodePic.Add("放音收按键", "dtmf.gif");
- NodePic.Add("传真发送", "StringOperate.gif");
- NodePic.Add("传真接收", "StringOperate.gif");
- NodePic.Add("留言", "record.gif");
- NodePic.Add("请求排队", "WaitQueue.gif");
- NodePic.Add("继续排队", "QueueWait.gif");
- NodePic.Add("取消排队", "DropQueue.gif");
- NodePic.Add("转人工", "CreateData.gif");
- NodePic.Add("数据比较", "if.gif");
- NodePic.Add("算数运算", "CountCal.gif");
- NodePic.Add("分支节点", "case.gif");
- NodePic.Add("字符串操作", "StringOperate.gif");
- NodePic.Add("数据库读写", "DataBase.gif");
- NodePic.Add("数据集映射", "ParseData.gif");
- NodePic.Add("定时器", "timer.gif");
- NodePic.Add("SOCKET通讯", "AskQueue.gif");
- NodePic.Add("挂机", "onhook.gif");
- NodePic.Add("结束", "onhook.gif");
- #endregion
- NodePic.Add("CELL_START", "answer.gif");
- NodePic.Add("CELL_CALL", "dial.gif");
- NodePic.Add("CELL_TRANSFEROUT", "trans.gif");
- NodePic.Add("CELL_DEFINEVAR", "var.gif");
- NodePic.Add("CELL_SUBFLOW", "SubFlow.gif");
- NodePic.Add("CELL_AUDIODTMF", "dtmf.gif");
- NodePic.Add("CELL_SENDFAX", "StringOperate.gif");
- NodePic.Add("CELL_RECVFAX", "StringOperate.gif");
- NodePic.Add("CELL_LEAVEWORD", "record.gif");
- NodePic.Add("CELL_QUEUE", "WaitQueue.gif");
- NodePic.Add("CELL_CONTINUEQUEUE", "QueueWait.gif");
- NodePic.Add("CELL_CANCELQUEUE", "DropQueue.gif");
- NodePic.Add("CELL_TURNAGENT", "CreateData.gif");
- NodePic.Add("CELL_COMPARE", "if.gif");
- NodePic.Add("CELL_CALCULATE", "CountCal.gif");
- NodePic.Add("CELL_BRANCH", "case.gif");
- NodePic.Add("CELL_STRINGOP", "StringOperate.gif");
- NodePic.Add("CELL_SQL", "DataBase.gif");
- NodePic.Add("CELL_RECORDSET", "ParseData.gif");
- NodePic.Add("CELL_TIMER", "timer.gif");
- NodePic.Add("CELL_SOCKET", "AskQueue.gif");
- NodePic.Add("CELL_HANGUP", "onhook.gif");
- NodePic.Add("CELL_END", "onhook.gif");
- }
- #endregion
- #region 绑定菜单栏事件
- private ContextMenu _Menu;
- /// <summary>
- /// 绑定右键菜单
- /// </summary>
- private void BindRightMeun()
- {
- MenuItem menuCheckAll = new MenuItem("全选(Ctrl+A)", new EventHandler(OnMenuItemClick));
- _Menu.MenuItems.Add(menuCheckAll);
- MenuItem menuCopy = new MenuItem("复制(Ctrl+C)", new EventHandler(OnMenuItemClick));
- _Menu.MenuItems.Add(menuCopy);
- MenuItem menuPaste = new MenuItem("粘贴(Ctrl+V)", new EventHandler(OnMenuItemClick));
- _Menu.MenuItems.Add(menuPaste);
- MenuItem menuDelete = new MenuItem("删除(Delete)", new EventHandler(OnMenuItemClick));
- _Menu.MenuItems.Add(menuDelete);
- MenuItem menuAdd = new MenuItem("放大(Ctrl++)", new EventHandler(OnMenuItemClick));
- _Menu.MenuItems.Add(menuAdd);
- MenuItem menuOemplus = new MenuItem("缩小(Ctrl+-)", new EventHandler(OnMenuItemClick));
- _Menu.MenuItems.Add(menuOemplus);
- }
- #endregion
- #region 鼠标右键菜单以及快捷键处理
-
- private List<FlowNode> CopyNodes;
- private List<FlowLine> CopyLines;
- /// <summary>
- /// 右键菜单和快捷键转换成命令字符统一进行相应的处理的函数
- /// </summary>
- /// <param name="type"></param>
- private void KeyAndMenuHandle(string type)
- {
- switch (type)
- {
- case "Control C":
- CopyLines = CopyLines == null ? CopyLines = new List<FlowLine>() : CopyLines;
- CopyLines.Clear();
- CopyNodes = CopyNodes == null ? CopyNodes = new List<FlowNode>() : CopyNodes;
- CopyNodes.Clear();
- if (GlobalController._SelectCanvas.SelectedLines != null)
- foreach (FlowLine f in GlobalController._SelectCanvas.SelectedLines)
- {
- FlowLine o = new FlowLine();
- o.LineColor = f.LineColor;
- o.Name = f.Name;
- o.Note = f.Note;
-
- o.SelectedLineColor = f.SelectedLineColor;
- o.Control.LineWidth = f.Control.LineWidth;
- o.HeadNodePort = f.HeadNodePort;
- o.TailNodePort = f.TailNodePort;
- CopyLines.Add(o);
- }
- if (GlobalController._SelectCanvas.SelectedNodes != null)
- foreach (FlowNode f in GlobalController._SelectCanvas.SelectedNodes)
- {
- ConstructorInfo ci = f.GetType().GetConstructor(new List<Type>{typeof(String),}.ToArray());
- IVRControlBase o = ci.Invoke(new List<object>{ f.Name+"_1"}.ToArray()) as IVRControlBase;
- // FlowNode o = new FlowNode(f.Size);
- o.Control.Size = f.Size;
- o.Name = f.Name + "_1";
- o.CenterPoint = f.CenterPoint;
- o.Image = f.Image;
- foreach (NodePort n in f.InputPortList)
- o.AddInputPort(n);
- foreach (NodePort n in f.OutputPortList)
- o.AddOutputPort(n);
- o.SelectedImage = f.SelectedImage;
- this.CopyNodes.Add(o);
- }
- break;
- case "Control A":
- GlobalController._SelectCanvas.SetSelectedNodes(GlobalController._SelectCanvas.NodeList.ToArray());
- GlobalController._SelectCanvas.SetSelectedLines(GlobalController._SelectCanvas.LineList.ToArray());
- break;
- case "Control V":
- if (CopyNodes != null)
- {
- foreach (IVRControlBase f in CopyNodes)
- {
- f.Pos = GlobalController._SelectCanvas.NodeList.Count.ToString();
- f.Control.DoubleClick += new EventHandler(Control_DoubleClick);
- GlobalController.SetCurrentCancasIVRControlBase(f);
- GlobalController._SelectCanvas.AddANode(f);
- }
- GlobalController._SelectCanvas.SetSelectedNodes(CopyNodes.ToArray());
- }
- if (CopyLines != null)
- {
- foreach (FlowLine f in CopyLines)
- {
- GlobalController._SelectCanvas.AddALine(f, this.CopyNodes.Find(a => a.InputPortList.Contains(f.HeadNodePort)), this.CopyNodes.Find(a => a.OutputPortList.Contains(f.TailNodePort)));
- }
- GlobalController._SelectCanvas.SetSelectedLines(CopyLines.ToArray());
- }
- CopyLines.Clear();
- CopyNodes.Clear();
- break;
- case "Control S":
- SaveFileDialog svf = new SaveFileDialog();
- svf.Filter = "XML文件|*.xml";
- svf.InitialDirectory = Application.StartupPath;
- //2017-4-26
- #region 直接按原文件名进行保存
- bool pd = false;
- string fp = this.tabControl1.SelectedTab.Text;
- if (this.tabControl1.SelectedTab.Text != "空白标签")
- {
- int ffp = fp.IndexOf(".xml");
- int startindex = fp.LastIndexOf("\\");
- int leng = ffp - startindex - 1;
- string fn = fp.Substring(startindex + 1, leng);
- svf.FileName = this.tabControl1.SelectedTab.Text;//fn;
- pd = true;
- }
- else
- {
- if (svf.ShowDialog() == DialogResult.OK)
- {
- pd = true;
- }
- }
- #endregion
- if(pd==true)//if (svf.ShowDialog() == DialogResult.OK)
- {
- List<IVRFlowSerializerInfo> f = new List<IVRFlowSerializerInfo>();
- foreach(TabPage tp in this.tabControl1.SelectedTab.Controls[0].Controls)
- {
- FlowEditorCanvas ct = (FlowEditorCanvas)tp.Controls[0];
- //f.Add(new IVRFlowSerializerInfo() { IVR_Name = tp.Name, IVR_Text=tp.Text, IVRFlowType = (IVRFlowType) tp.Tag, IVRControl = new List<IVRControlBase>() }); //2019-7-25 注释掉
- f.Add(new IVRFlowSerializerInfo() { IVR_Text = tp.Text, IVRFlowType = (IVRFlowType)tp.Tag, IVRControl = new List<IVRControlBase>() });
- for (int i=0;i<ct.NodeList.Count;i++)
- {
- if (ct.NodeList[i].ID!="0")
- f[f.Count-1].IVRControl.Add((IVRControlBase)ct.NodeList[i]);
- }
-
- }
- MessageInfo msg =GlobalController.GetSerializerHandle().SaveFileInfo(svf.FileName, f);
- MessageBox.Show(msg.Message);
- this.tabControl1.SelectedTab.Text = svf.FileName;
- }
- break;
- //2017-4-27
- case "Control SAVEAS":
- SaveFileDialog svfa = new SaveFileDialog();
- svfa.Filter = "XML文件|*.xml";
- svfa.InitialDirectory = Application.StartupPath;
-
- if (svfa.ShowDialog() == DialogResult.OK)
- {
- List<IVRFlowSerializerInfo> f = new List<IVRFlowSerializerInfo>();
- foreach (TabPage tp in this.tabControl1.SelectedTab.Controls[0].Controls)
- {
- FlowEditorCanvas ct = (FlowEditorCanvas)tp.Controls[0];
- //f.Add(new IVRFlowSerializerInfo() { IVR_Name = tp.Name, IVR_Text = tp.Text, IVRFlowType = (IVRFlowType)tp.Tag, IVRControl = new List<IVRControlBase>() });//2019-7-25 注释掉
- f.Add(new IVRFlowSerializerInfo() { IVR_Text = tp.Text, IVRFlowType = (IVRFlowType)tp.Tag, IVRControl = new List<IVRControlBase>() });
- for (int i = 0; i < ct.NodeList.Count; i++)
- {
- if (ct.NodeList[i].ID != "0")
- f[f.Count - 1].IVRControl.Add((IVRControlBase)ct.NodeList[i]);
- }
- }
- MessageInfo msg = GlobalController.GetSerializerHandle().SaveFileInfo(svfa.FileName, f);
- MessageBox.Show(msg.Message);
- this.tabControl1.SelectedTab.Text = svfa.FileName;
- }
- break;
- case "Control O":
- OpenFileDialog opf = new OpenFileDialog();
- opf.Filter = "XML文件|*.xml";
- opf.InitialDirectory = Application.StartupPath;
- if (opf.ShowDialog() == DialogResult.OK)
- {
- List<IVRFlowSerializerInfo> f = new List<IVRFlowSerializerInfo>();
- MessageInfo msg = GlobalController.GetSerializerHandle().OpenFileInfo(opf.FileName, ref f);
- if (!msg.State)
- {
- MessageBox.Show(msg.Message);
- return;
- }
- if (f == null || f.Count == 0)
- {
- MessageBox.Show("没有解析到数据内容!");
- return;
- }
- TabPage tab1 = new TabPage();
- tab1.Text = opf.FileName;//获取带路径的文件名
- //string filen = opf.SafeFileName;//不带路径的文件名(包含扩展名)
- //string fn = System.IO .Path.GetFileNameWithoutExtension(@opf.FileName);//不带路径的文件名(不含扩展名)
- tab1.Name = this.tabControl1.Controls.Count.ToString();
- GlobalController.IVRCancas.Remove(tab1.Name);//2017-4-27添加,解决关闭再打开同一个项目时报错的问题
- GlobalController.IVRCancas.Add(tab1.Name, new IVRCanvas());
- TabControl tb = new TabControl();
- tb.Dock = DockStyle.Fill;
- tb.Name = this.tabControl1.Controls.Count.ToString();
- tb.SelectedIndexChanged += new EventHandler(tabControl_SelectedIndexChanged);
- tab1.Controls.Add(tb);
- this.tabControl1.Controls.Add(tab1);
-
- foreach (IVRFlowSerializerInfo ivrflow in f)
- {
- TabPage tab=new TabPage(ivrflow.IVR_Name);
- tab.Name =ivrflow.IVR_Name;
- tab.Tag = ivrflow.IVRFlowType;
- tab.Text = ivrflow.IVR_Text;
- FlowEditorCanvas canvas = new FlowEditorCanvas();
- canvas.Name = tab.Name = GlobalController.IVRCancas[tb.Name].IVRFlows.Count.ToString();
-
- GlobalController.IVRCancas[tb.Name].IVRFlows.Add(canvas.Name, new IVRFlowInfo() { FlowID = canvas.Name, FlowName = tab.Text });
- canvas.Dock = DockStyle.Fill;
- canvas.MouseUp += new MouseEventHandler(f_MouseUp);
- canvas.MouseMove += new MouseEventHandler(f_MouseMove);
- tab.Controls.Add(canvas);
-
- tb.Controls.Add(tab);
- tb.SelectedTab = tab;
- GlobalController._SelectTabControl = tb;
- GlobalController._SelectCanvas = canvas;
- foreach (IVRControlBase ivrControl in ivrflow.IVRControl)
- {
- ivrControl.Control.DoubleClick += new EventHandler(Control_DoubleClick);
- //2017-5-11测试添加图片显示
- ivrControl.Image = GlobalController.ControlImageList.Images[NodePic[ivrControl.Name ]];
- canvas.AddANode(ivrControl);
- GlobalController.SetCurrentCancasIVRControlBase(ivrControl);
- }
- GlobalController.SetFlowVar(ivrflow.IVRVar);
-
- foreach (LineInfo line in ivrflow.LineNodes)
- {
- if (canvas.NodeList.Find(a => a.ID == line.StartNodeID).GetType().GetProperty(line.AttributeName) != null)
- canvas.NodeList.Find(a => a.ID == line.StartNodeID).GetType().GetProperty(line.AttributeName).SetValue(canvas.NodeList.Find(a => a.ID == line.StartNodeID), canvas.NodeList.Find(a => a.ID == line.EndNodeID), null);
- if (line.StartNodeID != null && line.StartNodeID != "" && line.EndNodeID != null && line.EndNodeID != "")
- {
- if (canvas.NodeList.Find(a => a.ID == line.StartNodeID) != null && canvas.NodeList.Find(a => a.ID == line.EndNodeID) != null)
- {
- canvas.AddALine(GetNewFlowLine(), canvas.NodeList.Find(a => a.ID == line.StartNodeID), canvas.NodeList.Find(a => a.ID == line.EndNodeID));
- }
- else
- {
- MessageBox.Show("流程文件中有不存在的节点"+ line.StartNodeID+ "或"+line.EndNodeID);
- }
- }
- }
- //2017-5-9
- foreach (LineInfo line in ivrflow.FailLineNodes)
- {
- if (canvas.NodeList.Find(a => a.ID == line.StartNodeID).GetType().GetProperty(line.AttributeName) != null)
- canvas.NodeList.Find(a => a.ID == line.StartNodeID).GetType().GetProperty(line.AttributeName).SetValue(canvas.NodeList.Find(a => a.ID == line.StartNodeID), canvas.NodeList.Find(a => a.ID == line.EndNodeID), null);
- canvas.AddALine(GetNewFlowLineFail(), canvas.NodeList.Find(a => a.ID == line.StartNodeID), canvas.NodeList.Find(a => a.ID == line.EndNodeID));
- }
- }
-
- tb.SelectedIndexChanged += new EventHandler(tabControl_SelectedIndexChanged);
- this.tabControl1.SelectedTab = tab1;
-
- MessageBox.Show(msg.Message);
- }
- break;
- case "Control Oemplus":
- case "Control Add":
- foreach (FlowLine f in GlobalController._SelectCanvas.LineList)
- {
- f.Control.LineWidth += 1;
- }
- foreach (FlowNode f in GlobalController._SelectCanvas.NodeList)
- {
- f.Control.Width += 10;
- f.Control.Height += 10;
- // canvas.ResetNodeLines(f);
- }
- this.Refresh();
- break;
- case "Control Subtract":
- case "Control OemMinus":
- foreach (FlowLine f in GlobalController._SelectCanvas.LineList)
- {
- f.Control.LineWidth += -1;
- }
- foreach (FlowNode f in GlobalController._SelectCanvas.NodeList)
- {
- f.Control.Width += -10;
- f.Control.Height += -10;
- // ResetNodeLines(f);
- }
- this.Refresh();
- break;
- case "Control ControlKey": break;
- case "None Delete":
- if (MessageBox.Show("是否要删除选中的节点?", "消息提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- if (GlobalController._SelectCanvas.SelectedLines != null)
- foreach (FlowLine f in GlobalController._SelectCanvas.SelectedLines)
- {
- GlobalController._SelectCanvas.DelLine(f, true, true);
- }
- if (GlobalController._SelectCanvas.SelectedNodes != null)
- foreach (FlowNode f in GlobalController._SelectCanvas.SelectedNodes)
- {
- GlobalController._SelectCanvas.DelNode(f);
- GlobalController.IVRCancas[GlobalController._SelectTabControl.Name].IVRFlows[GlobalController._SelectCanvas.Name].IVRFlowNode.Remove(f as IVRControlBase);
- }
- } break;
- default: MessageBox.Show("组合键无效!"); break;
- }
- }
- #region 菜单栏点击事件转换为快捷键事件
- /// <summary>
- /// 菜单栏点击事件转换为快捷键事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- public void OnMenuItemClick(object sender, EventArgs e)
- {
-
- switch (sender.GetType().GetProperty("Text").GetValue(sender, null).ToString())
- {
- case "全选":
- case "全选(Ctrl+A)":
- KeyAndMenuHandle("Control A"); break;
- case "复制":
- case "复制(Ctrl+C)":
- KeyAndMenuHandle("Control C"); break;
- case "粘贴":
- case "粘贴(Ctrl+V)":
- KeyAndMenuHandle("Control V"); break;
- case "删除":
- case "删除(Delete)":
- KeyAndMenuHandle("None Delete"); break;
- case "放大":
- case "放大(Ctrl++)":
- KeyAndMenuHandle("Control Oemplus"); break;
- case "缩小":
- case "缩小(Ctrl+-)":
- KeyAndMenuHandle("Control OemMinus"); break;
- }
- }
- #endregion
- #endregion
- /// <summary>
- /// 画布双击事件
- /// </summary>
- /// <param name="f"></param>
- private void flowEditorCanvas1_DoubleClick(FlowNode f)
- {
- ShowNodeProperty(f);
- }
- #region 绑定右键菜单
- /// <summary>
- /// 绑定右键菜单
- /// </summary>
- private void BindSelectContextMenuControl()
- {
- if(this.tabControl1.Controls.Count>0)
- foreach (Control c in this.tabControl1.SelectedTab.Controls)
- {
- if (c.GetType() == typeof(TabControl))
- {
- GlobalController._SelectTabControl = (c as TabControl);
- (c as TabControl).SelectedTab.Controls[0].ContextMenu = _Menu;
- GlobalController._SelectCanvas = ((c as TabControl).SelectedTab.Controls[0] as FlowEditorCanvas);
- BindTreeNodes(GlobalController._SelectTabControl.Controls);
- }
- }
- }
- #endregion
- /// <summary>
- /// 绑定流程的树形结构
- /// </summary>
- /// <param name="con"></param>
- private void BindTreeNodes(Control.ControlCollection con)
- {
- this.treeView1.Nodes.Clear();
- this.treeView1.ImageList = GlobalController.ControlImageList;
- TreeNode t;
-
- foreach (TabPage o in con)
- {
-
- switch ((IVRFlowType)o.Tag)
- {
- case IVRFlowType.auto:
- t = new TreeNode() { Text = o.Text, SelectedImageKey= "OverFlow.gif", ImageKey = "OverFlow.gif" };
- t.Tag = o;
- this.treeView1.Nodes.Add(t);
- break;
- case IVRFlowType.normal:
- t = new TreeNode() { Text = o.Text, SelectedImageKey = "RotorFlow.gif", ImageKey = "RotorFlow.gif" };
- t.Tag = o;
- this.treeView1.Nodes.Add(t);
- break;
- case IVRFlowType.sub:
- t = new TreeNode() { Text = o.Text, SelectedImageKey = "SubFlowOver.gif", ImageKey = "SubFlowOver.gif" };
- t.Tag = o;
- this.treeView1.Nodes.Add(t);
- break;
- }
- }
- }
- /// <summary>
- /// 流程选择事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tabControl_SelectedIndexChanged(object sender, EventArgs e)
- {
- BindSelectContextMenuControl();
- }
- /// <summary>
- /// 捕捉鼠标按下事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void FrmMain_KeyDown(object sender, KeyEventArgs e)
- {
- KeyAndMenuHandle(e.Modifiers + " " + e.KeyCode);
- }
- #region 加载时初始化的空白页和新建空白项目时调用
- /// <summary>
- /// 初始化的空白标签
- /// </summary>
- public void CreateBaseTabPage()
- {
- TabPage t = new TabPage() { Dock = DockStyle.Fill };
- t.Text = "空白标签";
- this.tabControl1.Controls.Add(t);
- this.tabControl1.SelectedTab = t;
-
- TabControl tab = new TabControl() { Dock = DockStyle.Fill };
- tab.Name = GlobalController.IVRCancas.Count.ToString();
- GlobalController.IVRCancas.Add(tab.Name, new IVRCanvas());
- tab.SelectedIndexChanged += new EventHandler(tabControl_SelectedIndexChanged);
- TabPage tab1 = new TabPage();
- FlowEditorCanvas f = new FlowEditorCanvas(); GlobalController._SelectCanvas = f;
- f.Dock = DockStyle.Fill;
- f.MouseUp += new MouseEventHandler(f_MouseUp);
- f.MouseMove += new MouseEventHandler(f_MouseMove);
- tab1.Controls.Add(f);
- tab1.Tag = IVRFlowType.normal;
- tab1.Text = "普通流程";
- f.Name = GlobalController.IVRCancas[tab.Name].IVRFlows.Count.ToString();
- GlobalController.IVRCancas[tab.Name].IVRFlows.Add(f.Name, new IVRFlowInfo() { FlowID=f.Name, FlowName=tab1.Text});
- TabPage tab2 = new TabPage();
- f = new FlowEditorCanvas();
- f.Dock = DockStyle.Fill;
- f.MouseUp += new MouseEventHandler(f_MouseUp);
- f.MouseMove += new MouseEventHandler(f_MouseMove);
- tab2.Controls.Add(f);
- tab2.Text = "自动流程";
- tab2.Tag = IVRFlowType.auto;
- f.Name = GlobalController.IVRCancas[tab.Name].IVRFlows.Count.ToString();
- GlobalController.IVRCancas[tab.Name].IVRFlows.Add(f.Name, new IVRFlowInfo() { FlowID = f.Name, FlowName = tab2.Text });
- TabPage tab3 = new TabPage();
- f = new FlowEditorCanvas();
- f.Dock = DockStyle.Fill;
- f.MouseUp += new MouseEventHandler(f_MouseUp);
- f.MouseMove += new MouseEventHandler(f_MouseMove);
- f.Name = GlobalController.IVRCancas[tab.Name].IVRFlows.Count.ToString();
- tab3.Text = "子流程";
- GlobalController.IVRCancas[tab.Name].IVRFlows.Add(f.Name, new IVRFlowInfo() { FlowID = f.Name, FlowName = tab3.Text });
- tab3.Controls.Add(f);
- tab3.Tag = IVRFlowType.sub;
- t.Controls.Add(tab);
- tab.Controls.Add(tab1);
- tab.Controls.Add(tab2);
- tab.Controls.Add(tab3);
-
- BindTreeNodes(tab.Controls);
-
-
- tab.SelectedTab = tab1;
-
- GlobalController._SelectTabControl = tab;
- }
- #endregion
- #region 鼠标弹起事件,监测是否创建控件以及创建控件
- void f_MouseUp(object sender, MouseEventArgs e)
- {
- if (GlobalController.CheckCreateNode())
- {
- int id=0;
- if((sender as FlowEditorCanvas).NodeList!=null&&(sender as FlowEditorCanvas).NodeList.Count!=0)
- id = (sender as FlowEditorCanvas).NodeList.Max(a =>Int32.Parse(a.ID));
- //string nodekind= (sender as FlowEditorCanvas).NodeList.Max(a =>a.Control .NodeName);
- IVRControlBase node = GlobalController.CreateNode((id+1).ToString());
- node.Pos = (id + 1).ToString();
- Point p = new Point(0, 0);
- p = (sender as FlowEditorCanvas).PointToClient(p);
- Point CurcorPoint = new Point(Cursor.Position.X + p.X, Cursor.Position.Y + p.Y);
- node.CenterPoint = CurcorPoint;
- node.Control.DoubleClick += new EventHandler(Control_DoubleClick);
- node .Image = GlobalController.ControlImageList.Images[NodePic[node .Name]];//2017-5-11
- //2017-5-8添加,用于选择下一端口时用
- if (node.Note==null||node.Note == "")
- {
- node.Note = node.Name+" "+node .Pos;
- }
- GlobalController.SetCurrentCancasIVRControlBase(node);
- (sender as FlowEditorCanvas).AddANode(node);
-
-
- }
- }
- #endregion
- #region 创建新的连接线
- /// <summary>
- /// 创建新连线
- /// </summary>
- /// <returns></returns>
- private FlowLine GetNewFlowLine()
- {
- FlowLine line1 = new FlowLine();
- line1.LineColor = Color.Lime ;
- line1.SelectedLineColor = Color.Blue ;
- line1.LineWidth = 1;
- return line1;
- }
- #endregion
- //2017-5-9
- #region 创建新的失败连接线
- /// <summary>
- /// 创建新连线
- /// </summary>
- /// <returns></returns>
- private FlowLine GetNewFlowLineFail()
- {
- FlowLine line1 = new FlowLine();
- line1.LineColor = Color.Red;
- line1.SelectedLineColor = Color.Blue;
- line1.LineWidth = 1;
- return line1;
- }
- #endregion
- #region 遍历所有IVR控件并根据控件类型显示不同的属性并在确定后重绘
- private void ShowNodeProperty(FlowNode obj)
- {
- var ivr = (obj as IVRControlBase);
- var ctl=ivr.CtlProperty;
-
- ivr.IVRFlows = GlobalController.IVRCancas[GlobalController._SelectTabControl.Name].IVRFlows.Values.ToList();
- FrmProPretity frm = new FrmProPretity(ref ivr);
- frm.Text = ivr.Name;
- if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- if (ivr.InputPortList != null)
-
- for (int i = ivr.InputPortList.Count; i > 0; i--)
- {
- GlobalController._SelectCanvas.DelLine(ivr.InputPortList[i-1].Line, true, true);
-
- ivr.RemoveInputPort(ivr.InputPortList[i-1]);
-
- }
- if (ivr.GetType() == typeof(IVRStartNode))
- {
- var iVRStartNode = ivr as IVRStartNode;
- if (iVRStartNode.Next != null && iVRStartNode.Next != ivr && iVRStartNode.Next.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRStartNode.Next);
- }
- }
- else if (ivr.GetType() == typeof(IVRTransfeOut))//ivr.GetType() == typeof(IVROutbound)||//2017-4-27修改
- {
- var iVROutbound = ivr as IVRTransfeOut;
- if (iVROutbound.SuccessPos != null && iVROutbound.SuccessPos != ivr && iVROutbound.SuccessPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVROutbound.SuccessPos);
- }
- if (iVROutbound.FailPos != null && iVROutbound.FailPos != ivr && iVROutbound.FailPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLineFail(), ivr, iVROutbound.FailPos);//2017-5-9将GetNewFlowLine改为GetNewFlowLineFail
- }
- }
- //2017-4-27 添加
- else if (ivr.GetType() == typeof(IVROutbound))
- {
- var iVROutbound = ivr as IVROutbound;
- if (iVROutbound.SuccessPos != null && iVROutbound.SuccessPos != ivr && iVROutbound.SuccessPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVROutbound.SuccessPos);
- }
- if (iVROutbound.FailPos != null && iVROutbound.FailPos != ivr && iVROutbound.FailPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLineFail(), ivr, iVROutbound.FailPos);//2017-5-9将GetNewFlowLine改为GetNewFlowLineFail
- }
- }
- else if (ivr.GetType() == typeof(IVRDefinevar))
- {
- var iVRDefinevar = (ivr as IVRDefinevar);
- if (iVRDefinevar.Next != null && iVRDefinevar.Next != ivr && iVRDefinevar.Next.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRDefinevar.Next);
- }
- }
- else if (ivr.GetType() == typeof(IVRSubflow))
- {
- var iVRSubflow = (ivr as IVRSubflow);
- if (iVRSubflow.Next != null && iVRSubflow.Next != ivr && iVRSubflow.Next.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRSubflow.Next);
- }
- }
- else if (ivr.GetType() == typeof(IVRAudioDTMF))
- {
- var iVRAudioDTMF = (ivr as IVRAudioDTMF);
- if (iVRAudioDTMF.SuccessPos != null && iVRAudioDTMF.SuccessPos != ivr && iVRAudioDTMF.SuccessPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRAudioDTMF.SuccessPos);
- }
- if (iVRAudioDTMF.FailPos != null && iVRAudioDTMF.FailPos != ivr && iVRAudioDTMF.FailPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLineFail(), ivr, iVRAudioDTMF.FailPos);//2017-5-9将GetNewFlowLine改为GetNewFlowLineFail
- }
- if (iVRAudioDTMF.HangupPos != null && iVRAudioDTMF.HangupPos != ivr && iVRAudioDTMF.HangupPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRAudioDTMF.HangupPos);
- }
- }
- else if (ivr.GetType() == typeof(IVRSendfax) || ivr.GetType() == typeof(IVRRecvfax))
- {
- var iVRSendfax = (ivr as IVRSendfax);
- if (iVRSendfax.SuccessPos != null && iVRSendfax.SuccessPos != ivr && iVRSendfax.SuccessPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRSendfax.SuccessPos);
- }
- if (iVRSendfax.FailPos != null && iVRSendfax.FailPos != ivr && iVRSendfax.FailPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLineFail(), ivr, iVRSendfax.FailPos);//2017-5-9将GetNewFlowLine改为GetNewFlowLineFail
- }
- if (iVRSendfax.HangupPos != null && iVRSendfax.HangupPos != ivr && iVRSendfax.HangupPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRSendfax.HangupPos);
- }
- }
- else if (ivr.GetType() == typeof(IVRLeaveWord))
- {
- var iVRLeaveWord = (ivr as IVRLeaveWord);
- if (iVRLeaveWord.TimeoutPos != null && iVRLeaveWord.TimeoutPos != ivr && iVRLeaveWord.TimeoutPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRLeaveWord.TimeoutPos);
- }
- if (iVRLeaveWord.HangupPos != null && iVRLeaveWord.HangupPos != ivr && iVRLeaveWord.TimeoutPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRLeaveWord.HangupPos);
- }
- if (iVRLeaveWord.FinishPos != null && iVRLeaveWord.FinishPos != ivr && iVRLeaveWord.TimeoutPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRLeaveWord.FinishPos);
- }
- }
- else if (ivr.GetType() == typeof(IVRQueue))
- {
- var iVRQueue = (ivr as IVRQueue);
- if (iVRQueue.HangupPos != null && iVRQueue.HangupPos != ivr && iVRQueue.HangupPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRQueue.HangupPos);
- }
- if (iVRQueue.SuccessPos != null && iVRQueue.SuccessPos != ivr && iVRQueue.SuccessPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRQueue.SuccessPos);
- }
- if (iVRQueue.NoAgentPos != null && iVRQueue.NoAgentPos != ivr && iVRQueue.NoAgentPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRQueue.NoAgentPos);
- }
- if (iVRQueue.NoFreePos != null && iVRQueue.NoFreePos != ivr && iVRQueue.NoFreePos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRQueue.NoFreePos);
- }
- }
- else if (ivr.GetType() == typeof(IVRContinueQueue))
- {
- var iVRContinueQueue = (ivr as IVRContinueQueue);
- if (iVRContinueQueue.TimeoutPos != null && iVRContinueQueue.TimeoutPos != ivr && iVRContinueQueue.TimeoutPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRContinueQueue.TimeoutPos);
- }
- if (iVRContinueQueue.HangupPos != null && iVRContinueQueue.HangupPos != ivr && iVRContinueQueue.HangupPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRContinueQueue.HangupPos);
- }
- if (iVRContinueQueue.SuccessPos != null && iVRContinueQueue.SuccessPos != ivr && iVRContinueQueue.SuccessPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRContinueQueue.SuccessPos);
- }
- }
- else if (ivr.GetType() == typeof(IVRCancelQueue))
- {
- var iVRCancelQueue = (ivr as IVRCancelQueue);
- if (iVRCancelQueue.Next != null && iVRCancelQueue.Next != ivr && iVRCancelQueue.Next.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRCancelQueue.Next);
- }
- }
- else if (ivr.GetType() == typeof(IVRTurnagent))
- {
- var iVRTurnagent = (ivr as IVRTurnagent);
- if (iVRTurnagent.FailPos != null && iVRTurnagent.FailPos != ivr && iVRTurnagent.FailPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLineFail(), ivr, iVRTurnagent.FailPos);//2017-5-9将GetNewFlowLine改为GetNewFlowLineFail
- }
- if (iVRTurnagent.HangupPos != null && iVRTurnagent.HangupPos != ivr && iVRTurnagent.HangupPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRTurnagent.HangupPos);
- }
- if (iVRTurnagent.SuccessPos != null && iVRTurnagent.SuccessPos != ivr && iVRTurnagent.SuccessPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRTurnagent.SuccessPos);
- }
- }
- else if (ivr.GetType() == typeof(IVRCompare))
- {
- var iVRCompare = (ivr as IVRCompare);
- if (iVRCompare.TruePos != null && iVRCompare.TruePos != ivr && iVRCompare.TruePos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRCompare.TruePos);
- }
- if (iVRCompare.FalsePos != null && iVRCompare.FalsePos != ivr && iVRCompare.FalsePos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRCompare.FalsePos);
- }
- }
- else if (ivr.GetType() == typeof(IVRCalculate))
- {
- var iVRCalculate = (ivr as IVRCalculate);
- if (iVRCalculate.Next != null && iVRCalculate.Next != ivr && iVRCalculate.Next.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRCalculate.Next);
- }
- }
- else if (ivr.GetType() == typeof(IVRStringop))
- {
- var iVRStringop = (ivr as IVRStringop);
- if (iVRStringop.Next != null && iVRStringop.Next != ivr && iVRStringop.Next.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRStringop.Next);
- }
- if (iVRStringop.TruePos != null && iVRStringop.TruePos != ivr && iVRStringop.TruePos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRStringop.TruePos);
- }
- if (iVRStringop.FalsePos != null && iVRStringop.FalsePos != ivr && iVRStringop.FalsePos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRStringop.FalsePos);
- }
- }
- else if (ivr.GetType() == typeof(IVRSql))
- {
- var iVRSql = (ivr as IVRSql);
- if (iVRSql.SuccessPos != null && iVRSql.SuccessPos != ivr && iVRSql.SuccessPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRSql.SuccessPos);
- }
- if (iVRSql.FailPos != null && iVRSql.FailPos != ivr && iVRSql.FailPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLineFail(), ivr, iVRSql.FailPos);//2017-5-9将GetNewFlowLine改为GetNewFlowLineFail
- }
- }
- else if (ivr.GetType() == typeof(IVRRecordSet))
- {
- var iVRRecordSet = (ivr as IVRRecordSet);
- if (iVRRecordSet.LPos != null && iVRRecordSet.LPos != ivr && iVRRecordSet.LPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRRecordSet.LPos);
- }
- if (iVRRecordSet.EPos != null && iVRRecordSet.EPos != ivr && iVRRecordSet.EPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRRecordSet.EPos);
- }
- if (iVRRecordSet.GPos != null && iVRRecordSet.GPos != ivr && iVRRecordSet.GPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRRecordSet.GPos);
- }
- }
- else if (ivr.GetType() == typeof(IVRTimer))
- {
- var iVRTimer = (ivr as IVRTimer);
- if (iVRTimer.Next != null && iVRTimer.Next != ivr && iVRTimer.Next.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRTimer.Next);
- }
- }
- else if (ivr.GetType() == typeof(IVRBranch))
- {
- var iVRBranch = (ivr as IVRBranch);
- if (iVRBranch.DefaultPos != null && iVRBranch.DefaultPos != ivr && iVRBranch.DefaultPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRBranch.DefaultPos);
- }
- foreach (IVRBranchVar branch in iVRBranch.Branch)
- {
- if (branch.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, GlobalController._SelectCanvas.NodeList.Where(a => a.ID == branch.Pos).First());
- }
- }
- }
- else if (ivr.GetType() == typeof(IVRSocket))
- {
- var iVRSocket = (ivr as IVRSocket);
- if (iVRSocket.SuccessPos != null && iVRSocket.SuccessPos != ivr && iVRSocket.SuccessPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRSocket.SuccessPos);
- }
- if (iVRSocket.FailPos != null && iVRSocket.FailPos != ivr && iVRSocket.FailPos.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLineFail(), ivr, iVRSocket.FailPos);//2017-5-9将GetNewFlowLine改为GetNewFlowLineFail
- }
- }
- //2017-5-2 添加解决挂机及其下节点之间不划线的问题
- else if (ivr.GetType() == typeof(IVRHangUp))
- {
- var iVRHangup = ivr as IVRHangUp;
- if (iVRHangup.Next != null && iVRHangup.Next != ivr && iVRHangup.Next.Pos != "0")
- {
- GlobalController._SelectCanvas.AddALine(GetNewFlowLine(), ivr, iVRHangup.Next);
- }
- }
- }
-
-
- }
- #endregion
- #region 创建流程编辑器
- private void CreateIVRFlow(IVRFlowType flowType)
- {
- TabPage tab1 = new TabPage();
- tab1.Tag = flowType;
- // if( GlobalController.IVRCancas[GlobalController._SelectTabControl.Name].)
- foreach (TabPage p in GlobalController._SelectTabControl.Controls)
- {
- if (p.Tag.ToString() == flowType.ToString() && flowType == IVRFlowType.normal)
- {
- MessageBox.Show("每个流程文件中只允许有一个普通流程!");
- return;
- }
- if (p.Tag.ToString() == flowType.ToString() && flowType == IVRFlowType.sub)
- {
- MessageBox.Show("每个流程文件中只允许有一个子流程!");
- return;
- }
- }
- FlowEditorCanvas f = new FlowEditorCanvas();
- f.Dock = DockStyle.Fill;
- f.MouseUp += new MouseEventHandler(f_MouseUp);
- f.MouseMove += new MouseEventHandler(f_MouseMove);
- f.Name = GlobalController.IVRCancas[GlobalController._SelectTabControl.Name].IVRFlows.Count.ToString();
- tab1.Text = (typeof(IVRFlowType).GetField(flowType.ToString()).GetCustomAttributes(false).Last() as DescriptionAttribute).Description;
-
- GlobalController.IVRCancas[GlobalController._SelectTabControl.Name].IVRFlows.Add(f.Name, new IVRFlowInfo() { FlowID = f.Name, FlowName = tab1.Text });
- tab1.Controls.Add(f);
- GlobalController._SelectTabControl.Controls.Add(tab1);
- GlobalController._SelectTabControl.SelectedTab = tab1;
- GlobalController._SelectCanvas = f;
- }
- #endregion
- /// <summary>
- /// 双击IVR控件打开IVR控件属性窗口
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void Control_DoubleClick(object sender, EventArgs e)
- {
- ShowNodeProperty((sender as FlowNodeControl).FlowNode);
-
- }
- /// <summary>
- /// 鼠标移动 改变鼠标形状
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void f_MouseMove(object sender, MouseEventArgs e)
- {
- if (GlobalController.CheckCreateNode())
- Cursor = Cursors.SizeAll;
- else
- {
- Cursor = Cursors.Arrow;
- base.OnMouseMove(e);
- }
- }
- private string _FilePath;
- /// <summary>
- /// 菜单栏菜单事件处理
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ToolStripMenuItem_Click(object sender, EventArgs e)
- {
- switch ((sender as ToolStripItem).Text)
- {
- case "新建项目":
- CreateBaseTabPage(); break;
- case "子流程": CreateIVRFlow(IVRFlowType.sub); break;
- case "普通流程": CreateIVRFlow(IVRFlowType.normal); break;
- case "自动流程": CreateIVRFlow(IVRFlowType.auto); break;
- case "打开":
- case "打开(Ctrl+O)":
- KeyAndMenuHandle("Control O"); break;
- case "保存":
- case "保存(Ctrl+S)":
- KeyAndMenuHandle("Control S"); break;
- case "另存":
- /* SaveFileDialog svf = new SaveFileDialog();
- svf.Filter= "XML文件|*.xml";
- if(svf.ShowDialog()== System.Windows.Forms.DialogResult.OK)
- {
- //这里填写保存的位置和数据
- }*///2017-4-27注释掉Control SAVEAS
- KeyAndMenuHandle("Control SAVEAS");
- break;
- case "删除当前流程":
- if (MessageBox.Show("确定要删除" + GlobalController._SelectTabControl.SelectedTab.Text + "吗?", "消息提示", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
- {
- GlobalController._SelectTabControl.Controls.Remove(GlobalController._SelectTabControl.SelectedTab);
- }
- break;
- case "关闭当前项目":
- this.tabControl1.Controls.Remove(this.tabControl1.SelectedTab);
- //GlobalController._SelectTabControl.Controls.Remove(GlobalController._SelectTabControl.SelectedTab);
- //GlobalController.IVRCancas.Remove(this.tabControl1.SelectedTab.Name);
- break;
- case "退出": Application.Exit(); break;
-
- }
- }
-
- /// <summary>
- /// 双击流程树形结构
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
- {
- GlobalController._SelectTabControl.SelectedTab = (e.Node.Tag as TabPage);
- this.treeView1.SelectedNode = e.Node;
- }
- private void ctlMenu1_Load(object sender, EventArgs e)
- {
- }
- }
- }
|