public void Dispose() { if (_disposed) { return; } _recognizerContext.Dispose(); _strokes.Dispose(); _ink.Dispose(); _disposed = true; }
/// <summary> /// Sets the recognizer engine used to convert strokes to text. /// </summary> /// <param name="engineId">The GUID of the recognizer engine.</param> /// <exception cref="ArgumentException"> /// Thrown if the engine is invalid or does not exist. /// </exception> public void SetEngine(Guid engineId) { EnsureNotDisposed(); _recognizerContext?.Dispose(); Recognizer engineImpl = _recognizers .Cast <Recognizer>() .FirstOrDefault(x => x.Id == engineId); if (engineImpl == null) { throw new ArgumentException("Engine not found: " + engineId); } _recognizerContext = engineImpl.CreateRecognizerContext(); }