public NoteTaker() { this.InitializeComponent(); // Replace the subscriptionKey string value with your valid subscription key. const string subscriptionKey = "[YOUR SUBSCRIPTION KEY]"; // URI information for ink recognition: const string endpoint = "https://api.cognitive.microsoft.com"; const string inkRecognitionUrl = "/inkrecognizer/v1.0-preview/recognize"; var inkPresenter = inkCanvas.InkPresenter; inkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Mouse; inkPresenter.StrokeInput.StrokeStarted += InkPresenter_StrokeInputStarted; inkPresenter.StrokeInput.StrokeEnded += InkPresenter_StrokeInputEnded; inkPresenter.StrokesCollected += InkPresenter_StrokesCollected; inkPresenter.StrokesErased += InkPresenter_StrokesErased; inkRecognizer = new InkRecognizer(subscriptionKey, endpoint, inkRecognitionUrl); displayInfo = DisplayInformation.GetForCurrentView(); inkRecognizer.SetDisplayInformation(displayInfo); dispatcherTimer = new DispatcherTimer(); dispatcherTimer.Tick += DispatcherTimer_Tick; dispatcherTimer.Interval = TimeSpan.FromMilliseconds(IDLE_WAITING_TIME); }
public MainWindow() { InitializeComponent(); const string subscriptionKey = "[YOUR SUBSCRIPTION KEY]"; const string endpoint = "https://api.cognitive.microsoft.com"; const string inkRecognitionUrl = "/inkrecognizer/v1.0-preview/recognize"; inkRecognizer = new InkRecognizer(subscriptionKey, endpoint, inkRecognitionUrl); displayInfo = DisplayInformation.GetForCurrentView(); inkRecognizer.SetDisplayInformation(displayInfo); inkCanvas.InkPresenter.StrokeInput.StrokeStarted += StrokeInput_StrokeStarted; inkCanvas.InkPresenter.StrokeInput.StrokeEnded += StrokeInput_StrokeEnded; dispatcherTimer = new DispatcherTimer(); dispatcherTimer.Tick += DispatcherTimer_Tick; dispatcherTimer.Interval = TimeSpan.FromMilliseconds(IDLE_WAITING_TIME); }