private void HandleImagePick(UIImage image)
        {
            ClearCurrentlyActive();
            if (image != null)
            {
                if (_maxPixelDimension > 0 && (image.Size.Height > _maxPixelDimension || image.Size.Width > _maxPixelDimension))
                {
                    // resize the image
                    image = image.ImageToFitSize(new CGSize(_maxPixelDimension, _maxPixelDimension));
                }

                using (NSData data = image.AsJPEG(_percentQuality / 100f))
                {
                    var byteArray = new byte[data.Length];
                    Marshal.Copy(data.Bytes, byteArray, 0, Convert.ToInt32(data.Length));

                    var imageStream = new MemoryStream(byteArray, false);
                    if (_pictureAvailable != null)
                    {
                        _pictureAvailable(imageStream);
                    }
                }
            }
            else
            {
                if (_assumeCancelled != null)
                {
                    _assumeCancelled();
                }
            }

            _picker.DismissViewController(true, () => { });
            _picker.Delegate = null;
            _modalHost.NativeModalViewControllerDisappearedOnItsOwn();
        }
Esempio n. 2
0
        public void SendFeedbackErrorLog(string supportEmail, string subject)
        {
            if (!MFMailComposeViewController.CanSendMail)
            {
                var av = new UIAlertView(Localize.GetValue("PanelMenuViewReportProblemText"), Localize.GetValue("ServiceError_EmailClientAbsent"), null, Localize.GetValue("OkButtonText"), null);
                av.Show();
                return;
            }

            var mailComposer = new MFMailComposeViewController();
            var logFile      = _logger.GetLogFileName();

            if (logFile != null)
            {
                mailComposer.AddAttachmentData(NSData.FromFile(logFile), "text", Path.GetFileName(logFile));
            }

            mailComposer.SetToRecipients(new [] { supportEmail });
            mailComposer.SetMessageBody("", false);
            mailComposer.SetSubject(subject);
            mailComposer.Finished += (sender, args) =>
            {
                var uiViewController = sender as UIViewController;
                if (uiViewController == null)
                {
                    throw new ArgumentException("sender");
                }

                uiViewController.DismissViewController(true, () => { });
                _modalHost.NativeModalViewControllerDisappearedOnItsOwn();
            };
            _modalHost.PresentModalViewController(mailComposer, true);
        }
Esempio n. 3
0
        private void HandleMailFinished(object sender, MFComposeResultEventArgs e)
        {
            var uiViewController = sender as UIViewController;

            if (uiViewController == null)
            {
                throw new ArgumentException("sender");
            }

            uiViewController.DismissViewController(true, () => { });
            _modalHost.NativeModalViewControllerDisappearedOnItsOwn();
        }
Esempio n. 4
0
 private void TWTweetComposeHandler(TWTweetComposeViewControllerResult result)
 {
     _modalHost.NativeModalViewControllerDisappearedOnItsOwn();
     _tweet = null;
 }