private void OnPathBuilderHistoryUndoRedoHappened(object sender, UndoRedoEventArgs <SmoothPathBuilder> e)
        {
            _needToRedrawInkSurface = true;
            _canvas.Invalidate();

            StrokesChanged?.Invoke(this, EventArgs.Empty);
        }
Пример #2
0
 private void InkPresenter_StrokesCollected(InkPresenter sender, InkStrokesCollectedEventArgs args)
 {
     foreach (var item in args.Strokes)
     {
         _redoList.Add(item);
     }
     _undoList.Clear();
     _undoCommand?.OnCanExecuteChanged();
     _redoCommand?.OnCanExecuteChanged();
     StrokesChanged?.Invoke(sender, EventArgs.Empty);
 }
Пример #3
0
        public void AddRange(IEnumerable <InkStroke> strokes, Matrix3x2 logicalTransform)
        {
            IEnumerable <InkStrokeWithTransform> strokesWithTransform = strokes.Select(s => new InkStrokeWithTransform(s, logicalTransform));

            lock (_strokes)
            {
                if (!_allowMultipleStrokes)
                {
                    Clear();
                }

                _strokes.AddRange(strokesWithTransform);
                _container.AddStrokes(strokes);
            }

            StrokesChanged?.Invoke(this, EventArgs.Empty);
        }
Пример #4
0
        private void InkPresenter_StrokesErased(InkPresenter sender, InkStrokesErasedEventArgs args)
        {
            foreach (var item in args.Strokes)
            {
                var strokeBuilder = new InkStrokeBuilder();
                strokeBuilder.SetDefaultDrawingAttributes(item.DrawingAttributes);
                var stroke = strokeBuilder.CreateStrokeFromInkPoints(item.GetInkPoints(), item.PointTransform);
                _undoList.Add(stroke);
                if (_redoList.Contains(item))
                {
                    _redoList.Remove(item);
                }
            }

            _undoCommand?.OnCanExecuteChanged();
            _redoCommand?.OnCanExecuteChanged();
            StrokesChanged?.Invoke(sender, EventArgs.Empty);
        }
Пример #5
0
        public Task <bool> EraseBetweenAsync(CoreDispatcher dispatcher, Point pointOne, Point pointTwo)
        {
            return(dispatcher.AwaitableRunAsync(() =>
            {
                Rect result = _container.SelectWithLine(pointOne, pointTwo);
                if (result.Area() <= 0)
                {
                    return false;
                }

                lock (_strokes)
                {
                    foreach (InkStroke stroke in _container.GetStrokes().Where(s => s.Selected))
                    {
                        _strokes.RemoveAll(s => s.Equals(stroke));
                    }

                    _container.DeleteSelected();
                }

                StrokesChanged?.Invoke(this, EventArgs.Empty);
                return true;
            }));
        }