Ejemplo n.º 1
0
        /// <summary>
        /// Delete the token
        /// </summary>
        /// <param name="uniqueIdentifier">The unique client identifier.</param>
        /// <param name="serviceName">The service name the client is connected to.</param>
        /// <param name="callback">The callback handler when a result is retured, a client web response.</param>
        /// <param name="actionName">The current action callback name.</param>
        /// <param name="state">The state callback handler object.</param>
        /// <exception cref="System.Exception"></exception>
        /// <exception cref="System.ArgumentNullException"></exception>
        public async void Delete(string uniqueIdentifier, string serviceName, Action <bool, object> callback, string actionName = "", object state = null)
        {
            Exception exec      = null;
            var       tokenData = await Nequeo.Threading.AsyncOperationResult <bool> .
                                  RunTask <bool>(() =>
            {
                try
                {
                    return(TokenReader.Delete(uniqueIdentifier, serviceName, _tokenData));
                }
                catch (Exception ex)
                {
                    exec = ex;
                    return(false);
                }
            });

            if (exec != null)
            {
                if (_callback_Exception != null)
                {
                    _callback_Exception("Delete", exec);
                }
            }
            if (callback != null)
            {
                callback(tokenData, state);
            }
        }