Beispiel #1
0
 public void Dispose()
 {
     if (_disposed)
     {
         return;
     }
     _recognizerContext.Dispose();
     _strokes.Dispose();
     _ink.Dispose();
     _disposed = true;
 }
        private void inkOverlay_Stroke(object sender, InkCollectorStrokeEventArgs e)
        {
            Strokes strokes   = null;
            Ink     copiedInk = null;

            try
            {
                // Eraser strokes are transparent, we don't need to send them
                if (e.Stroke.DrawingAttributes.Transparency != 255)
                {
                    // Give the stroke an identifier, so we can delete it remotely
                    e.Stroke.ExtendedProperties.Add(StrokeIdentifier, Guid.NewGuid().ToString());

                    // Copy the stroke into its own Ink object, so that it can be serialized
                    strokes   = inkOverlay.Ink.CreateStrokes(new int[] { e.Stroke.Id });
                    copiedInk = e.Stroke.Ink.ExtractStrokes(strokes, ExtractFlags.CopyFromOriginal);

                    // Send it across the network
                    wb.SendObject(new SerializedInk(copiedInk));
                }
            }
            catch (Exception ex)
            {
                Log(ex.ToString());
            }
            finally
            {
                if (strokes != null)
                {
                    strokes.Dispose();
                }

                if (copiedInk != null)
                {
                    copiedInk.Dispose();
                }
            }
        }