예제 #1
0
        /// <summary>
        /// 重命名自定义事件
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void buttonX5_Click(object sender, EventArgs e)
        {
            Node eventNode = allEventTree.SelectedNode;

            if (eventNode != null)
            {
                string eventName = textBoxX1.Text;

                if (eventName != "")
                {
                    AI_Event aiEvent = eventNode.Tag as AI_Event;

                    if (aiEvent != null && int.Parse(aiEvent.eventid) > 2000)
                    {
                        aiEvent.Name   = eventName;
                        eventNode.Text = aiEvent.ToString();
                    }
                    else
                    {
                        MessageBox.Show("只能重命名本图内创建的自定义事件!", "重命名自定义事件", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show("请先输入自定义事件的名称!", "重命名自定义事件", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("请先选择要重命名的自定义事件!", "重命名自定义事件", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #2
0
파일: AIClass.cs 프로젝트: weimingtom/pap2
        private static void Init()
        {
            if (!inited)
            {
                DataTable infoTable = DBManager.DataBaseManager.GetDataBaseManager().GetTable_AI_Event_Define();

                foreach (DataRow dataRow in infoTable.Rows)
                {
                    AI_Event aiEvent = new AI_Event();
                    aiEvent.DBID    = dataRow["id"].ToString();
                    aiEvent.Name    = dataRow["name"].ToString();
                    aiEvent.Ename   = dataRow["ename"].ToString();
                    aiEvent.Info    = dataRow["info"].ToString();
                    aiEvent.eventid = dataRow["eventid"].ToString();

                    if (string.IsNullOrEmpty(aiEvent.eventid))
                    {
                        aiEvent.eventid = "0";
                    }

                    eventList.Add(aiEvent);
                    eventDictionary[aiEvent.DBID] = aiEvent;
                }

                eventList.Sort(new AIEventComparer());

                inited = true;
            }
        }
예제 #3
0
파일: AIClass.cs 프로젝트: weimingtom/pap2
        /// <summary>
        /// 重载复制
        /// </summary>
        /// <returns>复制的对象</returns>
        public object Clone()
        {
            AI_Event newEvent = new AI_Event();

            newEvent.DBID    = this.DBID;
            newEvent.Name    = this.Name;
            newEvent.Ename   = this.Ename;
            newEvent.Info    = this.Info;
            newEvent.eventid = this.eventid;

            return(newEvent);
        }
예제 #4
0
파일: AIClass.cs 프로젝트: weimingtom/pap2
        /// <summary>
        /// 比较对象是否相等
        /// </summary>
        /// <param name="obj">比较对象</param>
        /// <returns>是否相等</returns>
        public override bool Equals(object obj)
        {
            AI_Event aiEvent = obj as AI_Event;

            if (aiEvent != null)
            {
                return(this.DBID == aiEvent.DBID);
            }
            else
            {
                return(false);
            }
        }
예제 #5
0
파일: AIClass.cs 프로젝트: weimingtom/pap2
        public string Info    = ""; // 事件的描述

        /// <summary>
        /// 刷新数据
        /// </summary>
        public void Reload()
        {
            if (!string.IsNullOrEmpty(this.Name))
            {
                AI_Event aiEvent = EventTable.FindItemByDBID(this.DBID);

                if (aiEvent != null)
                {
                    this.Ename   = aiEvent.Ename;
                    this.Name    = aiEvent.Name;
                    this.Info    = aiEvent.Info;
                    this.eventid = aiEvent.eventid;
                }
            }
        }
예제 #6
0
파일: AIClass.cs 프로젝트: weimingtom/pap2
        /// <summary>
        /// 索引事件数据
        /// </summary>
        /// <param name="databaseID">KeyID</param>
        /// <returns>事件数据</returns>
        public static AI_Event FindItemByDBID(string databaseID)
        {
            AI_Event aiEvent = null;

            if (!string.IsNullOrEmpty(databaseID))
            {
                Init();

                if (!eventDictionary.TryGetValue(databaseID, out aiEvent))
                {
                    aiEvent = null;
                }
            }

            return(aiEvent);
        }
예제 #7
0
        /// <summary>
        /// 注册事件切换
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void advTree2_AfterNodeSelect(object sender, AdvTreeNodeEventArgs e)
        {
            Node currentNode = registedEventTree.SelectedNode;

            if (currentNode != null)
            {
                AI_Event aiEvent     = currentNode.Tag as AI_Event;
                string   description = aiEvent.Info;

                if (string.IsNullOrEmpty(description))
                {
                    description = aiEvent.Name;
                }

                informationBox.Text = description;
            }
        }
예제 #8
0
        /// <summary>
        /// 删除自定义事件
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void buttonX4_Click(object sender, EventArgs e)
        {
            Node currentNode = allEventTree.SelectedNode;

            if (currentNode != null)
            {
                AI_Event aiEvent = currentNode.Tag as AI_Event;

                if (int.Parse(aiEvent.eventid) > 2000) // 检查是否是绘图级的自定义事件
                {
                    List <AI_Event> customEventList = flowChartInteractor.CustomTable["CustomEventList"] as List <AI_Event>;
                    customEventList.Remove(aiEvent);
                    allEventTree.Nodes.Remove(currentNode);
                }
                else
                {
                    MessageBox.Show("只能删除本图内创建的自定义事件!", "删除自定义事件", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("请先选择要删除的自定义事件!", "删除自定义事件", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #9
0
파일: AIClass.cs 프로젝트: viticm/pap2
        private static void Init()
        {
            if (!inited)
            {
                DataTable infoTable = DBManager.DataBaseManager.GetDataBaseManager().GetTable_AI_Event_Define();

                foreach (DataRow dataRow in infoTable.Rows)
                {
                    AI_Event aiEvent = new AI_Event();
                    aiEvent.DBID = dataRow["id"].ToString();
                    aiEvent.Name = dataRow["name"].ToString();
                    aiEvent.Ename = dataRow["ename"].ToString();
                    aiEvent.Info = dataRow["info"].ToString();
                    aiEvent.eventid = dataRow["eventid"].ToString();

                    if (string.IsNullOrEmpty(aiEvent.eventid))
                    {
                        aiEvent.eventid = "0";
                    }

                    eventList.Add(aiEvent);
                    eventDictionary[aiEvent.DBID] = aiEvent;
                }

                eventList.Sort(new AIEventComparer());

                inited = true;
            }
        }
예제 #10
0
파일: AIClass.cs 프로젝트: viticm/pap2
        /// <summary>
        /// 重载复制
        /// </summary>
        /// <returns>复制的对象</returns>
        public object Clone()
        {
            AI_Event newEvent = new AI_Event();
            newEvent.DBID = this.DBID;
            newEvent.Name = this.Name;
            newEvent.Ename = this.Ename;
            newEvent.Info = this.Info;
            newEvent.eventid = this.eventid;

            return newEvent;
        }
예제 #11
0
        /// <summary>
        /// 新建自定义事件
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void buttonX3_Click(object sender, EventArgs e)
        {
            string eventName = textBoxX1.Text;

            if (eventName != "")
            {
                List <AI_Event> customEventList = flowChartInteractor.CustomTable["CustomEventList"] as List <AI_Event>;

                if (customEventList == null)
                {
                    customEventList = new List <AI_Event>();
                }

                bool nameExist = false;

                foreach (AI_Event aiEvent in customEventList)
                {
                    if (aiEvent.Name == eventName)
                    {
                        nameExist = true;
                        break;
                    }
                }

                if (nameExist) // 事件名已经存在
                {
                    MessageBox.Show("该名称的事件已经存在!", "新建自定义事件", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    string customEventIndexString = flowChartInteractor.CustomTable["CustomEventIndex"] as string;
                    int    customEventIndex       = 1;
                    if (customEventIndexString != null)
                    {
                        customEventIndex = int.Parse(customEventIndexString);
                    }
                    int eventID = customEventIndex + 2000; // ID2000以上的为脚本内自定义事件

                    AI_Event aiEvent = new AI_Event();
                    aiEvent.Name    = eventName;
                    aiEvent.Ename   = "CustomEvent";
                    aiEvent.DBID    = "0";
                    aiEvent.eventid = eventID.ToString();
                    customEventList.Add(aiEvent);
                    customEventIndex++;

                    Node node = new Node();
                    node.Text  = aiEvent.ToString();
                    node.Tag   = aiEvent;
                    node.Image = imageList1.Images[0];
                    allEventTree.Nodes.Add(node);
                    allEventTree.SelectedNode = node;

                    flowChartInteractor.CustomTable["CustomEventList"]  = customEventList;
                    flowChartInteractor.CustomTable["CustomEventIndex"] = customEventIndex.ToString();
                }
            }
            else
            {
                MessageBox.Show("请先输入自定义事件的名称!", "新建自定义事件", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #12
0
        /// <summary>
        /// 新建自定义事件
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void buttonX3_Click(object sender, EventArgs e)
        {
            string eventName = textBoxX1.Text;

            if (eventName != "")
            {
                List<AI_Event> customEventList = flowChartInteractor.CustomTable["CustomEventList"] as List<AI_Event>;

                if (customEventList == null)
                {
                    customEventList = new List<AI_Event>();
                }

                bool nameExist = false;

                foreach (AI_Event aiEvent in customEventList)
                {
                    if (aiEvent.Name == eventName)
                    {
                        nameExist = true;
                        break;
                    }
                }

                if (nameExist) // 事件名已经存在
                {
                    MessageBox.Show("该名称的事件已经存在!", "新建自定义事件", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    string customEventIndexString = flowChartInteractor.CustomTable["CustomEventIndex"] as string;
                    int customEventIndex = 1;
                    if(customEventIndexString != null)
                    {
                        customEventIndex = int.Parse(customEventIndexString);
                    }
                    int eventID = customEventIndex + 2000; // ID2000以上的为脚本内自定义事件

                    AI_Event aiEvent = new AI_Event();
                    aiEvent.Name = eventName;
                    aiEvent.Ename = "CustomEvent";
                    aiEvent.DBID = "0";
                    aiEvent.eventid = eventID.ToString();
                    customEventList.Add(aiEvent);
                    customEventIndex++;

                    Node node = new Node();
                    node.Text = aiEvent.ToString();
                    node.Tag = aiEvent;
                    node.Image = imageList1.Images[0];
                    allEventTree.Nodes.Add(node);
                    allEventTree.SelectedNode = node;

                    flowChartInteractor.CustomTable["CustomEventList"] = customEventList;
                    flowChartInteractor.CustomTable["CustomEventIndex"] = customEventIndex.ToString(); 
                }
            }
            else
            {
                MessageBox.Show("请先输入自定义事件的名称!", "新建自定义事件", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }