コード例 #1
0
        private void Button_GetSessions_Click(object sender, RoutedEventArgs e)
        {
            selectedUserName = PatientListBox.SelectedValue.ToString();

            using (DataService.Service1Client s = new DataService.Service1Client())
            {
                SessionListBox.ItemsSource = s.GetSessions(selectedUserName);
            }
        }
コード例 #2
0
        /// <summary>
        /// Execute start up tasks
        /// </summary>
        /// <param name="sender">object sending the event</param>
        /// <param name="e">event arguments</param>
        private void UserSessionPage_Loaded(object sender, RoutedEventArgs e)
        {
            //Place username in textbox
            //textBox.Text = username;

            s = new DataService.Service1Client();

            if (this.bodyFrameReader != null)
            {
                this.bodyFrameReader.FrameArrived += this.Reader_FrameArrived;
            }
        }
コード例 #3
0
        public AdminPage()
        {
            InitializeComponent();

            List <string> patientNames;

            using (DataService.Service1Client s = new DataService.Service1Client())
            {
                patientNames = s.GetPatients().ToList <string>();
            }

            PatientListBox.ItemsSource = patientNames;
        }
コード例 #4
0
        /// <summary>
        /// Handles the body frame data arriving from the sensor
        /// </summary>
        /// <param name="sender">object sending the event</param>
        /// <param name="e">event arguments</param>
        private void Reader_FrameArrived(object sender, BodyFrameArrivedEventArgs e)
        {
            bool dataReceived = true;

            using (BodyFrame bodyFrame = e.FrameReference.AcquireFrame())
            {
                if (ranOunce == false)
                {
                    textBox.Text = username;
                    using (DataService.Service1Client s = new DataService.Service1Client())
                    {
                        retrievedData = s.GetBodyData(username, sessionname).ToArray();
                    }

                    ranOunce = true;
                }

                if (bodyFrame != null)
                {
                    if (this.bodies == null)
                    {
                        this.bodies = new Body[bodyFrame.BodyCount];
                    }

                    // The first time GetAndRefreshBodyData is called, Kinect will allocate each Body in the array.
                    // As long as those body objects are not disposed and not set to null in the array,
                    // those body objects will be re-used.


                    bodyFrame.GetAndRefreshBodyData(this.bodies);
                    dataReceived = true;
                }
            }

            if (dataReceived)
            {
                using (DrawingContext dc = this.drawingGroup.Open())
                {
                    // Draw a transparent background to set the render size
                    dc.DrawRectangle(Brushes.Black, null, new Rect(0.0, 0.0, this.displayWidth, this.displayHeight));

                    int penIndex = 0;

                    Pen drawPen = this.bodyColors[penIndex++];

                    if (true)
                    {
                        this.DrawClippedEdges(this.bodies[0], dc);

                        IReadOnlyDictionary <JointType, Joint> joints = this.bodies[0].Joints;

                        // convert the joint points to depth (display) space
                        Dictionary <JointType, Point> jointPoints = new Dictionary <JointType, Point>();

                        foreach (JointType jointType in joints.Keys)
                        {
                            // sometimes the depth(Z) of an inferred joint may show as negative
                            // clamp down to 0.1f to prevent coordinatemapper from returning (-Infinity, -Infinity)
                            CameraSpacePoint position = joints[jointType].Position;

                            // if (sendMe)
                            // {
                            // using (XboxWCFService.Service1Client s = new XboxWCFService.Service1Client())
                            //{
                            //     textBox.Text = s.GetData(Convert.ToInt32(position.Z));
                            //     sendMe = false;
                            // }
                            //}



                            if (position.Z < 0)
                            {
                                position.Z = InferredZPositionClamp;
                            }

                            DepthSpacePoint depthSpacePoint = this.coordinateMapper.MapCameraPointToDepthSpace(position);
                            jointPoints[jointType] = new Point(depthSpacePoint.X, depthSpacePoint.Y);
                        }
                        joints      = Newtonsoft.Json.JsonConvert.DeserializeObject <IReadOnlyDictionary <JointType, Joint> >(retrievedData[replayCount].Joints);
                        jointPoints = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <JointType, Point> >(retrievedData[replayCount].JointPoints);
                        if (replayCount < retrievedData.Length - 1)
                        {
                            replayCount++;
                        }

                        this.DrawBody(joints, jointPoints, dc, drawPen);


                        this.DrawHand(this.bodies[0].HandLeftState, jointPoints[JointType.HandLeft], dc);
                        this.DrawHand(this.bodies[0].HandRightState, jointPoints[JointType.HandRight], dc);
                    }


                    // prevent drawing outside of our render area
                    this.drawingGroup.ClipGeometry = new RectangleGeometry(new Rect(0.0, 0.0, this.displayWidth, this.displayHeight));
                }
            }
        }