Example #1
0
 public static void ReadDadaLinkInfor(Panel dp, AbstractLFCDataObject ao)
 {
     foreach (FrameworkElement fe in dp.Children)
     {
         if (IsDataLinkArea(fe))
         {
             string         tn = getFieldNameWithoutPrefix(fe.Name);
             LFCDataService ls = new LFCDataService();
             FieldInfo      fo = ls.getFieldByName(ao, tn);
             if (fo != null)
             {
                 ReadDadaLinkInfor(fe, fo, ao);
             }
         }
     }
 }
Example #2
0
        public void LoadLogicViewInfor()//读取设计数据
        {
            if (LogicDiagram == null)
            {
                return;
            }
            Width  = LogicDiagram.Width;
            Height = LogicDiagram.Height;

            DeseignCanvas.Children.Clear();
            LFCDataService lfcs = new LFCDataService();

            foreach (ViewItem vi in LogicDiagram.NodeItemList)
            {
                IDesignNode dn = getNewNodeControl(vi.DataObjectType, vi.DataObjectID);
                if (dn == null)            //表示委托方法没有能够完成加载一个数据对应的设计节点,此时建立空节点
                {
                    dn.IsErrorData = true; //决定显示时候是红色
                    Type t = Type.GetType(vi.ControlType);
                    if (t != null)
                    {
                        object co = Activator.CreateInstance(t);
                        if (co != null && co is IDesignNode)
                        {
                            dn = co as IDesignNode;
                        }
                    }
                }
                if (dn == null)
                {
                    dn             = new LynxDefaultNode();
                    dn.IsErrorData = true;
                }

                DeseignCanvas.Children.Add(dn.getControl());
                dn.LogicViewObject = vi;
                dn.LoadLogicViewInfor();
                dn.designCanvas = this;
            }
            foreach (ViewLineItem vl in LogicDiagram.RelationItemList)
            {
                IDesignRelation l = null;
                if (!getNewRelationControlByID.Equals(null))
                {
                    l = getNewRelationControl(vl.DataObjectType, vl.DataObjectID);
                }

                if (l == null)
                {
                    l             = new LynxConnectLine();
                    l.IsErrorData = true;
                }
                l.designCanvas    = this;
                l.LogicViewObject = vl;
                l.LoadLogicViewInfor();
                l.DrawRelationLine(l.StartPoint, l.EndPoint);

                List <FrameworkElement> fel = null;
                fel = getControlList(l.SourceID);
                foreach (FrameworkElement fe in fel)
                {
                    IDesignNode idn = fe as IDesignNode;
                    if (idn != null)
                    {
                        idn.AddRelationAsSourceObject(l);
                    }
                }
                fel = getControlList(l.TargetID);
                foreach (FrameworkElement fe in fel)
                {
                    IDesignNode idn = fe as IDesignNode;
                    if (idn != null)
                    {
                        idn.AddRelationAsTargetObject(l);
                    }
                }
            }
        }