Exemple #1
0
        // ********* Asynchronous Post, not response expected *********
        public static void RestPostNonQueryAsync <TI>(string url, TI data,
                                                      RestCallBackNonQuery callback, ClientConfiguration configuration)
        {
            var post = new PostNonQueryDelegate <TI>(RestPostNonQuery);

            post.BeginInvoke(url, data, configuration,
                             ar =>
            {
                var result  = (AsyncResult)ar;
                var del     = (PostNonQueryDelegate <TI>)result.AsyncDelegate;
                Exception e = null;

                try { del.EndInvoke(result); }
                catch (Exception ex) { e = ex; }

                callback?.Invoke(e);
            }, null);
        }
        // ********* Asynchronous Post, not response expected *********
        internal void RestPostNonQueryAsync(string url, string data,
                                            RestCallBackNonQuery callback, ClientConfiguration configuration)
        {
            var post = new PostNonQueryDelegate <string>(RestPostNonQuery);

            post.BeginInvoke(url, data, configuration,
                             ar =>
            {
                var result  = (AsyncResult)ar;
                var del     = (PostNonQueryDelegate <string>)result.AsyncDelegate;
                Exception e = null;

                try { del.EndInvoke(result); }
                catch (Exception ex) { e = ex; }

                if (callback != null)
                {
                    callback(e);
                }
            }, null);
        }