Beispiel #1
0
        /// <param name="start">
        ///  A caret position before the first character from a text range, not an index of an item.
        /// </param>
        /// <param name="end">
        ///  A caret position after the last character from a text range, not an index of an item.
        /// </param>
        /// <remark>
        ///  If there is a range "Test string", then start = 0, end = 11.
        ///  If start = 2 and end = 9, the range is "et stri".
        ///  If start=end, that points a caret position only, there is no any text range.
        /// </remark>
        public UiaTextRange(IRawElementProviderSimple enclosingElement, UiaTextProvider provider, int start, int end)
        {
            _enclosingElement = enclosingElement ?? throw new ArgumentNullException(nameof(enclosingElement));
            _provider         = provider ?? throw new ArgumentNullException(nameof(provider));

            if (start > 0)
            {
                _start = start;
                _end   = start;
            }

            if (end > _start)
            {
                _end = end;
            }
        }
Beispiel #2
0
        /// <param name="start">
        ///  A caret position before the first character from a text range, not an index of an item.
        /// </param>
        /// <param name="end">
        ///  A caret position after the last character from a text range, not an index of an item.
        /// </param>
        /// <remark>
        ///  If there is a range "Test string", then start = 0, end = 11.
        ///  If start = 2 and end = 9, the range is "et stri".
        ///  If start=end, that points a caret position only, there is no any text range.
        /// </remark>
        public UiaTextRange(IRawElementProviderSimple enclosingElement, UiaTextProvider provider, int start, int end)
        {
            _enclosingElement = enclosingElement.OrThrowIfNull();
            _provider         = provider.OrThrowIfNull();

            if (start > 0)
            {
                _start = start;
                _end   = start;
            }

            if (end > _start)
            {
                _end = end;
            }
        }