Пример #1
0
        private static RxTerm RxTermViaNSURLConnectionAsync(string rxcui, Action <RxTerm> callback = null)
        {
            var rxTerm = new RxTerm();

            try {
                var request = new NSMutableUrlRequest(new NSUrl(string.Format("http://rxnav.nlm.nih.gov/REST/RxTerms/rxcui/{0}/allinfo", rxcui)),
                                                      NSUrlRequestCachePolicy.ReloadRevalidatingCacheData, 20);
                request["Accept"] = "application/json";

                var connectionDelegate = new RxTermNSURLConnectionDelegate();
                var connection         = new NSUrlConnection(request, connectionDelegate);
                connection.Start();
            } catch (Exception ex) {
                Console.WriteLine("Problem getting data for concept: {0} -- Exception: {1}", rxcui, ex.Message + ex.StackTrace);
            }

            return(rxTerm);
        }
Пример #2
0
        private static RxTerm RxTermViaNSURLConnectionAsync(string rxcui, Action<RxTerm> callback = null)
        {
            var rxTerm = new RxTerm();

            try {
                var request = new NSMutableUrlRequest(new NSUrl(string.Format("http://rxnav.nlm.nih.gov/REST/RxTerms/rxcui/{0}/allinfo", rxcui)),
                NSUrlRequestCachePolicy.ReloadRevalidatingCacheData, 20);
                request["Accept"] = "application/json";

                var connectionDelegate = new RxTermNSURLConnectionDelegate();
                var connection = new NSUrlConnection(request, connectionDelegate);
                connection.Start();

            } catch (Exception ex) {
                Console.WriteLine("Problem getting data for concept: {0} -- Exception: {1}", rxcui, ex.Message + ex.StackTrace);
            }

            return rxTerm;
        }