Ejemplo n.º 1
0
        /// <summary>
        /// Parse from json content to exercise gestures details
        /// </summary>
        /// <param name="_JSONcontent">The response json</param>
        /// <param name="_exercise">The _exercise object</param>
        public static void GettingExerciseGesture(Exercise _exercise, string _JSONcontent)
        {
            dynamic d = (JsonConvert.DeserializeObject <IDictionary <string, object> >(_JSONcontent));

            //check errors
            bool checkError = checkForErrors((int)d["code"]);

            if (checkError)
            {
                ErrorEvent(null, new ErrorMessege(((ServerCode)d["code"].code).ToString(), (int)d["code"].code));
                return;
            }

            _exercise.ContinuousGestureName = d["data"].gesture_progress_name;
            _exercise.DBUrl = d["data"].file;

            _exercise.StartGesutre                   = new VTGesture();
            _exercise.StartGesutre.GestureName       = Convert.ToString(d["data"].start_gesture_name);
            _exercise.StartGesutre.ConfidanceTrshold = 0.2f;

            string        json        = d["data"]["gesture_list"].ToString();
            List <object> gestureList = JsonConvert.DeserializeObject <List <object> >(json);

            //createing gestures list
            _exercise.VTGestureList = new List <VTGesture>();
            foreach (var item in gestureList)
            {
                VTGesture gesture = new VTGesture();

                json = item.ToString();
                Dictionary <string, object> currentObj = JsonConvert.DeserializeObject <Dictionary <string, object> >(json);

                gesture.GestureName          = currentObj["gestureName"].ToString();
                gesture.MinProgressValue     = (float)Double.Parse(currentObj["startGestureValue"].ToString());
                gesture.MaxProgressValue     = (float)Double.Parse(currentObj["endGestureValue"].ToString());
                gesture.TrsholdProgressValue = (float)Double.Parse(currentObj["progressThd"].ToString());
                gesture.ConfidanceTrshold    = (float)Double.Parse(currentObj["confidenceThd"].ToString());
                gesture.IsTrack = currentObj["isTrackableItem"].ToString().Equals("1") ? true : false;


                _exercise.VTGestureList.Add(gesture);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Parse from json content to exercise gestures details
        /// </summary>
        /// <param name="_JSONcontent">The response json</param>
        /// <param name="_exercise">The _exercise object</param>
        public static void GettingExerciseGesture(Exercise _exercise, string _JSONcontent)
        {
            dynamic d = (JsonConvert.DeserializeObject<IDictionary<string, object>>(_JSONcontent));

            //check errors
            bool checkError = checkForErrors((int)d["code"]);
            if (checkError)
            {
                ErrorEvent(null, new ErrorMessege(((ServerCode)d["code"].code).ToString(), (int)d["code"].code));
                return;
            }

            _exercise.ContinuousGestureName = d["data"].gesture_progress_name;
            _exercise.DBUrl = d["data"].file;

            _exercise.StartGesutre = new VTGesture();
            _exercise.StartGesutre.GestureName = Convert.ToString(d["data"].start_gesture_name);
            _exercise.StartGesutre.ConfidanceTrshold = 0.2f;

            string json = d["data"]["gesture_list"].ToString();
            List<object> gestureList = JsonConvert.DeserializeObject<List<object>>(json);

            //createing gestures list
            _exercise.VTGestureList = new List<VTGesture>();
            foreach (var item in gestureList)
            {
                VTGesture gesture = new VTGesture();

                json = item.ToString();
                Dictionary<string, object> currentObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);

                gesture.GestureName = currentObj["gestureName"].ToString();
                gesture.MinProgressValue = (float) Double.Parse(currentObj["startGestureValue"].ToString());
                gesture.MaxProgressValue = (float)Double.Parse(currentObj["endGestureValue"].ToString());
                gesture.TrsholdProgressValue = (float)Double.Parse(currentObj["progressThd"].ToString());
                gesture.ConfidanceTrshold = (float)Double.Parse(currentObj["confidenceThd"].ToString());
                gesture.IsTrack = currentObj["isTrackableItem"].ToString().Equals("1") ? true : false;

                _exercise.VTGestureList.Add(gesture);
            }
        }
Ejemplo n.º 3
0
        public void CopyGesturesFromOrigin(Exercise copyFromExercise)
        {
            ContinuousGestureName = copyFromExercise.ContinuousGestureName;
            StartGesutre = new VTGesture(copyFromExercise.StartGesutre);

            VTGestureList = new List<VTGesture>();
            foreach (VTGesture gesture in copyFromExercise.VTGestureList)
            {
                VTGestureList.Add(new VTGesture(gesture));
            }
        }