public static MessageHandPointer FromDictionary(Dictionary <string, object> handPointerDictionary)
        {
            if (handPointerDictionary == null)
            {
                throw new ArgumentNullException("handPointerDictionary");
            }

            var messageHandPointer = new MessageHandPointer
            {
                trackingId          = (int)handPointerDictionary["trackingId"],
                handType            = (string)handPointerDictionary["handType"],
                handEventType       = (string)handPointerDictionary["handEventType"],
                isTracked           = (bool)handPointerDictionary["isTracked"],
                isActive            = (bool)handPointerDictionary["isActive"],
                isInteractive       = (bool)handPointerDictionary["isInteractive"],
                isPressed           = (bool)handPointerDictionary["isPressed"],
                isPrimaryHandOfUser = (bool)handPointerDictionary["isPrimaryHandOfUser"],
                isPrimaryUser       = (bool)handPointerDictionary["isPrimaryUser"],
                x =
                    double.Parse(
                        handPointerDictionary["x"].ToString(), CultureInfo.InvariantCulture),
                y =
                    double.Parse(
                        handPointerDictionary["y"].ToString(), CultureInfo.InvariantCulture),
                pressExtent =
                    double.Parse(
                        handPointerDictionary["pressExtent"].ToString(),
                        CultureInfo.InvariantCulture),
                rawX =
                    double.Parse(
                        handPointerDictionary["rawX"].ToString(), CultureInfo.InvariantCulture),
                rawY =
                    double.Parse(
                        handPointerDictionary["rawY"].ToString(), CultureInfo.InvariantCulture),
                rawZ =
                    double.Parse(
                        handPointerDictionary["rawZ"].ToString(), CultureInfo.InvariantCulture)
            };

            return(messageHandPointer);
        }
Ejemplo n.º 2
0
        public static MessageHandPointer FromDictionary(Dictionary<string, object> handPointerDictionary)
        {
            if (handPointerDictionary == null)
            {
                throw new ArgumentNullException("handPointerDictionary");
            }

            var messageHandPointer = new MessageHandPointer
                                     {
                                         trackingId = (int)handPointerDictionary["trackingId"],
                                         handType = (string)handPointerDictionary["handType"],
                                         handEventType = (string)handPointerDictionary["handEventType"],
                                         isTracked = (bool)handPointerDictionary["isTracked"],
                                         isActive = (bool)handPointerDictionary["isActive"],
                                         isInteractive = (bool)handPointerDictionary["isInteractive"],
                                         isPressed = (bool)handPointerDictionary["isPressed"],
                                         isPrimaryHandOfUser = (bool)handPointerDictionary["isPrimaryHandOfUser"],
                                         isPrimaryUser = (bool)handPointerDictionary["isPrimaryUser"],
                                         x =
                                             double.Parse(
                                                 handPointerDictionary["x"].ToString(), CultureInfo.InvariantCulture),
                                         y =
                                             double.Parse(
                                                 handPointerDictionary["y"].ToString(), CultureInfo.InvariantCulture),
                                         pressExtent =
                                             double.Parse(
                                                 handPointerDictionary["pressExtent"].ToString(),
                                                 CultureInfo.InvariantCulture),
                                         rawX =
                                             double.Parse(
                                                 handPointerDictionary["rawX"].ToString(), CultureInfo.InvariantCulture),
                                         rawY =
                                             double.Parse(
                                                 handPointerDictionary["rawY"].ToString(), CultureInfo.InvariantCulture),
                                         rawZ =
                                             double.Parse(
                                                 handPointerDictionary["rawZ"].ToString(), CultureInfo.InvariantCulture)
                                     };
            return messageHandPointer;
        }