AirPic.Action.AirPlaySelectionViewController.LoadExtensionItem C# (CSharp) Method

LoadExtensionItem() static private method

static private LoadExtensionItem ( ) : void
return void
        void LoadExtensionItem()
        {
            foreach (var item in ExtensionContext.InputItems) {
                foreach (var itemProvider in item.Attachments) {
                    if (!itemProvider.HasItemConformingTo (UTType.Image))
                        continue;

                    itemProvider.LoadItem (UTType.Image, null, delegate (NSObject image, NSError error) {
                        // we can get a UIImage directly (e.g. the AirPic sample)
                        Image = (image as UIImage);
                        if (Image != null)
                            return;

                        // or we can get an NSUrl, e.g. iOS photo app
                        var url = (image as NSUrl);
                        if (url != null) {
                            Image = UIImage.FromFile (url.Path);
                            if (Image != null)
                                return;
                        }

                        // I have not seen a comprehensive list of all types that UTType.Image can return
                        // the device logs will tell you if the extension gets something it does not handle
                        if (Image == null)
                            Console.WriteLine ("Unsupported type: {0} {1}", image.Class.Name, image.Description);
                    });
                    // we only support one and there should not be more than one (Info.plist)
                    return;
                }
            }
        }