public MainWindow(){InitializeComponent();this.Loaded += (s, e) => DiscoverKinectSensor();this.Unloaded += (s, e) => this.kinect = null;}