/// <summary>
        /// Add an ink stroke to the container
        /// </summary>
        /// <param name="stroke">the stroke to add</param>
        public void Add(XInkStroke stroke)
        {
            lock (_inkStrokes)
            {
                _inkStrokes.Add(stroke);

                InkChanged?.Invoke(this, new EventArgs());
            }
        }
Exemple #2
0
        /// <summary>
        /// Creates a strokes from ink points
        /// </summary>
        /// <param name="inkPoints">the ink points</param>
        /// <returns>a new ink stroke</returns>
        public XInkStroke CreateStrokeFromInkPoints(IEnumerable <XInkPoint> inkPoints)
        {
            if (inkPoints == null)
            {
                throw new ArgumentNullException(nameof(inkPoints));
            }

            var stroke = new XInkStroke
            {
                DrawingAttributes = _attributes.Copy()
            };

            stroke.AddRange(inkPoints);

            return(stroke);
        }
        /// <summary>
        /// Remove the ink stroke
        /// </summary>
        /// <param name="item">the ink stroke</param>
        public void Remove(XInkStroke item)
        {
            if (item == null)
            {
                return;
            }

            lock (_inkStrokes)
            {
                item.Dispose();

                _inkStrokes.Remove(item);
            }

            InkChanged?.Invoke(this, new EventArgs());
        }