Esempio n. 1
0
        void useUrlConnection(NSMutableUrlRequest request)
        {
            var connection = new NSUrlConnection(request, this);

            UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
            connection.Start();
        }
		void DownloadUsingNSUrlRequest (object sender, EventArgs e)
		{
			var downloadedDelegate = new CustomDelegate(this);

			var req = new NSUrlRequest(new NSUrl("http://ch3cooh.hatenablog.jp/"));
			NSUrlConnection connection = new NSUrlConnection(req, downloadedDelegate);
			connection.Start();
		} 
Esempio n. 3
0
 public void StartCancel()
 {
     using (var url = new NSUrl("http://www.google.com"))
         using (var r = new NSUrlRequest(url))
             using (var d = new MyDelegate())
                 using (var c = new NSUrlConnection(r, d)) {
                     c.Start();
                     c.Cancel();
                 }
 }
Esempio n. 4
0
 public void StartCancel()
 {
     using (var url = new NSUrl(NetworkResources.MicrosoftUrl))
         using (var r = new NSUrlRequest(url))
             using (var d = new MyDelegate())
                 using (var c = new NSUrlConnection(r, d)) {
                     c.Start();
                     c.Cancel();
                 }
 }
Esempio n. 5
0
        public void Search7(string text)
        {
            //BUG: NSUrl creation fails if space in search text TODO: escape input
            string       bingSearch  = String.Format("http://api.bing.net/xml.aspx?AppId={0}&Query={1}&Sources=web&web.count=10", BING_API_ID, text);
            NSUrlRequest bingRequest = new NSUrlRequest(NSUrl.FromString(HttpUtility.UrlPathEncode(bingSearch)));

            _cnDelegate = new BingConnectionDelegate();
            NSUrlConnection cn = new NSUrlConnection(bingRequest, _cnDelegate);

            cn.Start();
        }
        partial void NSUrlConnectionButtonXamarinExample_TouchUpInside(UIButton sender)
        {
            string rxcui = "198440";
            NSMutableUrlRequest 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";

            RxTermNSURLConnectionDelegate connectionDelegate = new RxTermNSURLConnectionDelegate();

            NSUrlConnection aConnection = new NSUrlConnection(request, connectionDelegate);

            aConnection.Start();
        }
Esempio n. 7
0
		void ShowUrl ()
		{
			// Show the hud on top most view
			hud = MTMBProgressHUD.ShowHUD (this.navController.View, true);
			
			// Regiser for DidHide Event so we can remove it from the window at the right time
			hud.DidHide += HandleDidHide;

			NSUrl url = new NSUrl ("https://github.com/matej/MBProgressHUD/zipball/master");
			NSUrlRequest request = new NSUrlRequest (url);

			NSUrlConnection connection = new NSUrlConnection (request, new MyNSUrlConnectionDelegete (this, hud));
			connection.Start();
		}
Esempio n. 8
0
        public void SearchCoreFoundation(string text)
        {
            string bingSearch = String.Format(
                "http://api.bing.net/xml.aspx?AppId={0}&Query={1}&Sources=web&web.count=10",
                BING_API_ID,
                text
                );

            var bingRequest = new NSUrlRequest(NSUrl.FromString(HttpUtility.UrlPathEncode(bingSearch)));

            cnDelegate = new BingConnectionDelegate();
            var cn = new NSUrlConnection(bingRequest, cnDelegate);

            cn.Start();
        }
Esempio n. 9
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);
        }
        public override UITableViewCell GetCell(UITableView aTableView, NSIndexPath aIndexPath)
        {
            SectionData sectionData = iData[aIndexPath.Section];
            string      cellId      = sectionData.CellId;
            string      row         = sectionData.Data[aIndexPath.Row];

            UITableViewCell cell = aTableView.DequeueReusableCell(cellId);

            if (cell == null)
            {
                cell = new UITableViewCell(UITableViewCellStyle.Default, cellId);

                cell.BackgroundColor = UIColor.Black;
                cell.SelectionStyle  = UITableViewCellSelectionStyle.Gray;
                cell.TextLabel.Font  = UIFont.BoldSystemFontOfSize(14);

                cell.ImageView.Image = KonfigTouch.Properties.ResourceManager.DeviceImagePlaceholder;
                string       url                 = "http://" + TestInfo.IPAddress + "/images/Icon.png";
                NSUrl        nsUrl               = new NSUrl(url);
                NSUrlRequest nsReq               = new NSUrlRequest(nsUrl);
                GetImageFromDeviceDelegate del   = new GetImageFromDeviceDelegate(aTableView, aIndexPath);
                NSUrlConnection            nsCon = new NSUrlConnection(nsReq, del);
                nsCon.Start();
            }

            if (iCurrentDevice == DeviceAt(aIndexPath))
            {
                // currently selected device
                cell.AccessoryView = AccessoryViewUpdateAvailableSelected;
                //cell.Accessory = UITableViewCellAccessory.Checkmark;
                cell.TextLabel.TextColor = UIColor.White;
            }
            else
            {
                cell.AccessoryView = AccessoryViewUpdateAvailableNotSelected;
                //cell.Accessory = UITableViewCellAccessory.None;
                cell.TextLabel.TextColor = UIColor.Gray;
            }

            cell.TextLabel.Text = row;
            return(cell);
        }
Esempio n. 11
0
		void ShowUrl ()
		{
			// Show the hud on top most view
			hud = MTMBProgressHUD.ShowHUD(this.navController.View, true);
			
			// Regiser for DidHide Event so we can remove it from the window at the right time
			hud.DidHide += HandleDidHide;

			NSUrl url = new NSUrl("https://github.com/matej/MBProgressHUD/zipball/master");
			NSUrlRequest request = new NSUrlRequest(url);

			NSUrlConnection connection = new NSUrlConnection(request, new MyNSUrlConnectionDelegete(this, hud));
			connection.Start();
		}
        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;
        }
 public void Search7 (string text)
 {
     //BUG: NSUrl creation fails if space in search text TODO: escape input
     string bingSearch = String.Format ("http://api.bing.net/xml.aspx?AppId={0}&Query={1}&Sources=web&web.count=10", BING_API_ID, text);
     NSUrlRequest bingRequest = new NSUrlRequest (NSUrl.FromString (HttpUtility.UrlPathEncode(bingSearch)));
     _cnDelegate = new BingConnectionDelegate ();
     NSUrlConnection cn = new NSUrlConnection (bingRequest, _cnDelegate);
     cn.Start ();
 }
		partial void NSUrlConnectionButtonXamarinExample_TouchUpInside(UIButton sender)
		{
			string rxcui = "198440";
			NSMutableUrlRequest 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";

			RxTermNSURLConnectionDelegate connectionDelegate = new RxTermNSURLConnectionDelegate();

			NSUrlConnection aConnection = new NSUrlConnection(request, connectionDelegate);
			aConnection.Start();
		}
Esempio n. 15
0
        public void SearchCoreFoundation (string text)
        {
            string bingSearch = String.Format (
                "http://api.bing.net/xml.aspx?AppId={0}&Query={1}&Sources=web&web.count=10",
                BING_API_ID,
                text
            );

            var bingRequest = new NSUrlRequest (NSUrl.FromString (HttpUtility.UrlPathEncode (bingSearch)));
            cnDelegate = new BingConnectionDelegate ();
            var cn = new NSUrlConnection (bingRequest, cnDelegate);
            cn.Start ();
        }