Ejemplo n.º 1
0
        private void FinishStroke(Stroke stroke)
        {
            //Seal stroke for better performance
            stroke.Seal();

            // Add finished stroke to the collection of finished strokes.
            _finishedStrokes.Add(stroke);

            // Remove finished stroke from the collection of strokes in drawing.
            _activeStrokes.Remove(stroke.Id);
        }
Ejemplo n.º 2
0
        // Touch down event handler.
        private void OnTouchDownHandler(object sender, Windows7.Multitouch.TouchEventArgs e)
        {

            // If there exist stroke with this ID, finish it.
            Stroke stroke;

            if(_activeStrokes.TryGetValue(e.Id, out stroke))
            {
                FinishStroke(stroke);
                // Request redraw of the window.
                Invalidate();
                return;
            }

            // Create new stroke, add point and assign a color to it.
            Stroke newStroke = new Stroke ();
            newStroke.Color = _touchColor.GetColor(e.IsPrimaryContact);
            newStroke.Id = e.Id;

            // Add new stroke to the collection of strokes in drawing.
            _activeStrokes[newStroke.Id] = newStroke;
        }