private static void Error_Delegate_Failure(int err, [RootSystem.Runtime.InteropServices.MarshalAs(RootSystem.Runtime.InteropServices.UnmanagedType.LPWStr)] string guid)
 {
     RootSystem.Action <int> callback = null;
     if (ErrorCallbacks.TryGetValue(guid, out callback))
     {
         Helper.EventPump.Instance.Enqueue(() => callback(err));
     }
     ErrorCallbacks.Remove(guid);
     Microsoft_Kinect_Face_FaceModelData_Delegate_SuccessCallbacks.Remove(guid);
 }
        public void CollectFaceDataAsync(RootSystem.Action <Microsoft.Kinect.Face.FaceModelData> success, RootSystem.Action <int> failure)
        {
            if (_pNative == RootSystem.IntPtr.Zero)
            {
                throw new RootSystem.ObjectDisposedException("FaceModelBuilder");
            }

            RootSystem.Guid g = RootSystem.Guid.NewGuid();
            if (success != null)
            {
                Microsoft_Kinect_Face_FaceModelData_Delegate_SuccessCallbacks.Add(g.ToString(), success);
            }
            if (failure != null)
            {
                ErrorCallbacks.Add(g.ToString(), failure);
            }
            Microsoft_Kinect_Face_FaceModelBuilder_CollectFaceDataAsync_Indexed(_pNative, CollectAsyncSuccessDelegate, CollectAsyncFailureDelegate, g.ToString());
            Helper.ExceptionHelper.CheckLastError();
        }