public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options) { if (Scanner.IsAppURL(url.ToString())) { QR2Web.App.StartScanFromWeb(url.ToString()); } return(true); }
public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation) { var uri = url != null && !string.IsNullOrWhiteSpace(url.ToString()) ? new Uri(url.ToString()) : null; var service = Mvx.Resolve <IDeeplinkingService>(); return(service.NavigateView(uri)); }
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options) { var uri = new Uri(url.ToString()); if (uri.Scheme.Equals(AppResources.CustomUriScheme, StringComparison.InvariantCultureIgnoreCase)) { ((App)Xamarin.Forms.Application.Current).OnInvokeUriScheme(new Uri(url.ToString())); return(true); } return(false); }
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options) { System.Console.WriteLine("OpenUrl 3"); System.Console.WriteLine("app = " + app.ToString()); System.Console.WriteLine("url = " + url.ToString()); System.Console.WriteLine("options = " + options.ToString()); string messageStr = url.ToString().Split(new char[] { '?' }) [1]; System.Console.WriteLine("messageStr = " + messageStr); return(true); }
public override void DidSelectLinkWithURL(Xamarin.TTTAttributedLabel.TTTAttributedLabel label, NSUrl url) { try { if (!url.ToString().StartsWith("http", StringComparison.Ordinal)) { var i = int.Parse(url.ToString()); _links[i].Callback(); } } catch (Exception e) { Console.WriteLine("Unable to callback on TTTAttributedLabel: {0}", e.Message); } }
public override bool AdjustDeeplinkResponse(NSUrl deeplink) { if (!_delegateOptions.SetDeeplinkResponseDelegate) { return(false); } if (deeplink == null) { Console.WriteLine(TAG + ": DeeplinkResponse, uri = null"); return(false); } Console.WriteLine(TAG + ": DeeplinkResponse, uri = " + deeplink.ToString()); return(deeplink.ToString().StartsWith("adjusttest", StringComparison.CurrentCulture)); }
public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation) { var rurl = new Rivets.AppLinkUrl(url.ToString()); var id = string.Empty; if (rurl.InputQueryParameters.ContainsKey("id")) { id = rurl.InputQueryParameters["id"]; } if (rurl.InputUrl.Host.Equals("transactions") && !string.IsNullOrEmpty(id)) { var transactionDetailViewController = GetViewController(MainStoryboard, "DashboardController") as DashboardViewController; transactionDetailViewController.SelectedTransactionId = Convert.ToInt32(id); var frontNavigationController = new UINavigationController(transactionDetailViewController); var rearViewController = GetViewController(MainStoryboard, "MenuController") as MenuViewController; var mainRevealController = new SWRevealViewController(); mainRevealController.RearViewController = rearViewController; mainRevealController.FrontViewController = frontNavigationController; Window.RootViewController = mainRevealController; Window.MakeKeyAndVisible(); return(true); } NavController.PopToRootViewController(true); return(true); }
public override bool OpenUrl(UIApplication application, NSUrl receivedurl, string sourceApplication, NSObject annotation) { AsNumAssemblyHelper.HoldAssembly(); global::Xamarin.Forms.Forms.Init(); FloatingActionButtonRenderer.InitRenderer(); OxyPlot.Xamarin.Forms.Platform.iOS.PlotViewRenderer.Init(); DependencyService.Register <ToastNotification>(); Plugin.Toasts.ToastNotification.Init(); //global::Xamarin.FormsMaps.Init(); FormsPlugin.Iconize.iOS.IconControls.Init(); var dummy = new FFImageLoading.Forms.Touch.CachedImageRenderer(); FFImageLoading.Forms.Touch.CachedImageRenderer.Init(); FormsPlugin.Iconize.iOS.IconControls.Init(); Plugin.Iconize.Iconize.With(new Plugin.Iconize.Fonts.FontAwesomeModule()); Plugin.Iconize.Iconize.With(new Plugin.Iconize.Fonts.IoniconsModule()); ShapeRenderer.Init(); ImageCircleRenderer.Init(); string url = receivedurl.ToString(); //string[] values = Intent.DataString.ToString().Split('/'); // string inttype = values[values.Length - 1]; string integrationtype = url.Trim().Contains("google_fit") ? "2" : "1"; string integration = url.Substring(url.IndexOf("code=") + 4 + 1); //LoadApplication(new App(integrationtype, integration)); LoadApplication(new App(integrationtype, integration)); /* now store the url somewhere in the app’s context. The url is in the url NSUrl object. The data is in url.Host if the link as a scheme as superduperapp://something_interesting */ return(true); }
public void Finished(object sender, UIImagePickerMediaPickedEventArgs e) { bool isImage = false; switch (e.Info[UIImagePickerController.MediaType].ToString()) { case "public.image": isImage = true; break; case "public.video": break; } NSUrl referenceURL = e.Info[new NSString("UIImagePickerControllerReferenceUrl")] as NSUrl; if (referenceURL != null) { Console.WriteLine("Url:" + referenceURL.ToString()); } if (isImage) { GetAndSendTheImage(e); } else { NSUrl mediaURL = e.Info[UIImagePickerController.MediaURL] as NSUrl; if (mediaURL != null) { Console.WriteLine(mediaURL.ToString()); } } picker.DismissModalViewController(true); }
public void GetUrlForUbiquityContainer() { #if !MONOMAC if ((Runtime.Arch == Arch.SIMULATOR) && RunningOnSnowLeopard) { Assert.Inconclusive("sometimes crash under the iOS simulator (generally on the SL/iOS5 bots)"); } #endif NSFileManager fm = new NSFileManager(); if (TestRuntime.CheckXcodeVersion(4, 5) && fm.UbiquityIdentityToken == null) { // UbiquityIdentityToken is a fast way to check if iCloud is enabled Assert.Pass("not iCloud enabled"); } NSUrl c = null; Exception e = null; ManualResetEvent evt = new ManualResetEvent(false); new Thread(() => { try { // From Apple's documentaiton: // Important: Do not call this method from your app’s main thread. Because this method might take a nontrivial amount of time to set up // iCloud and return the requested URL, you should always call it from a secondary thread. c = fm.GetUrlForUbiquityContainer(null); } catch (Exception ex) { e = ex; } finally { evt.Set(); } }) { IsBackground = true, }.Start(); if (evt.WaitOne(TimeSpan.FromSeconds(15))) { if (e != null) { throw e; } if (c == null) { Assert.Pass("not iCloud enabled"); // simulator or provisioning profile without iCloud enabled (old ones) } else { Assert.That(c.ToString(), Does.StartWith("file://localhost/private/var/mobile/Library/Mobile%20Documents"). Or.StartWith("file:///private/var/mobile/Library/Mobile%20Documents")); } } else { Assert.Pass("iCloud is probably not enabled"); // aborting is evil, so don't bother aborting the thread, just let it run its course } }
public override bool HandleOpenURL(UIApplication application, NSUrl url) { if (url == null) return false; var uri = new System.Uri(url.ToString()); // if (Slideout != null) // { // if (!string.IsNullOrEmpty(uri.Host)) // { // string username = uri.Host; // string repo = null; // // if (uri.Segments.Length > 1) // repo = uri.Segments[1].Replace("/", ""); // // if (repo == null) // Slideout.SelectView(new CodeBucket.ViewControllers.ProfileViewController(username)); // else // Slideout.SelectView(new CodeBucket.ViewControllers.RepositoryInfoViewController(username, repo, repo)); // } // } return true; }
void TestSelUrlWithData(NSUrl url, NSData nsData) { Console.WriteLine("In TestSelUrlWithData"); Console.WriteLine(url.ToString()); Console.WriteLine(nsData.ToString()); return; }
public void TestAppendVisitorInfoForUrl_Returns_AppendedUrl() { // setup Thread.Sleep(1000); CountdownEvent latch = new CountdownEvent(2); string urlString = null; string ecid = null; string orgid = new NSString("972C898555E9F7BC7F000101%40AdobeOrg"); NSUrl url = new NSUrl("https://test.com"); // test ACPIdentity.GetExperienceCloudId(ecidCallback => { ecid = ecidCallback.ToString(); latch.Signal(); ACPIdentity.AppendToUrl(url, callback => { urlString = callback.ToString(); latch.Signal(); }); }); latch.Wait(); latch.Dispose(); // verify Assert.That(urlString, Is.StringContaining(url.ToString())); Assert.That(urlString, Is.StringContaining(ecid)); Assert.That(urlString, Is.StringContaining(orgid)); }
public PdfViewController (NSUrl url) : base() { Url = url; View = new UIView (); View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin; View.AutosizesSubviews = true; PdfDocument = CGPDFDocument.FromUrl (Url.ToString ()); // For demo purposes, show first page only. PdfPage = PdfDocument.GetPage (1); PdfPageRect = PdfPage.GetBoxRect (CGPDFBox.Crop); // Setup tiled layer. TiledLayer = new CATiledLayer (); TiledLayer.Delegate = new TiledLayerDelegate (this); TiledLayer.TileSize = new SizeF (1024f, 1024f); TiledLayer.LevelsOfDetail = 5; TiledLayer.LevelsOfDetailBias = 5; TiledLayer.Frame = PdfPageRect; ContentView = new UIView (PdfPageRect); ContentView.Layer.AddSublayer (TiledLayer); // Prepare scroll view. ScrollView = new UIScrollView (View.Frame); ScrollView.AutoresizingMask = View.AutoresizingMask; ScrollView.Delegate = new ScrollViewDelegate (this); ScrollView.ContentSize = PdfPageRect.Size; ScrollView.MaximumZoomScale = 10f; ScrollView.MinimumZoomScale = 1f; ScrollView.ScrollEnabled = true; ScrollView.AddSubview (ContentView); View.AddSubview (ScrollView); }
public override void SendAsync(NSUrl url, NSString method, NSDictionary <NSString, NSString> headers, NSData data, MSHttpRequestCompletionHandler completionHandler) { _httpClientDelegate?.WillSendHTTPRequestToURL(url, headers); var managedHeaders = new Dictionary <string, string>(); foreach (KeyValuePair <NSObject, NSObject> header in headers) { managedHeaders[header.Key.ToString()] = header.Value.ToString(); } _httpNetworkAdapter.SendAsync(url.ToString(), method, managedHeaders, data.ToString(), CancellationToken.None).ContinueWith(t => { var innerException = t.Exception?.InnerException; if (innerException is HttpException) { var response = (innerException as HttpException).HttpResponse; completionHandler(NSData.FromString(response.Content), new NSHttpUrlResponse(url, response.StatusCode, "1.1", new NSDictionary()), null); } else if (innerException != null) { var userInfo = NSDictionary.FromObjectAndKey(new NSString("stackTrace"), new NSString(innerException.ToString())); completionHandler(null, null, new NSError(new NSString(".NET SDK"), 1, userInfo)); } else { var response = t.Result; completionHandler(NSData.FromString(response.Content), new NSHttpUrlResponse(url, response.StatusCode, "1.1", new NSDictionary()), null); } }); }
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options) { var tabController = Window.RootViewController as UINavigationController; if (AppSettings.User.IsAuthenticated) { var urlCollection = url.ToString().Replace("steepshot://", string.Empty); var nsFileManager = new NSFileManager(); var imageData = nsFileManager.Contents(urlCollection); var sharedPhoto = UIImage.LoadFromData(imageData); var inSampleSize = ImageHelper.CalculateInSampleSize(sharedPhoto.Size, Core.Constants.PhotoMaxSize, Core.Constants.PhotoMaxSize); var deviceRatio = UIScreen.MainScreen.Bounds.Width / UIScreen.MainScreen.Bounds.Height; var x = ((float)inSampleSize.Width - Core.Constants.PhotoMaxSize * (float)deviceRatio) / 2f; sharedPhoto = ImageHelper.CropImage(sharedPhoto, 0, 0, (float)inSampleSize.Width, (float)inSampleSize.Height, inSampleSize); var descriptionViewController = new DescriptionViewController(new List <Tuple <NSDictionary, UIImage> >() { new Tuple <NSDictionary, UIImage>(null, sharedPhoto) }, "jpg"); tabController.PushViewController(descriptionViewController, false); } else { tabController.PushViewController(new WelcomeViewController(), false); } return(true); }
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options) { Device.BeginInvokeOnMainThread( async() => { try { var launchUrl = url.ToString(); if (launchUrl.ToLower().StartsWith("safe://")) { MessagingCenter.Send((App)Xamarin.Forms.Application.Current, MessageCenterConstants.LoadSafeWebsite, launchUrl); } else if (launchUrl.StartsWith(Constants.AppId)) { await _authenticationService.ProcessAuthenticationResponseAsync(launchUrl); } Logger.Info("IPC Msg Handling Completed"); } catch (Exception ex) { Logger.Error(ex); } }); return(true); }
public override bool HandleOpenURL(UIApplication application, NSUrl url) { if (url == null) { return(false); } var uri = new System.Uri(url.ToString()); // if (Slideout != null) // { // if (!string.IsNullOrEmpty(uri.Host)) // { // string username = uri.Host; // string repo = null; // // if (uri.Segments.Length > 1) // repo = uri.Segments[1].Replace("/", ""); // // if (repo == null) // Slideout.SelectView(new CodeBucket.ViewControllers.ProfileViewController(username)); // else // Slideout.SelectView(new CodeBucket.ViewControllers.RepositoryInfoViewController(username, repo, repo)); // } // } return(true); }
private void OpenUrlOnThread(object url) { UIApplication.SharedApplication.InvokeOnMainThread(delegate { NSUrl urlParam = (NSUrl)url; SystemLogger.Log(SystemLogger.Module.PLATFORM, "Opening URL :" + urlParam.ToString()); UIApplication.SharedApplication.OpenUrl(urlParam); }); }
public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation) { var startup = Mvx.Resolve <IMvxAppStart>(); const string prefix = "hsrcampus://"; startup.Start(new StartUpHint { ViewModel = typeof(AccountViewModel), Parameter = new AccountViewModel.Args { UriPart = url.ToString().Substring(url.ToString().IndexOf(prefix, StringComparison.Ordinal) + prefix.Length) } }); return(true); }
protected void Handle_FinishedPickingMedia(object sender, UIImagePickerMediaPickedEventArgs e) { bool isImage = false; switch (e.Info[UIImagePickerController.MediaType].ToString()) { case "public.image": Console.WriteLine("Image selected"); isImage = true; break; case "public.video": Console.WriteLine("Video selected"); break; } Console.Write("Reference URL: [" + UIImagePickerController.ReferenceUrl + "]"); NSUrl referenceURL = e.Info[new NSString("UIImagePickerControllerReferenceUrl")] as NSUrl; if (referenceURL != null) { Console.WriteLine(referenceURL.ToString()); } if (isImage) { UIImage originalImage = e.Info[UIImagePickerController.OriginalImage] as UIImage; if (originalImage != null) { Console.WriteLine("got the original image"); TestImagePlace.Image = originalImage; // display } UIImage editedImage = e.Info[UIImagePickerController.EditedImage] as UIImage; if (editedImage != null) { Console.WriteLine("got the edited image"); TestImagePlace.Image = editedImage; } NSDictionary imageMetadata = e.Info[UIImagePickerController.MediaMetadata] as NSDictionary; if (imageMetadata != null) { Console.WriteLine("got image metadata"); } } else { NSUrl mediaURL = e.Info[UIImagePickerController.MediaURL] as NSUrl; if (mediaURL != null) { Console.WriteLine(mediaURL.ToString()); } } mediaPickerFromLibrary.DismissModalViewController(true); // where is Animated }
public override NSObject OpenDocument(NSUrl url, bool displayDocument, out NSError outError) { outError = AppDelegate.SuppressionNSError; if (CommandLineTool.TestDriver.ShouldRun) { return(null); } SessionDocument document = null; try { ClientSessionUri sessionUri; try { sessionUri = (ClientSessionUri) new Uri(url.ToString()); } catch (Exception e) { throw new UriFormatException(Catalog.GetString( "Invalid or unsupported URI."), e); } if (clientSessionController.TryGetApplicationState( sessionUri, out document) && document != null) { document.MakeKeyAndOrderFront(this); return(document); } document = base.OpenDocument(url, displayDocument, out outError) as SessionDocument; if (outError != null && outError != AppDelegate.SuppressionNSError) { throw new NSErrorException(outError); } if (document != null) { clientSessionController.AddSession(document.Session, document); } return(document); } catch (Exception e) { if (document != null) { try { document.Close(); } catch (Exception ee) { Log.Error(TAG, "Exception caught when trying to close document " + "due to exception when opening document", ee); } } e.ToUserPresentable($"“{url}” could not be opened.").Present(); } return(null); }
/// <summary> /// Gets a filename for a given NSUrl /// </summary> /// <param name="url">The url path to the file</param> /// <param name="defaultVal">The default file string to be returned if url is null</param> /// <returns> /// The file string representing url /// </returns> private string GetFileString(NSUrl url, string defaultVal) { if (url == null) { return(defaultVal); } return(System.IO.Path.GetFileName(url.ToString())); }
private void Handle_FinishedPickingMedia(object sender, UIImagePickerMediaPickedEventArgs e) { // determine what was selected, video or image bool isImage = false; switch (e.Info[UIImagePickerController.MediaType].ToString()) { case "public.image": System.Diagnostics.Debug.WriteLine("--> Image selected"); isImage = true; break; case "public.video": System.Diagnostics.Debug.WriteLine("--> Video selected"); break; } // get common info (shared between images and video) NSUrl referenceURL = e.Info[new NSString("UIImagePickerControllerReferenceUrl")] as NSUrl; System.Diagnostics.Debug.WriteLine("--> got url " + referenceURL); if (referenceURL != null) { System.Diagnostics.Debug.WriteLine("--> Url:" + referenceURL.ToString()); } // if it was an image, get the other image info if (isImage) { // get the original image UIImage originalImage = e.Info[UIImagePickerController.OriginalImage] as UIImage; if (originalImage != null) { // todo do something with the image System.Diagnostics.Debug.WriteLine("--> got the original image"); System.Diagnostics.Debug.WriteLine("--> PATH " + originalImage.AccessibilityPath); //imageView.Image = originalImage; // display } } else { // if it's a video // get video url NSUrl mediaURL = e.Info[UIImagePickerController.MediaURL] as NSUrl; if (mediaURL != null) { System.Diagnostics.Debug.WriteLine("--> " + mediaURL.ToString()); } } // dismiss the picker //imagePicker.DismissModalViewControllerAnimated(true); UIApplication.SharedApplication.KeyWindow.RootViewController.DismissViewControllerAsync(true); }
public override void ViewDidLoad() { base.ViewDidLoad(); string translatedNumber = ""; TranslateButton.TouchUpInside += (object sender, EventArgs e) => { // Convert the phone number with text to a number // using PhoneTranslator.cs translatedNumber = PhoneTranslator.ToNumber(PhoneNumberText.Text); //Store the phone number that we're dialing in PhoneNumbers PhoneNumbers.Add(translatedNumber); // Dismiss the keyboard if text field was tapped PhoneNumberText.ResignFirstResponder(); if (translatedNumber == "") { callButton.SetTitle("Call ", UIControlState.Normal); callButton.Enabled = false; } else { callButton.SetTitle("Call " + translatedNumber, UIControlState.Normal); callButton.Enabled = true; } }; callButton.TouchUpInside += (object sender, EventArgs e) => { // Use URL handler with tel: prefix to invoke Apple's Phone app... var url = new NSUrl("tel:" + translatedNumber); Console.WriteLine(url.ToString()); // ...otherwise show an alert dialog if (!UIApplication.SharedApplication.OpenUrl(url)) { var alert = UIAlertController.Create("Not supported", "Scheme 'tel:' is not supported on this device", UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null)); PresentViewController(alert, true, null); } }; CallHistoryButton.TouchUpInside += (object sender, EventArgs e) => { // Launches a new instance of CallHistoryController CallHistoryController callHistory = this.Storyboard.InstantiateViewController("CallHistoryController") as CallHistoryController; if (callHistory != null) { callHistory.PhoneNumbers = PhoneNumbers; this.NavigationController.PushViewController(callHistory, true); } }; }
public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options) { Device.BeginInvokeOnMainThread( async() => { try { Debug.WriteLine($"IPC Response: {url.ToString()}"); await RequestService.ProcessResponseAsync(url.ToString()); Debug.WriteLine("IPC Msg Handling Completed"); } catch (Exception ex) { Debug.WriteLine($"Error: {ex.Message}"); } }); return(true); }
void Handle_FinishedPickingMedia(object sender, UIImagePickerMediaPickedEventArgs e) { bool isImage = false; switch (e.Info[UIImagePickerController.MediaType].ToString()) { case "public.image": Console.WriteLine("Image selected"); isImage = true; break; case "public.video": Console.WriteLine("Video selected"); break; } NSUrl referenceURL = e.Info[new NSString("UIImagePickerControllerReferenceUrl")] as NSUrl; if (referenceURL != null) { Console.WriteLine("Url:" + referenceURL.ToString()); } if (isImage) { NSUrl mediaURL = e.Info[UIImagePickerController.ImageUrl] as NSUrl; if (mediaURL != null) { Console.WriteLine(mediaURL.ToString()); AppDelegate.dataConversation.SendMessage("picture", null, mediaURL.ToString()); TableView.ReloadData(); } } else { NSUrl mediaURL = e.Info[UIImagePickerController.MediaURL] as NSUrl; if (mediaURL != null) { Console.WriteLine(mediaURL.ToString()); } } imagePicker.DismissViewControllerAsync(true); }
public void Bug13069 () { string url = "http://*****:*****@google.com:8080/path?query=value.ext"; var uri = new Uri (url); Assert.That (url.ToString (), Is.EqualTo (url), "Uri.ToString"); var ns1 = (NSUrl) uri; Assert.That (ns1.ToString (), Is.EqualTo (url), "implicit NSUrl.ToString"); var ns2 = new NSUrl (uri.ToString ()); Assert.That (ns2.ToString (), Is.EqualTo (url), "created NSUrl.ToString"); }
/// <summary> /// Handles the opening of a resource specified by a URL. /// </summary> /// <param name="application">The current application.</param> /// <param name="url">The URL resource to open.</param> /// <param name="sourceApplication">The source application requesting the resource.</param> /// <param name="annotation">The annotation.</param> /// <returns> /// <c>true</c> if the delegate successfully handled the request; /// <c>false</c> if the attempt to open the URL resource failed. /// </returns> public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation) { // Handle the resource URI Debug.WriteLine("OpenUrl"); Debug.WriteLine(url); AppDelegate.HandleUri(new Uri(url.ToString())); // Return success return(true); }
public void ImplicitOperatorRoundTrip(string value, UriKind kind) { var nsurl = new NSUrl(value); Assert.AreEqual(nsurl.ToString(), ((NSUrl)(Uri)nsurl).ToString(), "RoundTrip NSUrl"); var url = new Uri(value, kind); Assert.AreEqual(url.ToString(), ((Uri)(NSUrl)url).ToString(), "RoundTrip Uri"); }
protected void Handle_FinishedPickingMedia(object sender, UIImagePickerMediaPickedEventArgs e) { // determine what was selected, video or image bool isImage = false; switch (e.Info[UIImagePickerController.MediaType].ToString()) { case "public.image": Console.WriteLine("Image selected"); isImage = true; break; case "public.video": Console.WriteLine("Video selected"); break; } // get common info (shared between images and video) var referenceURL = e.Info[new NSString("UIImagePickerControllerReferenceUrl")] as NSUrl; if (referenceURL != null) { Console.WriteLine("Url:" + referenceURL.ToString()); } // if it was an image, get the other image info if (isImage) { // get the original image UIImage originalImage = e.Info[UIImagePickerController.OriginalImage] as UIImage; if (originalImage != null) { // do something with the image Console.WriteLine("got the original image"); var imageBytes = originalImage.AsJPEG().ToArray(); _imageTask.SetResult(imageBytes); // imageView.Image = originalImage; // display } } else { // if it's a video // get video url NSUrl mediaURL = e.Info[UIImagePickerController.MediaURL] as NSUrl; if (mediaURL != null) { Console.WriteLine(mediaURL.ToString()); } } // dismiss the picker var vc = UIApplication.SharedApplication.KeyWindow.RootViewController; vc.DismissViewController(false, () => { }); }
//Custom functions protected void Handle_FinishedPickingMedia(object _sender, UIImagePickerMediaPickedEventArgs a) { bool IsImage = false; switch (a.Info[UIImagePickerController.MediaType].ToString()) { case "public.image": Console.WriteLine("Image selected"); IsImage = true; break; case "public.video": Console.WriteLine("Video selected"); break; } NSUrl referenceURL = a.Info[new NSString("UIImagePickerControllerReference")] as NSUrl; if (referenceURL != null) { Console.WriteLine("Url:" + referenceURL.ToString()); } if (IsImage) { UIImage originalImage = a.Info[UIImagePickerController.OriginalImage] as UIImage; if (originalImage != null) { Console.WriteLine("Got the original image"); pic.SetBackgroundImage(originalImage, UIControlState.Highlighted); } } else { NSUrl mediaURL = a.Info[UIImagePickerController.MediaURL] as NSUrl; if (mediaURL != null) { Console.WriteLine(mediaURL.ToString()); } } UIImage editedImage = a.Info[UIImagePickerController.EditedImage] as UIImage; if (editedImage != null) { Console.WriteLine("got the edited image"); pic.SetBackgroundImage(editedImage, UIControlState.Highlighted); pic.Layer.CornerRadius = 65; // this value vary as per your desire pic.ClipsToBounds = true; //= editedImage; } ImagePicker.DismissViewController(true, null); }
public override void DidSelectLinkWithURL (MonoTouch.TTTAttributedLabel.TTTAttributedLabel label, NSUrl url) { try { if (url.ToString().StartsWith("http", StringComparison.Ordinal)) { if (_webLinkClicked != null) _webLinkClicked(url); } else { var i = Int32.Parse(url.ToString()); _links[i].Callback(); } } catch (Exception e) { Console.WriteLine("Unable to callback on TTTAttributedLabel: {0}", e.Message); } }
private bool OpenDeepLink(NSUrl url) { //var svgurl = url.LastPathComponent; //fails to correctly decode path var uri = url.ToString(); var pathIndex = uri.LastIndexOf('/'); var svgurl = Uri.UnescapeDataString(uri.Substring(pathIndex + 1)); if (!String.IsNullOrWhiteSpace(svgurl)) { var dontWait = MyViewController.TheViewController.LoadSvg(svgurl); return true; } return false; }
private void InitiateCall(object textURI) { UIApplication.SharedApplication.InvokeOnMainThread (delegate { NSUrl urlParam = new NSUrl ((string)textURI); SystemLogger.Log(SystemLogger.Module.PLATFORM,"Make CALL using URL :"+urlParam.ToString()); if (UIApplication.SharedApplication.CanOpenUrl (urlParam)) { UIApplication.SharedApplication.OpenUrl (urlParam); } else { INotification notificationService = (INotification)IPhoneServiceLocator.GetInstance ().GetService ("notify"); if (notificationService != null) { notificationService.StartNotifyAlert ("Phone Alert", "Establishing voice calls is not enabled or supported on this device.", "OK"); } } }); }
public override bool OpenUrl(UIApplication app, NSUrl url, string sourceApp, NSObject annotation) { var rurl = new Rivets.AppLinkUrl (url.ToString ()); var id = string.Empty; if (rurl.InputQueryParameters.ContainsKey("id")) id = rurl.InputQueryParameters ["id"]; if (rurl.InputUrl.Host.Equals ("products") && !string.IsNullOrEmpty (id)) { var c = new ProductViewController (id); navController.PushViewController (c, true); return true; } else { navController.PopToRootViewController (true); return true; } }
public override void DidFinishDownloading(NSUrlSession session, NSUrlSessionDownloadTask downloadTask, NSUrl location) { OnDownloadCompleted(location.ToString(), downloadTask.TaskDescription ?? ""); }
public override void DidFinishDownloading (NSUrlSession session, NSUrlSessionDownloadTask downloadTask, NSUrl location) { _uploadCompleted (this, new NSUrlEventArgs (location.ToString ())); }
public virtual void DidFinishDownloading(NSUrlSessionDownloadTask downloadTask, NSUrl location) { Console.WriteLine ("DidFinishDownloading: {0}", location.ToString()); }
public override void ShouldPerformSelectorWithURL(NotificarePushLib library, NSUrl url) { Console.WriteLine ("Should perform selector: " + url.ToString()); }