private void FinishStroke(Stroke stroke) { //Seal stroke for better performance stroke.Freeze(); // Remove finished stroke from the collection of strokes in drawing. _activeStrokes.Remove(stroke.Id); }
// Touch down event handler. private void OnTouchDownHandler(object sender, StylusEventArgs e) { // If there exist stroke with this ID, finish it. Stroke stroke; if(_activeStrokes.TryGetValue(e.StylusDevice.Id, out stroke)) { FinishStroke(stroke); return; } // Create new stroke, add point and assign a color to it. Stroke newStroke = new Stroke (); newStroke.Color = _touchColor.GetColor(); newStroke.Id = e.StylusDevice.Id; // Add new stroke to the collection of strokes in drawing. _activeStrokes[newStroke.Id] = newStroke; }