Exemple #1
0
        private void RedoOperation(EraseOperation operation)
        {
            var stroke = (from item in Container.InkStrokes
                          where item.Id == operation.StrokeId
                          select item).FirstOrDefault();

            if (stroke == null)
            {
                return;
            }

            if (operation.Index == 0)
            {
                // trim off the beginning
                // stroke.Points.RemoveAt(0);
            }
            else
            {
                //  var newPoints = stroke.Points.Take(operation.Index);

                // stroke.Points = new List<Point>(newPoints);

                if (operation.NewStroke != null)
                {
                    Container.Add(new[] { operation.NewStroke });
                }
            }
        }
Exemple #2
0
        private void UndoOperation(EraseOperation operation)
        {
            var stroke = (from item in Container.InkStrokes
                          where item.Id == operation.StrokeId
                          select item).FirstOrDefault();

            if (stroke == null)
            {
                return;
            }

            //stroke.Points.Add(operation.Point);
            if (operation.NewStroke != null)
            {
                //stroke.Points.AddRange(operation.NewStroke.Points);
                Container.Remove(operation.NewStroke);
            }
        }