How theredepic/kinect-wpf works
Purpose and Runtime
This is a Windows WPF desktop application that uses Kinect input to control the system cursor. The solution is rooted at kinect-wpf.slnx; the application project is Kinect/Kinect.csproj. It runs on .NET/WPF and depends on Kinect runtime APIs plus Windows native cursor APIs.
Application Entry and UI Shell
WPF startup is declared by Kinect/App.xaml and initialized in Kinect/App.xaml.cs. The primary UI and likely lifecycle coordinator are Kinect/MainWindow.xaml and Kinect/MainWindow.xaml.cs. The main window owns presentation concerns while delegating sensor and cursor behavior to services.
Kinect Sensor Integration
Kinect/Services/KinectService.cs is the hardware-facing boundary. It is responsible for connecting to and managing Kinect sensor state, receiving Kinect interaction/body or pointer events, and exposing sensor-derived input to the application. This isolates Kinect SDK lifecycle and event handling from WPF UI logic.
Interaction Interpretation
Kinect/Services/SimpleInteractionClient.cs represents the Kinect interaction-client adapter. It supplies Kinect’s interaction subsystem with required callbacks or interaction decisions, enabling raw sensor/body data to be interpreted as hand/pointer interaction rather than direct UI input.
Cursor-Control Pipeline
Kinect/Services/CursorController.cs converts Kinect-derived interaction coordinates or gestures into desktop cursor actions. It is the boundary between normalized/sensor-space input and OS-level screen coordinates, movement, and clicking behavior. The expected flow is:
Kinect sensor events → interaction client/service → cursor controller → Windows cursor APIs.
Native OS Boundary
Kinect/Helpers/NativeMethods.cs contains the platform interop boundary for Windows APIs used by cursor control. Keeping P/Invoke declarations here prevents Kinect and UI layers from directly depending on unmanaged function signatures.
Key Boundaries and Control Flow
The WPF layer starts and stops the sensor/control pipeline through Kinect/MainWindow.xaml.cs. Kinect/Services/KinectService.cs owns external Kinect hardware/runtime interaction; Kinect/Services/CursorController.cs owns external Windows input interaction. This separation allows UI changes without rewriting sensor handling, and sensor interpretation changes without directly modifying native cursor calls.
Main entry points: KinectService.cs Kinect service · Kinect.csproj Kinect project · MainWindow.xaml.cs Lifecycle coordinator · App.xaml App startup
Components 12
WPF Application
- Kinect project
Kinect/Kinect.csproj - App startup
Kinect/App.xaml - App initialization
Kinect/App.xaml.cs - Main window
Kinect/MainWindow.xaml - Lifecycle coordinator · Starts and stops the sensor and cursor pipeline.
Kinect/MainWindow.xaml.cs
Kinect Input Pipeline
- Kinect runtime · Hardware sensor and interaction APIs.
- Kinect service · Owns sensor lifecycle and publishes sensor-derived interaction input.
Kinect/Services/KinectService.cs - Interaction client · Provides interaction callbacks and decisions to the Kinect subsystem.
Kinect/Services/SimpleInteractionClient.cs
Windows Integration
- Cursor controller · Maps interaction coordinates and gestures to desktop cursor actions.
Kinect/Services/CursorController.cs - Native methods · Declares Windows cursor API interop.
Kinect/Helpers/NativeMethods.cs - Windows cursor APIs
Other components
- kinect-wpf.slnx · Solution root.
kinect-wpf.slnx
Connections 12
- kinect-wpf.slnx → Kinect project: contains
- Kinect project → App startup: includes
- App startup → App initialization: initializes
- App initialization → Lifecycle coordinator: starts
- Kinect project → Main window: includes
- Main window → Lifecycle coordinator: defines UI
- Lifecycle coordinator → Kinect service: starts / stops
- Kinect service → Kinect runtime: connects and receives events
- Kinect service → Interaction client: uses for interaction
- Kinect service → Cursor controller: forwards interaction input
- Cursor controller → Native methods: invokes
- Native methods → Windows cursor APIs: P/Invoke