Example #1
0
        /// <summary>
        /// 初始化数据元
        /// </summary>
        /// <param name="flowChartManager">绘图管理器</param>
        /// <param name="logicData">逻辑数据</param>
        /// <returns>是否操作成功</returns>
        protected virtual bool LogicInitializeDataElement(FlowChartManager flowChartManager, object logicData)
        {
            bool         executeSuccess = true;
            GraphElement graphElement   = logicData as GraphElement;
            DataElement  dataElement    = null;

            try
            {
                switch (graphElement.TypeString)
                {
                case "InnerChart":     // 基础图元
                {
                    dataElement = new InnerChartEditor();

                    break;
                }

                case "InterfaceNode":     // 基础图元
                {
                    dataElement = new InterfaceNodeEditor();

                    break;
                }

                default:     // 自定义图元
                {
                    DataElementInfo dataElementInfo = dataElementInfoDirectory[graphElement.TypeString];

                    if (dataElementInfo != null)
                    {
                        dataElement = dataElementInfo.GetDataElement();
                    }

                    break;
                }
                }

                if (dataElement != null)
                {
                    dataElement.ID       = graphElement.ID;
                    dataElement.DataType = graphElement.TypeString;
                }
            }
            catch (Exception ex)
            {
                executeSuccess = false;
                MessageBox.Show("在初始化数据元时产生异常: " + ex.ToString(), "数据元初始化", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            flowChartManager.CurrentDataManager.InitializedDataElement = dataElement;

            return(executeSuccess);
        }
Example #2
0
        /// <summary>
        /// 选择确定
        /// </summary>
        /// <param name="sender">事件发送者</param>
        /// <param name="e">事件参数</param>
        private void bOK_Click(object sender, EventArgs e)
        {
            innerChartPath = innerChartBox.Text;

            if (innerChartPath != "")
            {
                string    id        = idTable[innerChartPath].ToString();
                Hashtable infoTable = diagramTable[id] as Hashtable;

                if (infoTable != null)
                {
                    Hashtable logicData = infoTable["logicData"] as Hashtable;
                    graphTable = logicData["graphTable"] as Hashtable;

                    foreach (GraphElement graphElement in graphTable.Keys)
                    {
                        if (graphElement is InterfaceGraphElement)
                        {
                            InterfaceGraphElement interfaceGraphElement = graphElement as InterfaceGraphElement;
                            InterfaceNodeEditor   interfaceEditor       = graphTable[graphElement] as InterfaceNodeEditor;

                            if (interfaceEditor.IsInput)
                            {
                                inSlotInfo[interfaceEditor.ID.ToString()] = interfaceEditor.InterfaceName;
                                inSlotCount++;
                            }
                            else
                            {
                                outSlotInfo[interfaceEditor.ID.ToString()] = interfaceEditor.InterfaceName;
                                outSlotCount++;
                            }

                            interfaceNodeTable[interfaceEditor.ID.ToString()] = graphElement;
                        }
                        else // 记录所有的非接口结点
                        {
                            graphElementList.Add(graphElement);
                        }
                    }
                }

                DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("请先选择子绘图!", "子绘图编辑",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #3
0
        /// <summary>
        /// 初始化数据元
        /// </summary>
        /// <param name="flowChartManager">绘图管理器</param>
        /// <param name="logicData">逻辑数据</param>
        /// <returns>是否操作成功</returns>
        protected virtual bool LogicInitializeDataElement(FlowChartManager flowChartManager, object logicData)
        {
            bool executeSuccess = true;
            GraphElement graphElement = logicData as GraphElement;
            DataElement dataElement = null;

            try
            {
                switch (graphElement.TypeString)
                {
                    case "InnerChart": // 基础图元
                        {
                            dataElement = new InnerChartEditor();

                            break;
                        }
                    case "InterfaceNode": // 基础图元
                        {
                            dataElement = new InterfaceNodeEditor();

                            break;
                        }
                    default: // 自定义图元
                        {
                            DataElementInfo dataElementInfo = dataElementInfoDirectory[graphElement.TypeString];

                            if (dataElementInfo != null)
                            {
                                dataElement = dataElementInfo.GetDataElement();                                                                    
                            }

                            break;
                        }
                }

                if (dataElement != null)
                {
                    dataElement.ID = graphElement.ID;
                    dataElement.DataType = graphElement.TypeString;
                }
            }
            catch (Exception ex)
            {
                executeSuccess = false;
                MessageBox.Show("在初始化数据元时产生异常: " + ex.ToString(), "数据元初始化", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            flowChartManager.CurrentDataManager.InitializedDataElement = dataElement;

            return executeSuccess;
        }
Example #4
0
        /// <summary>
        /// 重读数据
        /// </summary>
        /// <param name="table">当前数据</param>
        /// <return>是否重读成功</return>
        public override bool ReloadData(Hashtable table)
        {
            Hashtable dataInfo = data as Hashtable;

            if (dataInfo != null)
            {
                innerChartPath = dataInfo["innerChartPath"] as string;

                // 初始化绘图数据表
                InitGraphTable();

                if (graphTable != null)
                {
                    int       inSlotCount  = 0;
                    int       outSlotCount = 0;
                    Hashtable inSlotInfo   = new Hashtable();
                    Hashtable outSlotInfo  = new Hashtable();
                    graphElementList   = new List <GraphElement>();
                    interfaceNodeTable = new Hashtable();

                    List <int> inIDList  = new List <int>();
                    List <int> outIDList = new List <int>();

                    foreach (GraphElement graphElement in graphTable.Keys)
                    {
                        if (graphElement is InterfaceGraphElement)
                        {
                            InterfaceGraphElement interfaceGraphElement = graphElement as InterfaceGraphElement;
                            InterfaceNodeEditor   interfaceEditor       = graphTable[graphElement] as InterfaceNodeEditor;

                            if (interfaceEditor.IsInput)
                            {
                                inSlotInfo[interfaceEditor.ID.ToString()] = interfaceEditor.InterfaceName;
                                inIDList.Add(interfaceGraphElement.ID);
                                inSlotCount++;
                            }
                            else
                            {
                                outSlotInfo[interfaceEditor.ID.ToString()] = interfaceEditor.InterfaceName;
                                outIDList.Add(interfaceGraphElement.ID);
                                outSlotCount++;
                            }

                            interfaceGraphElement.Tag = id.ToString();
                            interfaceNodeTable[interfaceEditor.ID.ToString()] = graphElement;
                        }
                        else
                        {
                            graphElementList.Add(graphElement);
                        }
                    }

                    InnerChart innerChart = DocumentManager.GetDocumentManager().CurrentFlowChartManager.CurrentDataManager.FindGraphElementByID(id) as InnerChart;

                    // 更新数据
                    UpdateData(inSlotInfo, outSlotInfo);

                    // 更新插槽数量
                    UpdateSlotCount(innerChart, inSlotCount, outSlotCount, true);

                    // 更新插槽信息
                    RefreshSlotInfo(innerChart, inIDList, outIDList, inSlotInfo, outSlotInfo);
                }
            }

            return(true);
        }