Ejemplo n.º 1
0
 /// <inheritdoc />
 public async Task <ILinkedObject> AddLinkedObjectDefinitionAsync(ILinkedObject linkedObject, CancellationToken cancellationToken = default(CancellationToken))
 => await PostAsync <LinkedObject>(new HttpRequest
 {
     Uri     = "/api/v1/meta/schemas/user/linkedObjects",
     Verb    = HttpVerb.Post,
     Payload = linkedObject,
 }, cancellationToken).ConfigureAwait(false);
Ejemplo n.º 2
0
        public void SetCursor(bool inEnd, ICursor cursor)
        {
            if (this.Cursor != null)
            {
                this.CurrentCursorChild.Object.ClearCursor();
            }

            this.Cursor = cursor;
            if (inEnd)
            {
                this.CurrentCursorChild = this.LastChild;
            }
            else
            {
                this.CurrentCursorChild = this.FirstChild;
            }

            if (this.CurrentCursorChild == null)
            {
                // Todo: No children. Render the cursor
            }
            else
            {
                this.CurrentCursorChild.Object.SetCursor(inEnd, cursor);
            }
        }
Ejemplo n.º 3
0
        public void ClearCursor()
        {
            if (this.Cursor == null)
            {
                throw new CursorException("Cursor have already been cleared or not been set");
            }

            this.CurrentCursorChild.Object.ClearCursor();
            this.CurrentCursorChild = null;
            this.Cursor             = null;
        }
Ejemplo n.º 4
0
        bool IsSharedUpdater(ILinkedObject linkedObject)
        {
            var type = linkedObject.GetType();
            List <ILinkedObject> list;

            if (m_LinkedObjects.TryGetValue(type, out list))
            {
                return(m_LinkedObjects[type].IndexOf(linkedObject) == 0);
            }

            return(false);
        }
Ejemplo n.º 5
0
        protected void AppendChild(T child)
        {
            var linkedChild = new LinkedObject <T>(child);

            if (this.LastChild != null)
            {
                linkedChild.Prev    = this.LastChild;
                this.LastChild.Next = linkedChild;
            }

            this.LastChild = linkedChild;

            if (this.FirstChild == null)
            {
                this.FirstChild = this.LastChild;
            }
        }
Ejemplo n.º 6
0
        protected void PrependChild(T child) // TODO: Exstract the chain logic to a separate class.
        {
            var linkedChild = new LinkedObject <T>(child);

            if (this.FirstChild != null)
            {
                linkedChild.Next     = this.FirstChild;
                this.FirstChild.Prev = linkedChild;
            }

            this.FirstChild = linkedChild;

            if (this.LastChild == null)
            {
                this.LastChild = this.FirstChild;
            }
        }
Ejemplo n.º 7
0
            bool IsSharedUpdater(ILinkedObject linkedObject)
            {
                var type = linkedObject.GetType();

                return(m_LinkedObjects[type].IndexOf(linkedObject) == 0);
            }
Ejemplo n.º 8
0
 /// <summary>
 /// Returns whether the specified ray origin is hovering over a UI element
 /// </summary>
 /// <param name="linkedObject">Object among the linked objects to check if it is the central one</param>
 public static bool IsSharedUpdater(this ILinkedObject obj, ILinkedObject linkedObject)
 {
     return(isSharedUpdater(linkedObject));
 }
Ejemplo n.º 9
0
        public void Insert(IDocumentBuffer documentBuffer, IDimensionConstraint dimensionConstraint)
        {
            double dimensionConsumed = 0;
            var    child             = this.FirstChild;

            while (this.CurrentCursorChild != null && child != this.CurrentCursorChild)
            {
                dimensionConsumed += this.GetDimension(child.Object);
                child              = child.Next;
            }

            var objectConstraint = this.GetConstraint(dimensionConstraint, dimensionConsumed);

            while (child != null)
            {
                child.Object.Insert(documentBuffer, objectConstraint);

                if (documentBuffer.EndOfBuffer())
                {
                    this.SizeChanged();
                    return;
                }

                dimensionConsumed += this.GetDimension(child.Object);
                objectConstraint   = this.GetConstraint(dimensionConstraint, dimensionConsumed);

                if (child.Next != null)
                {
                    child = child.Next;

                    if (this.CurrentCursorChild != null)
                    {
                        this.CurrentCursorChild.Object.ClearCursor();
                        this.CurrentCursorChild = child;
                        this.CurrentCursorChild.Object.SetCursor(false, this.Cursor);
                    }
                }
                else
                {
                    break;
                }
            }

            var newElement = this.ProduceChild(documentBuffer, objectConstraint);

            while (newElement != null)
            {
                this.AppendChild(newElement);
                dimensionConsumed += this.GetDimension(newElement);
                objectConstraint   = this.GetConstraint(dimensionConstraint, dimensionConsumed);

                if (documentBuffer.EndOfBuffer())
                {
                    break;
                }
                newElement = this.ProduceChild(documentBuffer, objectConstraint);
            }

            if (this.Cursor != null)
            {
                this.CurrentCursorChild?.Object.ClearCursor();
                this.CurrentCursorChild = this.LastChild;
                this.CurrentCursorChild.Object.SetCursor(true, this.Cursor);
            }

            this.SizeChanged();
        }