void DataReceived(object sender, byte[] e)
        {
            Console.WriteLine("recieved1");

            UDP_PACKETS_CODER.UDP_PACKETS_DECODER dec = new UDP_PACKETS_CODER.UDP_PACKETS_DECODER();

            dec.Source = e;
            int i = dec.get_int();

            switch (i)
            {
            case 0:
                this.calibMode = Calibration._calibMode.zero; this.IsCalib = true; break;

            case 1:
                this.calibMode = Calibration._calibMode.x; this.IsCalib = true; break;

            case 2:
                this.calibMode = Calibration._calibMode.z; this.IsCalib = true; break;

            case 3: break;

            case 4: break;
            }
            if (i == 0)
            {
                Console.WriteLine("change");
                this.IsCalib = true;
            }

            this.IsCalib = true;
            Console.WriteLine("recieved2");
        }
        public MainWindow()
        {
            InitializeComponent();

            this.IsSave      = false;
            this.IsCalib     = false;
            this.kinect      = KinectSensor.GetDefault();
            this.MaxofJoints = (byte)24;
            this.Dimension   = (byte)7;
            //colorImage
            #region
            this.colorImageFormat               = ColorImageFormat.Bgra;
            this.colorFrameDescription          = this.kinect.ColorFrameSource.CreateFrameDescription(this.colorImageFormat);
            this.colorFrameReader               = this.kinect.ColorFrameSource.OpenReader();
            this.colorFrameReader.FrameArrived += ColorFrame_Arrived;
            this.colors = new byte[this.colorFrameDescription.Width
                                   * this.colorFrameDescription.Height
                                   * this.colorFrameDescription.BytesPerPixel];
            this.imageWidth              = this.colorFrameDescription.Width;
            this.imageHeigt              = this.colorFrameDescription.Height;
            this.colorImg                = new WriteableBitmap(this.colorFrameDescription.Width, this.colorFrameDescription.Height, 96, 96, PixelFormats.Bgr32, null);
            this.calibImg                = new WriteableBitmap(this.colorFrameDescription.Width, this.colorFrameDescription.Height, 96, 96, PixelFormats.Bgr32, null);
            this.bitmapRect              = new Int32Rect(0, 0, this.colorFrameDescription.Width, this.colorFrameDescription.Height);
            this.bitmapStride            = this.colorFrameDescription.Width * (int)this.colorFrameDescription.BytesPerPixel;
            this.colorImage.Source       = this.colorImg;
            this.calibrationImage.Source = this.calibImg;
            #endregion
            //骨格情報
            #region
            this.bodyFrameReader = this.kinect.BodyFrameSource.OpenReader();
            this.bodyFrameReader.FrameArrived += BodyFrame_Arrived;
            #endregion
            //震度情報
            #region
            this.depthFrameReader = this.kinect.DepthFrameSource.OpenReader();
            this.depthFrameReader.FrameArrived += DepthFrame_Arrived;
            this.depthFrameDescription          = this.kinect.DepthFrameSource.FrameDescription;
            this.depthBuffer      = new ushort[this.depthFrameDescription.LengthInPixels];
            this.depthImageWidth  = this.depthFrameDescription.Width;
            this.depthImageHeight = this.depthFrameDescription.Height;
            #endregion

            this.calib         = new Calibration();
            this.calibMode     = Calibration._calibMode.zero;
            this.preIP         = "127.0.0.1";
            this.preCLientPort = 54000;
            this.preServerPort = 50000;
            this.Closed       += MainWindow_Closed;
            //System.Threading.Timer timer = new System.Threading.Timer(new System.Threading.TimerCallback(this.Callback));
            //timer.Change(0, 1000);
        }
        public MainWindow()
        {
            InitializeComponent();

            this.IsSave = false;
            this.IsCalib = false;
            this.kinect = KinectSensor.GetDefault();
            this.MaxofJoints = (byte)24;
            this.Dimension = (byte)7;
            //colorImage
            #region
            this.colorImageFormat = ColorImageFormat.Bgra;
            this.colorFrameDescription = this.kinect.ColorFrameSource.CreateFrameDescription(this.colorImageFormat);
            this.colorFrameReader = this.kinect.ColorFrameSource.OpenReader();
            this.colorFrameReader.FrameArrived += ColorFrame_Arrived;
            this.colors = new byte[this.colorFrameDescription.Width
                                           * this.colorFrameDescription.Height
                                           * this.colorFrameDescription.BytesPerPixel];
            this.imageWidth = this.colorFrameDescription.Width;
            this.imageHeigt = this.colorFrameDescription.Height;
            this.colorImg = new WriteableBitmap(this.colorFrameDescription.Width, this.colorFrameDescription.Height, 96, 96, PixelFormats.Bgr32, null);
            this.calibImg = new WriteableBitmap(this.colorFrameDescription.Width, this.colorFrameDescription.Height, 96, 96, PixelFormats.Bgr32, null);
            this.bitmapRect = new Int32Rect(0, 0, this.colorFrameDescription.Width, this.colorFrameDescription.Height);
            this.bitmapStride = this.colorFrameDescription.Width * (int)this.colorFrameDescription.BytesPerPixel;
            this.colorImage.Source = this.colorImg;
            this.calibrationImage.Source = this.calibImg;
            #endregion
            //骨格情報
            #region
            this.bodyFrameReader = this.kinect.BodyFrameSource.OpenReader();
            this.bodyFrameReader.FrameArrived += BodyFrame_Arrived;
            #endregion
            //震度情報
            #region
            this.depthFrameReader = this.kinect.DepthFrameSource.OpenReader();
            this.depthFrameReader.FrameArrived += DepthFrame_Arrived;
            this.depthFrameDescription = this.kinect.DepthFrameSource.FrameDescription;
            this.depthBuffer = new ushort[this.depthFrameDescription.LengthInPixels];
            this.depthImageWidth = this.depthFrameDescription.Width;
            this.depthImageHeight = this.depthFrameDescription.Height;
            #endregion

            this.calib = new Calibration();
            this.calibMode = Calibration._calibMode.zero;
            this.preIP = "127.0.0.1";
            this.preCLientPort = 54000;
            this.preServerPort = 50000;
            this.Closed += MainWindow_Closed;
            //System.Threading.Timer timer = new System.Threading.Timer(new System.Threading.TimerCallback(this.Callback));
            //timer.Change(0, 1000);
        }
        void DataReceived(object sender, byte[] e)
        {
            Console.WriteLine("recieved1");

            UDP_PACKETS_CODER.UDP_PACKETS_DECODER dec = new UDP_PACKETS_CODER.UDP_PACKETS_DECODER();

            dec.Source = e;
            int i = dec.get_int();

            switch (i)
            {
                case 0:
                    this.calibMode = Calibration._calibMode.zero; this.IsCalib = true; break;
                case 1:
                    this.calibMode = Calibration._calibMode.x; this.IsCalib = true; break;
                case 2:
                    this.calibMode = Calibration._calibMode.z; this.IsCalib = true; break;
                case 3: break;
                case 4: break;

            }
            if (i == 0)
            {
                Console.WriteLine("change");
                this.IsCalib = true;

            }

            this.IsCalib = true;
            Console.WriteLine("recieved2");
        }