private void ChooseStyle() { // Start the UI for the user choosing the junction. if (_currentPlacemark.GraphicType == KmlGraphicType.Point) { // Build a UI alert controller for picking the icon. UIAlertController prompt = UIAlertController.Create(null, "Choose an icon.", UIAlertControllerStyle.ActionSheet); foreach (string link in _iconLinks) { UIAlertAction action = UIAlertAction.Create(link, UIAlertActionStyle.Default, Icon_Select); UIImage image = new UIImage(NSData.FromUrl(new NSUrl(link))); action.SetValueForKey(image, new NSString("image")); prompt.AddAction(action); } prompt.AddAction(UIAlertAction.Create("No Style", UIAlertActionStyle.Cancel, null)); // Needed to prevent crash on iPad. UIPopoverPresentationController ppc = prompt.PopoverPresentationController; if (ppc != null) { ppc.BarButtonItem = _addButton; ppc.PermittedArrowDirections = UIPopoverArrowDirection.Down; } PresentViewController(prompt, true, null); } else if (_currentPlacemark.GraphicType == KmlGraphicType.Polyline || _currentPlacemark.GraphicType == KmlGraphicType.Polygon) { // Build a UI alert controller for picking the color. UIAlertController prompt = UIAlertController.Create(null, "Choose a color.", UIAlertControllerStyle.ActionSheet); foreach (UIColor color in _colorList) { UIAlertAction action = UIAlertAction.Create(color.ToString(), UIAlertActionStyle.Default, Color_Select); action.SetValueForKey(color, new NSString("titleTextColor")); prompt.AddAction(action); } prompt.AddAction(UIAlertAction.Create("No Style", UIAlertActionStyle.Cancel, null)); // Needed to prevent crash on iPad. UIPopoverPresentationController ppc = prompt.PopoverPresentationController; if (ppc != null) { ppc.BarButtonItem = _addButton; ppc.PermittedArrowDirections = UIPopoverArrowDirection.Down; } PresentViewController(prompt, true, null); } }
partial void RCMessageAttach(NSObject sender) { UIAlertController actionSheetAlert = UIAlertController.Create(null, null, UIAlertControllerStyle.ActionSheet); UIAlertAction alertCamera = UIAlertAction.Create("Camera", UIAlertActionStyle.Default, HandleActionAlertCamera); UIAlertAction alertPicture = UIAlertAction.Create("Picture", UIAlertActionStyle.Default, HandleActionAlertPicture); UIAlertAction alertVideo = UIAlertAction.Create("Video", UIAlertActionStyle.Default, (action) => { AppDelegate.dataConversation.SendMessage("video", null, null); TableView.ReloadData(); }); UIAlertAction alertStickers = UIAlertAction.Create("Stickers", UIAlertActionStyle.Default, (action) => Console.WriteLine("Button Stickers pressed.")); UIAlertAction alertLocation = UIAlertAction.Create("Location", UIAlertActionStyle.Default, (action) => { AppDelegate.dataConversation.SendMessage("location", null, null); TableView.ReloadData(); }); alertCamera.SetValueForKey(UIImage.FromBundle("chat_camera"), (NSString)"image"); alertPicture.SetValueForKey(UIImage.FromBundle("chat_picture"), (NSString)"image"); alertVideo.SetValueForKey(UIImage.FromBundle("chat_video"), (NSString)"image"); alertStickers.SetValueForKey(UIImage.FromBundle("chat_sticker"), (NSString)"image"); alertLocation.SetValueForKey(UIImage.FromBundle("chat_location"), (NSString)"image"); actionSheetAlert.AddAction(alertCamera); actionSheetAlert.AddAction(alertPicture); actionSheetAlert.AddAction(alertVideo); actionSheetAlert.AddAction(alertStickers); actionSheetAlert.AddAction(alertLocation); actionSheetAlert.AddAction(UIAlertAction.Create("Cancel", UIAlertActionStyle.Cancel, (action) => Console.WriteLine("Cancel button pressed."))); UIPopoverPresentationController presentationPopover = actionSheetAlert.PopoverPresentationController; if (presentationPopover != null) { presentationPopover.SourceView = this.View; presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up; } this.PresentViewController(actionSheetAlert, true, null); }