private void button1_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();

                wlacz_kinect = false;
            }

            if (watek)
            {
                t1.Abort();
            }

            if (media_active)
            {
                this.mediaElement1.Stop();
                this.mediaElement1.Close();

                this.mediaElement2.Stop();
            }

            AnalizaRuchu a = new AnalizaRuchu();

            a.Wlacz(tryb, kinect_active, magia);
            a.Show();

            this.Close();

            media_active  = false;
            kinect_active = false;
        }
        private void button1_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();

                wlacz_kinect = false;
            }

            if (watek)
            {
                t1.Abort();
            }

            if (media_active)
            {
                this.mediaElement1.Stop();
                this.mediaElement1.Close();

                this.mediaElement2.Stop();
            }

            AnalizaRuchu a = new AnalizaRuchu();
            a.Wlacz(tryb, kinect_active, magia);
            a.Show();

            this.Close();

            media_active = false;
            kinect_active = false;
        }