Пример #1
0
        public List <string> GetAllMeasureName()
        {
            List <string> l = new List <string>();

            AddMeasureName(ActorList.Cast <IStoryEntityObject>().ToList(), l);
            AddMeasureName(EventList.Cast <IStoryEntityObject>().ToList(), l);
            AddMeasureName(GroupList.Cast <IStoryEntityObject>().ToList(), l);
            AddMeasureName(TaskList.Cast <IStoryEntityObject>().ToList(), l);
            AddMeasureName(StuffList.Cast <IStoryEntityObject>().ToList(), l);
            AddMeasureName(RelationList.Cast <IStoryEntityObject>().ToList(), l);

            return(l);
        }
Пример #2
0
 void AddUIPropertyInList(Transform Node, RelationList pList)
 {
     if(Node.GetComponent<UIProperty>() != null)
     {
         pList.NodeProperty = Node.GetComponent<UIProperty>();
     }
     for(int i = 0; i < Node.childCount; i++)
     {
         RelationList Tmp = new RelationList();
         AddUIPropertyInList(Node.GetChild(i), Tmp);
         pList.ChildList.Add(Tmp);
     }
 }
Пример #3
0
        void DeseignCanvas_DesignPointerReleased(object sender, PointerRoutedEventArgs e)
        {
            HideDesignLine();

            DeseignCanvas.PointerMoved    -= new PointerEventHandler(DeseignCanvas_DesignPointerMoved);
            DeseignCanvas.PointerReleased -= new PointerEventHandler(DeseignCanvas_DesignPointerReleased);


            IDesignRelation l = null;

            if ((StartAnchor != null) && (EndAnchor != null) && (EndAnchor != StartAnchor))
            {
                l = null;
                if (!getNewRelationControlByID.Equals(null))//新建关联
                {
                    l = getNewRelationControl(null, null);
                }
                if (l == null)//新建失败使用默认关联
                {
                    l             = new LynxConnectLine();
                    l.IsErrorData = true;
                }
                if (l != null)
                {
                    l.designCanvas = this;

                    l.StartAnchorPoint = StartAnchor;
                    l.EndAnchorPoint   = EndAnchor;
                    StartAnchor.OutRelationList.Add(l);
                    EndAnchor.InRelationList.Add(l);
                    l.SourceID = StartAnchor.ParentConnectControl.ObjectID;
                    l.TargetID = EndAnchor.ParentConnectControl.ObjectID;
                }
            }

            if (l == null)
            {
                return;
            }                                                                //没有能够创立链接
            sendObjectOperationEvent(l, DesignOperationFlag.CreateRelation); //建立新的连接
            l.ReadFromObject();

            DeActiveAll();

            l.DrawRelationLine(StartPoint.Value, e.GetCurrentPoint(getCanvas()).Position);
            RelationList.Add(l);
            ActiveDesignObject(l);
            EndAnchor           = null;
            StartAnchor         = null;
            CurrentConnectPoint = null;
        }
Пример #4
0
        public IActionResult Post(string siteCode, string contentCode, string contentVersion, List <Relation> relations)
        {
            var content = CMS.Models.Content.GetContent(siteCode, contentCode, contentVersion);

            if (content.CanSave)
            {
                RelationList.AddContentRelation(siteCode, contentCode, relations);

                return(Ok(new { sucess = true, version = content.version }));
            }
            else
            {
                return(Unauthorized(new { sucess = false, version = content.version }));
            }
        }
Пример #5
0
        async Task LoadAsync(IRequester requester, Url url, CancellationToken cancel)
        {
            var response = await requester.LoadAsync(url, _cts.Token).ConfigureAwait(false);

            if (response != null)
            {
                var options = new StyleOptions
                {
                    Element     = this,
                    Title       = Title,
                    IsDisabled  = IsDisabled,
                    IsAlternate = RelationList.Contains(Keywords.Alternate)
                };
                _sheet = Owner.Options.ParseStyling(response, options, Type);
                response.Dispose();
            }
        }
Пример #6
0
        private static void RemoveFromRelationList(string key, RelationBase relation, RelationLists fromRelations)
        {
            RelationList list = fromRelations[key];

            if (list != null)
            {
                int removeIndex = list.IndexOf(relation);
                if (removeIndex >= 0)
                {
                    list.RemoveAt(removeIndex);
                }
                if (list.Count == 0)
                {
                    fromRelations.Remove(key);
                }
            }
        }
Пример #7
0
 UIProperty GetUIPropertyWithName(string Name, RelationList pList)
 {
     //Debug.Log(Name+" "+pList.NodeProperty);
     if(pList.NodeProperty)
     {
         if(pList.NodeProperty.name == Name)
             return pList.NodeProperty;
     }
     foreach(RelationList Tmp in pList.ChildList)
     {
         UIProperty TmpProperty = GetUIPropertyWithName(Name, Tmp);
         if(TmpProperty != null)
         {
             return TmpProperty;
         }
     }
     return null;
 }
Пример #8
0
        public List <Tuple <IRelation, IStoryEntityObject, IStoryEntityObject> > GetRelativeFate(List <ISubject> subjectList)
        {
            List <Tuple <IRelation, IStoryEntityObject, IStoryEntityObject> > l = new List <Tuple <IRelation, IStoryEntityObject, IStoryEntityObject> >();

            foreach (var subject in subjectList)
            {
                foreach (var r in RelationList.Where(v => v.SourceID == subject.ObjectID))
                {
                    var target = subjectList.FirstOrDefault(v => v.ObjectID == r.TargetID);
                    if (target != null)
                    {
                        l.Add(
                            new Tuple <IRelation, IStoryEntityObject, IStoryEntityObject>
                                (r, GetEntityByID(subject.ObjectID), GetEntityByID(target.ObjectID)));
                    }
                }
            }
            return(l);
        }
Пример #9
0
        /// <summary>
        /// Return true, if the <c>relation</c> has any incoming or outgoing relations
        /// (registered/added to RelationCosmos).
        /// </summary>
        /// <param name="relation">Relation to check</param>
        /// <param name="excludeRelations">List of strings with relation.HRef's,
        /// that should be excluded in that check</param>
        /// <returns>True, if any relation was found, else false</returns>
        public bool HasIncomingOrOutgoing(RelationBase relation, IList excludeRelations)
        {
            if (relation == null || relation.HRef == null)
            {
                return(false);
            }

            lock (syncRoot) {
                try {
                    if (excludeRelations == null)
                    {
                        excludeRelations = RelationCosmos.emptyRelationList;
                    }

                    // check outgoing:
                    foreach (string hrefOut in relation.OutgoingRelations)
                    {
                        if (hrefOut != null && hrefOut != relation.HRef &&
                            !RelationListContainsHRef(excludeRelations, hrefOut) && registeredRelations.Contains(hrefOut))
                        {
                            return(true);
                        }
                    }

                    // check incoming:
                    RelationList list = registeredIncomingRelations[relation.HRef];
                    if (list != null)
                    {
                        foreach (RelationBase r in list)
                        {
                            if (r != relation && !excludeRelations.Contains(r))
                            {
                                return(true);
                            }
                        }
                    }
                } catch (Exception ex) {
                    System.Diagnostics.Trace.WriteLine("RelationCosmos.HasIncomingOrOutgoing() exception: " + ex.Message);
                }
                return(false);
            }
        }
Пример #10
0
        //List<IRole> _RoleList = new List<IRole>();
        //public List<IRole> RoleList { get { return _RoleList; } }

        public ICopySupportObject Clone()
        {
            var o = new Story()
            {
                Name = Name, Memo = Memo, BeginTime = BeginTime, EndTime = EndTime, Author = Author, StoryVersion = StoryVersion
            };

            //o.CurrentUniverse = CurrentUniverse.Clone() as IUniverse;
            ActorList.ForEach(v => o.ActorList.Add(v.Clone() as IActor));
            StuffList.ForEach(v => o.StuffList.Add(v.Clone() as IStuff));
            ExpressList.ForEach(v => o.ExpressList.Add(v.Clone() as IExpress));
            NoteList.ForEach(v => o.NoteList.Add(v.Clone() as INote));
            EventList.ForEach(v => o.EventList.Add(v.Clone() as IEvent));
            RelationList.ForEach(v => o.RelationList.Add(v.Clone() as IRelation));
            TaskList.ForEach(v => o.TaskList.Add(v.Clone() as ITask));
            GroupList.ForEach(v => o.GroupList.Add(v.Clone() as IGroup));
            StructureDiagramList.ForEach(v => o.StructureDiagramList.Add(v.Clone() as IStructureDiagram));

            return(o);
        }
Пример #11
0
        void TargetChanged()
        {
            if (Owner.Options.IsStyling)
            {
                var href = Href;

                if (href != null && _buffer != href && Owner != null)
                {
                    _buffer = href;
                    TryCancelCurrent();
                    var url       = new Url(href);
                    var requester = Owner.Options.GetRequester(url.Scheme);

                    if (requester == null)
                    {
                        return;
                    }

                    _current = requester.LoadAsync(url, _cts.Token).ContinueWith(task =>
                    {
                        if (task.IsCompleted && !task.IsFaulted && task.Result != null)
                        {
                            using (var result = task.Result)
                            {
                                var options = new StyleOptions
                                {
                                    Context     = Owner.DefaultView,
                                    Document    = Owner,
                                    Element     = this,
                                    Title       = Title,
                                    IsDisabled  = IsDisabled,
                                    IsAlternate = RelationList.Contains(Keywords.Alternate)
                                };
                                _sheet = Owner.Options.ParseStyling(result, options, Type);
                            }
                        }
                    });
                }
            }
        }
Пример #12
0
        public void CreateControl(IDesignObject idn, Point p)
        {
            idn.designCanvas = this;
            FrameworkElement fe = idn.getControl();

            Canvas.SetLeft(fe, p.X);
            Canvas.SetTop(fe, p.Y);
            DeseignCanvas.Children.Add(fe);
            //DesignObjectList.Add(idn);

            if (idn is IDesignNode)
            {
                NodeList.Add(idn as IDesignNode);
                sendObjectOperationEvent(idn, DesignOperationFlag.CreateObject);//提示设计图增加了节点对象
            }
            if (idn is IDesignRelation)
            {
                RelationList.Add(idn as IDesignRelation);
                (idn as IDesignRelation).DrawRelationLine(p, new Point(p.X + 100, p.Y + 100));
                sendObjectOperationEvent(idn, DesignOperationFlag.CreateRelation);//提示设计图增加了节点对象
            }
        }
Пример #13
0
        public void AddExistRelation(IDesignRelation idr, IDesignNode sdn, IDesignNode tdn)//在指定的起始节点和终止节点之间添加一个关联控件
        {
            if (idr == null)
            {
                return;
            }
            if (NodeList.Count == 0)
            {
                return;
            }
            idr.designCanvas = this;
            if (sdn != null)
            {
                idr.StartAnchorPoint = sdn.getDefaultAnchorPoint();
                idr.StartPoint       = idr.StartAnchorPoint.getDesignCanvasPoint();
            }
            else
            {
                idr.StartAnchorPoint = null;
                idr.StartPoint       = new Point(DeseignCanvas.Width / 2 - (new Random()).Next(50), DeseignCanvas.Height / 2 - (new Random()).Next(50));
            }
            if (tdn != null)
            {
                idr.EndAnchorPoint = tdn.getDefaultAnchorPoint();
                idr.EndPoint       = idr.EndAnchorPoint.getDesignCanvasPoint();
            }
            else
            {
                idr.EndAnchorPoint = null;
                idr.EndPoint       = new Point(DeseignCanvas.Width / 2 + (new Random()).Next(150), DeseignCanvas.Height / 2 + (new Random()).Next(150));
            }
            FrameworkElement fe = idr.getControl();

            DeseignCanvas.Children.Add(fe);

            idr.DrawRelationLine(idr.StartPoint, idr.EndPoint);
            sendObjectOperationEvent(idr, DesignOperationFlag.CreateRelation);//提示设计图增加了节点对象
            RelationList.Add(idr);
        }
Пример #14
0
        public List <T> GetRelatedEntityList <T>(Guid id)
        {
            var r   = new List <T>();
            var trl = RelationList.Where(v => v.SourceID == id).ToList();
            var srl = RelationList.Where(v => v.TargetID == id).ToList();

            trl.ForEach(v =>
            {
                var o = GetEntityByID(v.TargetID);
                if (o != null && (T)o != null)
                {
                    r.Add((T)o);
                }
            });
            srl.ForEach(v =>
            {
                var o = GetEntityByID(v.SourceID);
                if (o != null && (T)o != null)
                {
                    r.Add((T)o);
                }
            });
            return(r);
        }
Пример #15
0
        /// <summary>
        /// Returns a list of relations, that are known in RelationCosmos and that
        /// the relation provided points to.
        /// </summary>
        /// <param name="relation">The object implementing RelationBase</param>
        /// <param name="excludeRelations">List of relations,
        /// that should be excluded in that check</param>
        /// <returns>RelationList</returns>
        public RelationList GetOutgoing(RelationBase relation, IList excludeRelations)
        {
            if (relation == null || relation.HRef == null)
            {
                return(RelationCosmos.emptyRelationList);
            }

            lock (syncRoot) {
                try {
                    if (excludeRelations == null)
                    {
                        excludeRelations = (IList)RelationCosmos.emptyRelationList;
                    }

                    // check incoming:
                    RelationHRefList list = relation.OutgoingRelations;
                    if (list != null && list.Count > 0)
                    {
                        RelationList returnList = new RelationList(list.Count);
                        foreach (string hrefOut in list)
                        {
                            if (hrefOut != relation.HRef && !RelationListContainsHRef(excludeRelations, hrefOut) &&
                                registeredRelations.Contains(hrefOut))
                            {
                                returnList.Add(registeredRelations[hrefOut]);
                            }
                        }
                        return(returnList);
                    }
                } catch (Exception ex) {
                    System.Diagnostics.Trace.WriteLine("RelationCosmos.GetOutgoing() exception: " + ex.Message);
                }

                return(RelationCosmos.emptyRelationList);
            }
        }
Пример #16
0
        public List <Tuple <IStoryEntityObject, IRelation> > GetFate(ISubject subject)
        {
            List <Tuple <IStoryEntityObject, IRelation> > l = new List <Tuple <IStoryEntityObject, IRelation> >();
            var rl = RelationList.Where(r => r.IsRelationAbout(subject.ObjectID));

            foreach (var r in rl)
            {
                Guid sid;
                if (r.SourceID == subject.ObjectID)
                {
                    sid = r.TargetID;
                }
                else
                {
                    sid = r.SourceID;
                }
                var o = GetEntityByID(sid);
                if (o != null)
                {
                    l.Add(new Tuple <IStoryEntityObject, IRelation>(o, r));
                }
            }
            return(l);
        }
Пример #17
0
 /// <summary>
 /// collects all relations from this classifier to adjacent classifiers.
 /// These can either be associations or implementations/derivation
 /// </summary>
 /// <returns>
 /// list of relations to other classifiers 
 /// starting from this classifier.
 /// Empty list if no relations are available for this type.
 /// </returns>
 public RelationList FindAllRelationStartingFromClass()
 {
     var relationList = new RelationList(Associations);
     if (BaseClass != null)
         relationList.AddRelation(new Relation(this, BaseClass, RelationType.Inheritance));
     relationList.AddRelations(InterfaceImplementations);
     return relationList;
 }
Пример #18
0
 public virtual void SetExternalRelations(RelationList relations)
 {
     externalRelations = relations;
 }