private void GenerateNewCache(QRCodeItem qrCodeItem)
        {
            var newCache = new NewItemPageViewModelCache
            {
                QRCodeItem = qrCodeItem,
                CancellationTokenSource = new CancellationTokenSource()
            };

            _caches.Add(newCache);

            var cancellationToken = newCache.CancellationTokenSource.Token;

            newCache.Task = Task.Factory.StartNew(async() =>
            {
                // Cancel when request
                await Task.Delay(700);
                cancellationToken.ThrowIfCancellationRequested();

                // Save file
                _fileHelper.SaveByteArray(qrCodeItem.GenerateQRCodeByteArray(), qrCodeItem.Path);

                // Cancel when request
                await Task.Delay(300);
                cancellationToken.ThrowIfCancellationRequested();

                // Assign new item
                Item   = qrCodeItem;
                IsBusy = false;
            });
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // For example, look for an image and place it into an image view.
            // Replace this with something appropriate for the type[s] your extension supports.
            bool imageFound = false;

            foreach (var item in ExtensionContext.InputItems)
            {
                foreach (var itemProvider in item.Attachments)
                {
                    var foundType = _acceptedTypes.FirstOrDefault(at => itemProvider.HasItemConformingTo(at));

                    if (foundType == null)
                    {
                        continue;
                    }


                    itemProvider.LoadItem(foundType, null, (urlObj, error) =>
                    {
                        var url = urlObj.ToString();
                        Console.WriteLine(url);

                        if (url.Length > 256)
                        {
                            var deepLinkingUrl = string.Format("ShareQR://com.ettech.ShareQR?data={0}", url);
                            NSOperationQueue.MainQueue.AddOperation(() =>
                            {
                                _isOpenedInContainingApp = true;

                                OpenURL(new NSUrl(deepLinkingUrl));
                            });
                        }
                        else
                        {
                            dataLabel.Text = url;

                            Task.Factory.StartNew(() =>
                            {
                                _qrCodeItem      = new QRCodeItem(_fileHelper, url);
                                _qrCodeByteArray = _qrCodeItem.GenerateQRCodeByteArray();

                                using (var qrCodeByteBuffer = NSData.FromArray(_qrCodeByteArray))
                                {
                                    var image = UIImage.LoadFromData(qrCodeByteBuffer);
                                    NSOperationQueue.MainQueue.AddOperation(() => imageView.Image = image);
                                }
                            });
                        }
                    });


                    imageFound = true;
                    break;
                }

                if (imageFound)
                {
                    NSOperationQueue.MainQueue.AddOperation(() => saveButton.Enabled = true);

                    break;
                }
            }
        }