예제 #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);
        }
예제 #2
0
        // *********** Asynchronous Get, no response expected *************
        public static void RestGetNonQueryAsync(string url,
                                                RestCallBackNonQuery callback, ClientConfiguration configuration)
        {
            var get = new GetNonQueryDelegate(RestGetNonQuery);

            get.BeginInvoke(url, configuration,
                            ar =>
            {
                var result  = (AsyncResult)ar;
                var del     = (GetNonQueryDelegate)result.AsyncDelegate;
                Exception e = null;

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

                callback?.Invoke(e);
            }, null);
        }