void SetSource(PlaybackTouchMouseSensorEventArgs e) { // Convert bitmap from memory to graphic form. BitmapSource source = BitmapSource.Create(e.Status.m_dwImageWidth, e.Status.m_dwImageHeight, 96, 96, PixelFormats.Gray8, null, e.Image, e.Status.m_dwImageWidth); // Show bitmap in user interface. SensorImage.Source = source; }
void Player_Handler(object sender, PlaybackTouchMouseSensorEventArgs e) { // We're in a thread belonging to the mouse, not the user interface // thread. Need to dispatch to the user interface thread. Dispatcher.Invoke((Action<PlaybackTouchMouseSensorEventArgs>)SetSource, e); }