private void btnOpenCamera_Click(object sender, RoutedEventArgs e) { cameraDevice = manager.CreateCamera(camlist[cbCameras.SelectedIndex]); if (cameraDevice == null) { MessageBox.Show("Failed to create camera device.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } var ret = cameraDevice.Initialize(); if (ret != CameraStatus.SUCCESS) { MessageBox.Show("Cannot initiralize the camera device. Error code:" + (int)ret, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } string str; cameraDevice.GetCameraName(out str); tbCameraName.Text = str; ushort width; cameraDevice.GetMaxSensorWidth(out width); tbMaxWidth.Text = width.ToString(); ushort height; cameraDevice.GetMaxSensorHeight(out height); tbMaxHeight.Text = height.ToString(); List <string> useCases; cameraDevice.GetUseCases(out useCases); useCases.ForEach(item => cbUseCases.Items.Add(item)); cbUseCases.SelectedIndex = 0; btnStartCapture.IsEnabled = true; cameraDevice.RegisterDepthDataListener(new DepthDataListener(this)); }