Exemplo n.º 1
0
        /// <summary>
        /// Closes an open wallet.
        /// </summary>
        /// <param name="handle">The handle of the wallet to close.</param>
        /// <returns>An asynchronous Task with no return value.</returns>
        private static Task CloseWalletAsync(IntPtr handle)
        {
            var taskCompletionSource = new TaskCompletionSource <bool>();
            var commandHandle        = AddTaskCompletionSource(taskCompletionSource);

            var result = IndyNativeMethods.indy_close_wallet(
                commandHandle,
                handle,
                _noValueCallback);

            CheckResult(result);

            return(taskCompletionSource.Task);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Closes the wallet.
        /// </summary>
        /// <returns>An asynchronous <see cref="Task"/> with no return value that completes when the operation completes.</returns>
        public Task CloseAsync()
        {
            var taskCompletionSource = new TaskCompletionSource <bool>();
            var commandHandle        = PendingCommands.Add(taskCompletionSource);

            var result = IndyNativeMethods.indy_close_wallet(
                commandHandle,
                Handle,
                CallbackHelper.TaskCompletingNoValueCallback);

            CallbackHelper.CheckResult(result);

            _closeRequested = true;
            GC.SuppressFinalize(this);

            return(taskCompletionSource.Task);
        }