示例#1
0
        /// <summary>
        /// 注册数据元信息
        /// </summary>
        public void RegistDataElementInfo(string graphType, string filePath, string className)
        {
            string fullPath = Path.Combine(Application.StartupPath, pluginPath);

            fullPath = Path.Combine(fullPath, filePath);
            DataElementInfo dataElementInfo = new DataElementInfo(graphType, fullPath, className);

            dataElementInfoDirectory[graphType] = dataElementInfo;
        }
示例#2
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);
        }
        DataElementInfo GetMainElement()
        {
            DataElementInfo dei = new DataElementInfo();

            if (mainElement == null)
            {
                return(dei);
            }
            if (!_metadata.TryGetValue(mainElement.Value.TypeName, out IDataMetadata meta))
            {
                return(dei);
            }
            if (String.IsNullOrEmpty(meta.Id))
            {
                return(dei);
            }
            dei.Metadata = meta;
            var elem = _root.Get <ExpandoObject>(mainElement.Value.PropertyName);

            dei.Element = elem;
            dei.Id      = elem.Get <Object>(meta.Id);
            return(dei);
        }
示例#4
0
 /// <summary>
 /// 注册数据元信息
 /// </summary>
 public void RegistDataElementInfo(string graphType, string filePath, string className)
 {
     string fullPath = Path.Combine(Application.StartupPath, pluginPath);
     fullPath = Path.Combine(fullPath, filePath);
     DataElementInfo dataElementInfo = new DataElementInfo(graphType, fullPath, className);
     dataElementInfoDirectory[graphType] = dataElementInfo;
 }