示例#1
0
        public TextMarker TryCreate(int startOffset, int length)
        {
            if (_markers == null)
                throw new InvalidOperationException("Cannot create a marker when not attached to a document");

            var textLength = _document.TextLength;
            if (startOffset < 0 || startOffset > textLength)
                return null;

            if (length < 0 || startOffset + length > textLength)
                return null;

            var marker = new TextMarker(this, startOffset, length);
            _markers.Add(marker);

            return marker;
        }
示例#2
0
 public void AddMarker(TextMarker marker)
 {
     _markers.Add(marker);
 }
示例#3
0
 public void Remove(TextMarker marker)
 {
     if (marker == null)
         throw new ArgumentNullException(nameof(marker));
     var m = marker;
     if (_markers != null && _markers.Remove(m))
     {
         Redraw(m);
         m.OnDeleted();
     }
 }
示例#4
0
 public void AddMarker(TextMarker marker)
 {
     _markers.Add(marker);
 }