Ejemplo n.º 1
0
        private void runtime_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            Skeleton[] skeletons = null;
            body = Body.Instance;

            using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
            {
                if (skeletonFrame != null)
                {
                    if (skeletons == null)
                    {
                        // Skelettarray zuweisen
                        skeletons = new Skeleton[skeletonFrame.SkeletonArrayLength];
                    }

                    skeletonFrame.CopySkeletonDataTo(skeletons);

                    if (skeletons.Length != 0)
                    {
                        // Getrackte Körperpunkte zwischenspeichern
                        Parallel.ForEach(skeletons, skel =>
                        {
                            setPosition(skel.Joints[JointType.AnkleLeft]);
                            setPosition(skel.Joints[JointType.AnkleRight]);
                            setPosition(skel.Joints[JointType.ElbowLeft]);
                            setPosition(skel.Joints[JointType.ElbowRight]);
                            setPosition(skel.Joints[JointType.FootLeft]);
                            setPosition(skel.Joints[JointType.FootRight]);
                            setPosition(skel.Joints[JointType.HandLeft]);
                            setPosition(skel.Joints[JointType.HandRight]);
                            setPosition(skel.Joints[JointType.Head]);
                            setPosition(skel.Joints[JointType.HipCenter]);
                            setPosition(skel.Joints[JointType.HipLeft]);
                            setPosition(skel.Joints[JointType.HipRight]);
                            setPosition(skel.Joints[JointType.KneeLeft]);
                            setPosition(skel.Joints[JointType.KneeRight]);
                            setPosition(skel.Joints[JointType.ShoulderCenter]);
                            setPosition(skel.Joints[JointType.ShoulderLeft]);
                            setPosition(skel.Joints[JointType.ShoulderRight]);
                            setPosition(skel.Joints[JointType.Spine]);
                            setPosition(skel.Joints[JointType.WristLeft]);
                            setPosition(skel.Joints[JointType.WristRight]);
                        });
                        if (SkeletonEvent != null)
                            SkeletonEvent();
                    }
                }
            }
        }
        /// <summary>
        /// Partially modify a Data Center You can use update datacenter to re-name the datacenter or update its description
        /// </summary>
        /// <param name="datacenterId">The unique ID of the data center</param>
        /// <param name="datacenter">Modified properties of Data Center</param>
        /// <param name="body"></param>
        /// <param name="parameter">Controls whether response is pretty-printed (with indentation and new lines)</param>
        /// <param name="depth">Controls the details depth of response objects. \nEg. GET /datacenters/[ID]\n	- depth=0: only direct properties are included. Children (servers etc.) are not included\n	- depth=1: direct properties and children references are included\n	- depth=2: direct properties and children properties are included\n	- depth=3: direct properties and children properties and children&#39;s children are included\n	- depth=... and so on</param>
        /// <returns>Task of ApiResponse (Datacenter)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<Datacenter>> PartialUpdateAsyncWithHttpInfo(string datacenterId, DatacenterProperties datacenter, Body body = null, bool? parameter = null, int? depth = null)
        {
            // verify the required parameter 'datacenterId' is set
            if (datacenterId == null) throw new ApiException(400, "Missing required parameter 'datacenterId' when calling PartialUpdate");
            // verify the required parameter 'datacenter' is set
            if (datacenter == null) throw new ApiException(400, "Missing required parameter 'datacenter' when calling PartialUpdate");


            var path_ = "/datacenters/{datacenterId}";

            var pathParams = new Dictionary<String, String>();
            var queryParams = new Dictionary<String, String>();
            var headerParams = new Dictionary<String, String>();
            var formParams = new Dictionary<String, String>();
            var fileParams = new Dictionary<String, FileParameter>();
            Object postBody = null;

            // to determine the Content-Type header
            String[] httpContentTypes = new String[] {
                "application/vnd.profitbricks.partial-properties+json", "application/json"
            };
            String httpContentType = Configuration.ApiClient.SelectHeaderContentType(httpContentTypes);

            // to determine the Accept header
            String[] httpHeaderAccepts = new String[] {
                "application/vnd.profitbricks.resource+json"
            };
            String httpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(httpHeaderAccepts);
            if (httpHeaderAccept != null)
                headerParams.Add("Accept", httpHeaderAccept);

            // set "format" to json by default
            // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
            pathParams.Add("format", "json");
            if (datacenterId != null) pathParams.Add("datacenterId", Configuration.ApiClient.ParameterToString(datacenterId)); // path parameter

            if (parameter != null) queryParams.Add("parameter", Configuration.ApiClient.ParameterToString(parameter)); // query parameter
            if (depth != null) queryParams.Add("depth", Configuration.ApiClient.ParameterToString(depth)); // query parameter



            postBody = Configuration.ApiClient.Serialize(datacenter); // http body (model) parameter



            // authentication (basicAuth) required

            // http basic authentication required
            if (!String.IsNullOrEmpty(Configuration.Username) || !String.IsNullOrEmpty(Configuration.Password))
            {
                headerParams["Authorization"] = "Basic " + ApiClient.Base64Encode(Configuration.Username + ":" + Configuration.Password);
            }


            // make the HTTP request
            IRestResponse response = (IRestResponse)await Configuration.ApiClient.CallApiAsync(path_,
                Method.PATCH, queryParams, postBody, headerParams, formParams, fileParams,
                pathParams, httpContentType);

            int statusCode = (int)response.StatusCode;

            if (statusCode >= 400)
                throw new ApiException(statusCode, "Error calling PartialUpdate: " + response.Content, response.Content);
            else if (statusCode == 0)
                throw new ApiException(statusCode, "Error calling PartialUpdate: " + response.ErrorMessage, response.ErrorMessage);

            return new ApiResponse<Datacenter>(statusCode,
                response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (Datacenter)Configuration.ApiClient.Deserialize(response, typeof(Datacenter)));

        }
        /// <summary>
        /// Partially modify a Data Center You can use update datacenter to re-name the datacenter or update its description
        /// </summary>
        /// <param name="datacenterId">The unique ID of the data center</param>
        /// <param name="datacenter">Modified properties of Data Center</param>
        /// <param name="body"></param>
        /// <param name="parameter">Controls whether response is pretty-printed (with indentation and new lines)</param>
        /// <param name="depth">Controls the details depth of response objects. \nEg. GET /datacenters/[ID]\n	- depth=0: only direct properties are included. Children (servers etc.) are not included\n	- depth=1: direct properties and children references are included\n	- depth=2: direct properties and children properties are included\n	- depth=3: direct properties and children properties and children&#39;s children are included\n	- depth=... and so on</param>
        /// <returns>Task of Datacenter</returns>
        public async System.Threading.Tasks.Task<Datacenter> PartialUpdateAsync(string datacenterId, DatacenterProperties datacenter, Body body = null, bool? parameter = null, int? depth = null)
        {
            ApiResponse<Datacenter> response = await PartialUpdateAsyncWithHttpInfo(datacenterId, datacenter, body, parameter, depth);
            return response.Data;

        }
 /// <summary>
 /// Partially modify a Data Center You can use update datacenter to re-name the datacenter or update its description
 /// </summary>
 /// <param name="datacenterId">The unique ID of the data center</param> 
 /// <param name="datacenter">Modified properties of Data Center</param> 
 /// <param name="body"></param> 
 /// <param name="parameter">Controls whether response is pretty-printed (with indentation and new lines)</param> 
 /// <param name="depth">Controls the details depth of response objects. \nEg. GET /datacenters/[ID]\n	- depth=0: only direct properties are included. Children (servers etc.) are not included\n	- depth=1: direct properties and children references are included\n	- depth=2: direct properties and children properties are included\n	- depth=3: direct properties and children properties and children&#39;s children are included\n	- depth=... and so on</param> 
 /// <returns>Datacenter</returns>
 public Datacenter PartialUpdate(string datacenterId, DatacenterProperties datacenter, Body body = null, bool? parameter = null, int? depth = null)
 {
     ApiResponse<Datacenter> response = PartialUpdateWithHttpInfo(datacenterId, datacenter, body, parameter, depth);
     return response.Data;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Sensor starten
 /// </summary>
 public void Start()
 {
     sensor = new SkeletonTracker();
     sensor.Start();
     sensor.SkeletonEvent += new SkeletonTrackerEvent(GetEvent);
     body = Body.Instance;
 }