private async void SetImage(byte[] ImageData) { MedicalCanvas.Children.Clear(); if (ImageData == null) { MedcialInkManager = new InkManager(); return; } InkManager inkMgr = MedcialInkManager; renderer = new XamlInkRenderer(MedicalCanvas); using (var stream = new InMemoryRandomAccessStream()) { await stream.WriteAsync(ImageData.AsBuffer()); await stream.FlushAsync(); stream.Seek(0); await inkMgr.LoadAsync(stream); var iskList = inkMgr.GetStrokes(); int iskCount = iskList.Count; renderer.Clear(); renderer.AddInk(iskList); } }
public void InkCanvas_PointerReleased(object sender, PointerRoutedEventArgs e) { if (e.Pointer.PointerId == pointerId) { try { PointerPoint pt = e.GetCurrentPoint(inkCanvas); inkManager.ProcessPointerUp(pt); pointerId = -1; renderer.ExitLiveRendering(pt); renderer.AddInk(inkManager.GetStrokes()[inkManager.GetStrokes().Count - 1]); } catch (Exception ex) { status.Log(ex.Message); } } }