Exemplo n.º 1
0
        private async void InkStrokeContainer_StrokesErased(object sender, Xamarin.Forms.Inking.XInkStrokesErasedEventArgs e)
        {
            var undoItem = App.Container.Resolve <IAddStrokesUndoItem>();

            undoItem.Container = App.GetSketchData();
            undoItem.Strokes   = e.Strokes.ToList();
            undoItem.IsErase   = true;

            _viewModel.UndoManager.Add(undoItem);

            App.GetSketchData().InkStrokes = InkCanvas.GetInkCanvasView().InkPresenter.StrokeContainer.GetStrokes();

            await UpdateWebViewAsync().ConfigureAwait(false);
        }
        /// <summary>
        /// Remove all of the ink stroks from the container
        /// </summary>
        public void Clear()
        {
            lock (_inkStrokes)
            {
                var args = new XInkStrokesErasedEventArgs(_inkStrokes.ToList());

                if (_inkStrokes.Any())
                {
                    _inkStrokes.ForEach(delegate(XInkStroke item)
                    {
                        item.Dispose();
                    });

                    _inkStrokes.Clear();

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

            GC.Collect();
        }