diff --git a/Sources/Lib/Class1.cs b/Sources/Lib/Class1.cs deleted file mode 100644 index dfbc46b..0000000 --- a/Sources/Lib/Class1.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Lib -{ - public class Class1 - { - } -} diff --git a/Sources/Lib/KinectManager.cs b/Sources/Lib/KinectManager.cs new file mode 100644 index 0000000..58289b4 --- /dev/null +++ b/Sources/Lib/KinectManager.cs @@ -0,0 +1,42 @@ +using System; +using Microsoft.Kinect; + +namespace Lib +{ + public class KinectManager + { + private static KinectSensor kinectSensor; + public static bool Status + { + get { return kinectSensor != null && kinectSensor.IsAvailable; } + } + public static string StatusText + { + get { return Status ? "Kinect est disponible" : "Kinect n'est pas disponible"; } + } + public static void StartSensor() + { + if (kinectSensor == null) + { + kinectSensor = KinectSensor.GetDefault(); + if (kinectSensor != null) + { + kinectSensor.IsAvailableChanged += KinectSensor_IsAvailableChanged; + kinectSensor.Open(); + } + } + } + public static void StopSensor() + { + if (kinectSensor != null) + { + kinectSensor.Close(); + kinectSensor = null; + } + } + private static void KinectSensor_IsAvailableChanged(object sender, IsAvailableChangedEventArgs args) + { + // Vous pouvez ajouter ici une logique supplémentaire si nécessaire + } + } +} diff --git a/Sources/Lib/Lib.csproj b/Sources/Lib/Lib.csproj index 12682ba..2c53495 100644 --- a/Sources/Lib/Lib.csproj +++ b/Sources/Lib/Lib.csproj @@ -1,10 +1,10 @@ - + Debug AnyCPU - 0751c83e-7845-4e5f-a5d3-e11aba393aca + {0751C83E-7845-4E5F-A5D3-E11ABA393ACA} Library Properties Lib @@ -31,24 +31,24 @@ 4 - - - - - - - - - - - - - - + + ..\packages\Microsoft.Kinect.2.0.1410.19000\lib\net45\Microsoft.Kinect.dll + + + + + + + + + - + + + + - + \ No newline at end of file diff --git a/Sources/Lib/packages.config b/Sources/Lib/packages.config new file mode 100644 index 0000000..f7f19c3 --- /dev/null +++ b/Sources/Lib/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Sources/WpfApp/MainWindow.xaml.cs b/Sources/WpfApp/MainWindow.xaml.cs index 3fabe8c..2e8edd9 100644 --- a/Sources/WpfApp/MainWindow.xaml.cs +++ b/Sources/WpfApp/MainWindow.xaml.cs @@ -65,12 +65,12 @@ namespace WpfApp private void Reader_ColorFrameArrived(object sender, ColorFrameArrivedEventArgs e) { - Debug.WriteLine("Frame de couleur arrivée."); + //Debug.WriteLine("Frame de couleur arrivée."); using (ColorFrame colorFrame = e.FrameReference.AcquireFrame()) { if (colorFrame != null) { - Debug.WriteLine("Traitement de la frame de couleur."); + //Debug.WriteLine("Traitement de la frame de couleur."); FrameDescription colorFrameDescription = colorFrame.FrameDescription; using (KinectBuffer colorBuffer = colorFrame.LockRawImageBuffer()) @@ -90,7 +90,7 @@ namespace WpfApp this.colorBitmap.Unlock(); } - Debug.WriteLine("Frame de couleur traitée."); + //Debug.WriteLine("Frame de couleur traitée."); } else {