Exemplo n.º 1
0
            /// <summary>
            /// Creates a wrapper for the helement handle
            /// </summary>
            public Element GetElement(IntPtr helement)
            {
                var element = GetElementFast(helement);

                if (element == null)
                {
                    if (_elementsInUse != null && _elementsInUse.TryGetValue(helement, out element))
                    {
                        return(element);
                    }

                    if (_previous != null)
                    {
                        element = _previous.GetElement(helement);
                    }

                    if (element == null && Object.ReferenceEquals(Current, this))
                    {
                        SciterHostApi.SciterDomApi.UseElement(helement);
                        element = Element.CreateInternal(helement);

                        if (_elementsInUse == null && !SetElementFast(helement, element))
                        {
                            _elementsInUse = _elementsInUse ?? new Dictionary <IntPtr, Element>();
                            _elementsInUse.Add(helement, element);
                        }
                    }
                }

                return(element);
            }
Exemplo n.º 2
0
 /// <summary>
 /// Creates a new instance of the <see cref="ElementRef"/> class
 /// </summary>
 /// <param name="he">Handle will be "attached" without calling Sciter_UseElement</param>
 internal ElementRef(IntPtr he)
     : this(Element.CreateInternal(he), ElementRefType.Normal, true)
 {
 }