示例#1
0
        public void LocationsUpdated(CLLocationManager manager, CLLocation[] locations)
        {
            var coord = locations[0].Coordinate;

            Console.WriteLine("At {0}", locations[0].Description());
            manager.StopUpdatingLocation();

            Console.WriteLine(googleUrl, coord.Latitude, coord.Longitude);
            NSString s = new NSString(String.Format(googleUrl, coord.Latitude, coord.Longitude));

            s = s.CreateStringByAddingPercentEncoding(NSUrlUtilities_NSCharacterSet.UrlQueryAllowedCharacterSet);
            NSWorkspace.SharedWorkspace.OpenUrl(new NSUrl(s));
        }
        internal static void SummonThreeDSecure(PaymentRequiresThreeDSecureModel threedDSecureReceipt, SecureWebView secureWebView)
        {
            secureWebView.ReceiptID = threedDSecureReceipt.ReceiptId;

            NSCharacterSet allowedCharecterSet = NSCharacterSet.FromString(@":/=,!$&'()*+;[]@#?").InvertedSet;
            NSString       paReq        = new NSString(threedDSecureReceipt.PaReq);
            var            encodedPaReq = paReq.CreateStringByAddingPercentEncoding(allowedCharecterSet);

            NSString termUrl        = new NSString("judo1234567890://threedsecurecallback");
            var      encodedTermUrl = termUrl.CreateStringByAddingPercentEncoding(allowedCharecterSet);


            NSUrl url = new NSUrl(threedDSecureReceipt.AcsUrl);

            NSMutableUrlRequest req = new NSMutableUrlRequest(url);

            NSString postString = new NSString("MD=" + threedDSecureReceipt.Md + "&PaReq=" + encodedPaReq + "&TermUrl=" + encodedTermUrl + "");
            NSData   postData   = postString.Encode(NSStringEncoding.UTF8);

            req.HttpMethod = "POST";
            req.Body       = postData;

            try {
                DispatchQueue.MainQueue.DispatchAfter(DispatchTime.Now, () => {
                    secureWebView.LoadRequest(req);

                    LoadingScreen.HideLoading();
                    secureWebView.Hidden = false;
                });
            } catch (Exception e) {
                if (secureWebView._failureCallback != null)
                {
                    var judoError = new JudoError {
                        Exception = e
                    };
                    secureWebView.CloseView();
                    secureWebView._failureCallback(judoError);
                }
            }
        }
		public static void SummonThreeDSecure (PaymentRequiresThreeDSecureModel threedDSecureReceipt, SecureWebView secureWebView)
		{
			secureWebView.ReceiptID =	threedDSecureReceipt.ReceiptId;

			NSCharacterSet allowedCharecterSet = NSCharacterSet.FromString (@":/=,!$&'()*+;[]@#?").InvertedSet;
			NSString paReq = new NSString (threedDSecureReceipt.PaReq);
			var encodedPaReq = paReq.CreateStringByAddingPercentEncoding (allowedCharecterSet);

			NSString termUrl = new NSString ("judo1234567890://threedsecurecallback");
			var encodedTermUrl = termUrl.CreateStringByAddingPercentEncoding (allowedCharecterSet);


			NSUrl url = new NSUrl (threedDSecureReceipt.AcsUrl);

			NSMutableUrlRequest req = new NSMutableUrlRequest (url);

			NSString postString = new NSString ("MD=" + threedDSecureReceipt.Md + "&PaReq=" + encodedPaReq + "&TermUrl=" + encodedTermUrl + "");
			NSData postData = postString.Encode (NSStringEncoding.UTF8);

			req.HttpMethod = "POST";
			req.Body = postData;

			try {
				DispatchQueue.MainQueue.DispatchAfter (DispatchTime.Now, () => {
					secureWebView.LoadRequest (req);

					JudoSDKManager.HideLoading ();
					secureWebView.Hidden = false;
				});
			} catch (Exception e) {
				if (secureWebView._failureCallback != null) {
					var judoError = new JudoError { Exception = e };
					secureWebView._failureCallback (judoError);
				}
			}
		}