private void b_dalej_Click(object sender, RoutedEventArgs e) { watek[6] = false; wlacz_kinect = false; progressBar1.Visibility = Visibility.Hidden; if (watek_active) { t1.Abort(); watek_active = false; } if (kinect_active) { Thread.Sleep(100); kinectSensor.Stop(); foreach (var potentialSensor in KinectSensor.KinectSensors) { if (potentialSensor.Status == KinectStatus.Disconnected) { kinectSensor = null; break; } } this.kinectSensor.SkeletonFrameReady -= this.nui_SkeletonFrameReady; this.kinectSensor.SkeletonStream.Disable(); } // PrezentacjaCwiczenia a = new PrezentacjaCwiczenia(); a.Wlacz(tryb, kinect_active, magia); a.Show(); kinect_active = false; this.Close(); Close(); }