private void PushDrugImageView(RxTerm term) { var drugImageViewer = new DrugImageViewController(term); this.NavigationController.PushViewController(drugImageViewer, true); this.NavigationItem.BackBarButtonItem = new UIBarButtonItem("Back", UIBarButtonItemStyle.Done, null); }
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); }
// private static RxTerm DeserializeRxTerm(string json) // { // return JsonObject.Parse(json).Object("rxtermsProperties") // .ConvertTo(x => new RxTerm { // BrandName = x.Get("brandName"), // DisplayName = x.Get("displayName"), // Synonym = x.Get("synonym"), // FullName = x.Get("fullName"), // FullGenericName = x.Get("fullGenericName"), // Strength = x.Get("strength"), // RxTermDoseForm = x.Get("rxtermsDoseForm"), // Route = x.Get("route"), // RxCUI = x.Get("rxcui"), // RxNormDoseForm = x.Get("rxnormDoseForm"), // }); // } static RxTerm DeserializeRxTerm(string json) { var jsonValue = (JsonObject)JsonObject.Parse(json); var rxTerm = new RxTerm { BrandName = jsonValue["rxtermsProperties"]["brandName"], DisplayName = jsonValue["rxtermsProperties"]["displayName"], Synonym = jsonValue["rxtermsProperties"]["synonym"], FullName = jsonValue["rxtermsProperties"]["fullName"], FullGenericName = jsonValue["rxtermsProperties"]["fullGenericName"], Strength = jsonValue["rxtermsProperties"]["strength"], RxTermDoseForm = jsonValue["rxtermsProperties"]["rxtermsDoseForm"], Route = jsonValue["rxtermsProperties"]["route"], RxCUI = jsonValue["rxtermsProperties"]["rxcui"], RxNormDoseForm = jsonValue["rxtermsProperties"]["rxnormDoseForm"] }; return(rxTerm); }
private void FinishedGettingDrugConcept(RxTerm term) { var section = new Section(); section.Add(new StringElement("Brand Name: ", term.BrandName)); section.Add(new StringElement("Display Name: ", term.DisplayName)); section.Add(new StringElement("Synonym: ", term.Synonym)); section.Add(new StringElement("Full Name: ", term.FullName)); section.Add(new StringElement("Full Generic Name: ", term.FullGenericName)); section.Add(new StringElement("View Image!", () => { PushDrugImageView(term); })); using(var pool = new NSAutoreleasePool()) { pool.BeginInvokeOnMainThread(()=>{ this.Root.Clear(); this.Root.Add(section); this.TableView.ReloadData(); }); } }
private void FinishedGettingDrugConcept(RxTerm term) { var section = new Section(); section.Add(new StringElement("Brand Name: ", term.BrandName)); section.Add(new StringElement("Display Name: ", term.DisplayName)); section.Add(new StringElement("Synonym: ", term.Synonym)); section.Add(new StringElement("Full Name: ", term.FullName)); section.Add(new StringElement("Full Generic Name: ", term.FullGenericName)); section.Add(new StringElement("View Image!", () => { PushDrugImageView(term); })); using (var pool = new NSAutoreleasePool()) { pool.BeginInvokeOnMainThread(() => { this.Root.Clear(); this.Root.Add(section); this.TableView.ReloadData(); }); } }
private static RxTerm RxTerm(string rxcui) { var rxTerm = new RxTerm(); try { var request = new RestRequest(string.Format("{0}/allinfo", rxcui)); request.RequestFormat = DataFormat.Json; var response = Client.Execute(request); if (string.IsNullOrWhiteSpace(response.Content) || response.StatusCode != System.Net.HttpStatusCode.OK) { return(null); } rxTerm = DeserializeRxTerm(response.Content); } catch (Exception ex) { Console.WriteLine("Problem getting data for concept: {0} -- Exception: {1}", rxcui, ex.Message + ex.StackTrace); } return(rxTerm); }
public DrugImageViewController(RxTerm term) : base() { _Term = term; this.Title = term.DisplayName; }
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; }
private static RxTerm RxTerm(string rxcui) { var rxTerm = new RxTerm(); try { var request = new RestRequest(string.Format("{0}/allinfo", rxcui)); request.RequestFormat = DataFormat.Json; var response = Client.Execute(request); if(string.IsNullOrWhiteSpace(response.Content) || response.StatusCode != System.Net.HttpStatusCode.OK) { return null; } rxTerm = DeserializeRxTerm(response.Content); } catch (Exception ex) { Console.WriteLine("Problem getting data for concept: {0} -- Exception: {1}", rxcui, ex.Message + ex.StackTrace); } return rxTerm; }
// private static RxTerm DeserializeRxTerm(string json) // { // return JsonObject.Parse(json).Object("rxtermsProperties") // .ConvertTo(x => new RxTerm { // BrandName = x.Get("brandName"), // DisplayName = x.Get("displayName"), // Synonym = x.Get("synonym"), // FullName = x.Get("fullName"), // FullGenericName = x.Get("fullGenericName"), // Strength = x.Get("strength"), // RxTermDoseForm = x.Get("rxtermsDoseForm"), // Route = x.Get("route"), // RxCUI = x.Get("rxcui"), // RxNormDoseForm = x.Get("rxnormDoseForm"), // }); // } static RxTerm DeserializeRxTerm(string json) { var jsonValue = (JsonObject)JsonObject.Parse(json); var rxTerm = new RxTerm { BrandName = jsonValue["rxtermsProperties"]["brandName"], DisplayName = jsonValue["rxtermsProperties"]["displayName"], Synonym = jsonValue["rxtermsProperties"]["synonym"], FullName =jsonValue["rxtermsProperties"]["fullName"], FullGenericName =jsonValue["rxtermsProperties"]["fullGenericName"], Strength =jsonValue["rxtermsProperties"]["strength"], RxTermDoseForm =jsonValue["rxtermsProperties"]["rxtermsDoseForm"], Route =jsonValue["rxtermsProperties"]["route"], RxCUI =jsonValue["rxtermsProperties"]["rxcui"], RxNormDoseForm =jsonValue["rxtermsProperties"]["rxnormDoseForm"] }; return rxTerm; }