|
@@ -80,6 +80,25 @@ namespace KinectCar
|
|
|
_bodyFrameReader = _kinectSensor.BodyFrameSource.OpenReader();
|
|
|
|
|
|
_colorFrameReader = _kinectSensor.ColorFrameSource.OpenReader();
|
|
|
+
|
|
|
+ if (_bodyFrameReader != null)
|
|
|
+ {
|
|
|
+ _bodyFrameReader.FrameArrived += Reader_FrameArrived;
|
|
|
+ }
|
|
|
+ if (_colorFrameReader != null)
|
|
|
+ {
|
|
|
+ _colorFrameReader.FrameArrived += Reader_ColorFrameArrived;
|
|
|
+ }
|
|
|
+
|
|
|
+ var colorFrameDescription = _kinectSensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Bgra);
|
|
|
+
|
|
|
+ _colorBitmap = new WriteableBitmap(colorFrameDescription.Width, colorFrameDescription.Height, 96.0, 96.0, PixelFormats.Bgr32, null);
|
|
|
+
|
|
|
+
|
|
|
+ _kinectSensor.IsAvailableChanged += Sensor_IsAvailableChanged;
|
|
|
+
|
|
|
+ _kinectSensor.Open();
|
|
|
+
|
|
|
|
|
|
_bones = new List<Tuple<JointType, JointType>>
|
|
|
{
|
|
@@ -114,10 +133,6 @@ namespace KinectCar
|
|
|
new Tuple<JointType, JointType>(JointType.AnkleLeft, JointType.FootLeft)
|
|
|
};
|
|
|
|
|
|
-
|
|
|
- _kinectSensor.IsAvailableChanged += Sensor_IsAvailableChanged;
|
|
|
-
|
|
|
- _kinectSensor.Open();
|
|
|
|
|
|
StatusText = _kinectSensor.IsAvailable ? Properties.Resources.RunningStatusText : Properties.Resources.NoSensorStatusText;
|
|
|
|
|
@@ -128,19 +143,6 @@ namespace KinectCar
|
|
|
|
|
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
- if (_bodyFrameReader != null)
|
|
|
- {
|
|
|
- _bodyFrameReader.FrameArrived += Reader_FrameArrived;
|
|
|
- }
|
|
|
- if (_colorFrameReader != null)
|
|
|
- {
|
|
|
- _colorFrameReader.FrameArrived += Reader_ColorFrameArrived;
|
|
|
- }
|
|
|
-
|
|
|
- var colorFrameDescription = _kinectSensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Bgra);
|
|
|
-
|
|
|
- _colorBitmap = new WriteableBitmap(colorFrameDescription.Width, colorFrameDescription.Height, 96.0, 96.0, PixelFormats.Bgr32, null);
|
|
|
-
|
|
|
|
|
|
_client.MqttMsgPublishReceived += ClientMqttMsgPublishReceived;
|
|
|
|
|
@@ -363,6 +365,11 @@ namespace KinectCar
|
|
|
WindowState = WindowState.Normal;
|
|
|
WindowStyle = WindowStyle.SingleBorderWindow;
|
|
|
break;
|
|
|
+ case Key.Space:
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -375,9 +382,9 @@ namespace KinectCar
|
|
|
{
|
|
|
ToolBar.Visibility = Visibility.Hidden;
|
|
|
ViewBox.Margin = new Thickness { Left = 0, Top = 0, Right = 0, Bottom = 0 };
|
|
|
- this.Topmost = false;
|
|
|
- this.WindowStyle = WindowStyle.None;
|
|
|
- this.WindowState = WindowState.Maximized;
|
|
|
+ Topmost = false;
|
|
|
+ WindowStyle = WindowStyle.None;
|
|
|
+ WindowState = WindowState.Maximized;
|
|
|
}
|
|
|
|
|
|
public ImageSource ImageSource => _colorBitmap;
|