private void button2_Click(object sender, RoutedEventArgs e)
        {
            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();

                kinect_active = false;
            }


            for (int i = 0; i < 3; i++)
            {
                if (watek[i])
                {
                    t1.Abort();
                }
            }

            TRYB_KONTROLI_RUCHOW t = new TRYB_KONTROLI_RUCHOW();

            TrybStatycznyWyborCwiczenia a = new TrybStatycznyWyborCwiczenia();

            a.Wlacz(t, magia);
            a.Show();

            this.Close();
        }
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            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();

                kinect_active = false;
            }

            for (int i = 0; i < 3; i++)
            {
                if (watek[i])
                {
                    t1.Abort();
                }
            }

            TRYB_KONTROLI_RUCHOW t = new TRYB_KONTROLI_RUCHOW();

            TrybStatycznyWyborCwiczenia a = new TrybStatycznyWyborCwiczenia();
            a.Wlacz(t, magia);
            a.Show();

            this.Close();
        }