Example #1
0
        private void RedoButton_Click(object sender, RoutedEventArgs e)
        {
            if (UndoneStrokes.Count == 0)
            {
                return;
            }

            Strokes.Add(UndoneStrokes.Last());
            UndoneStrokes.Remove(UndoneStrokes.Last());
        }
Example #2
0
        private void UndoButton_Click(object sender, RoutedEventArgs e)
        {
            if (Strokes == null || Strokes.Count == 0)
            {
                return;
            }

            UndoneStrokes.Add(Strokes.ElementAt(Strokes.Count - 1));
            Strokes.RemoveAt(Strokes.Count - 1);
        }
Example #3
0
        public void Redo()
        {
            if (UndoneStrokes.Count == 0)
            {
                return;
            }

            lock (StrokesLock)
            {
                var strokeToRedo = UndoneStrokes.Pop();
                Strokes.Add(strokeToRedo);
                StrokeCollection.UpdateStroke(strokeToRedo.Id, strokeToRedo);
            }
        }
Example #4
0
        public void Undo()
        {
            lock (StrokesLock)
            {
                var currentUserLatestStroke = StrokeCollection.GetMergedStrokeMaps()?.FindLast(x => x.AuthorId == UserId);
                if (currentUserLatestStroke == null)
                {
                    return;
                }

                Strokes.Remove(currentUserLatestStroke);
                StrokeCollection.UpdateStroke(currentUserLatestStroke.Id, null);
                UndoneStrokes.Push(currentUserLatestStroke);
            }
        }