Пример #1
0
        private static void WriteAsyncCallbackImpl(IntPtr ptr, Result result)
        {
            GCHandle          h        = GCHandle.FromIntPtr(ptr);
            WriteAsyncHandler callback = (WriteAsyncHandler)h.Target;

            h.Free();
            callback(result);
        }
Пример #2
0
        /// <summary>
        ///     Writes data asynchronously to disk under the given keyname.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="data"></param>
        /// <param name="callback"></param>
        public void WriteAsync(string name, byte[] data, WriteAsyncHandler callback)
        {
            GCHandle wrapped = GCHandle.Alloc(callback);

            Methods.WriteAsync(methodsPtr, name, data, data.Length, GCHandle.ToIntPtr(wrapped), WriteAsyncCallbackImpl);
        }