private async void RealTimeInkPage_Loaded(object sender, RoutedEventArgs e)
        {
            IDigitalInkDevice device = AppObjects.Instance.Device;

            if (device == null)
            {
                textBlockPrompt.Text = "Device not connected";
                return;
            }

            device.Disconnected              += OnDeviceDisconnected;
            device.DeviceStatusChanged       += OnDeviceStatusChanged;
            device.PairingModeEnabledCallback = OnPairingModeEnabledAsync;

            IRealTimeInkService service = device.GetService(InkDeviceService.RealTimeInk) as IRealTimeInkService;

            service.NewPage            += OnNewPage;
            service.HoverPointReceived += OnHoverPointReceived;
            //service.StrokeStarted += Service_StrokeStarted;
            //service.StrokeEnded += Service_StrokeEnded;
            //service.StrokeUpdated += Service_StrokeUpdated;

            if (service == null)
            {
                textBlockPrompt.Text = "The Real-time Ink service is not supported on this device";
                return;
            }

            textBlockPrompt.Text = AppObjects.GetStringForDeviceStatus(device.DeviceStatus);

            try
            {
                uint width = (uint)await device.GetPropertyAsync("Width", m_cts.Token);

                uint height = (uint)await device.GetPropertyAsync("Height", m_cts.Token);

                uint ptSize = (uint)await device.GetPropertyAsync("PointSize", m_cts.Token);

                service.Transform = AppObjects.CalculateTransform(width, height, ptSize);

                float scaleFactor = ptSize * AppObjects.micrometerToDip;

                InkCanvasDocument document = new InkCanvasDocument();
                document.Size = new Windows.Foundation.Size(height * scaleFactor, width * scaleFactor);
                document.InkCanvasLayers.Add(new InkCanvasLayer());

                inkCanvas.InkCanvasDocument  = document;
                inkCanvas.GesturesManager    = new GesturesManager();
                inkCanvas.StrokeDataProvider = service;

                if (!service.IsStarted)
                {
                    await service.StartAsync(false, m_cts.Token);
                }
            }
            catch (Exception)
            {
            }
        }
        private void listView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var item = listView.SelectedItem as InkDocumentDisplayItem;

            if (item != null)
            {
                inkCanvas.InkCanvasDocument = InkCanvasDocument.FromInkDocument(item.Document);
            }
        }