Esempio n. 1
0
        public void ShareShort(string message)
        {
            if (!TWTweetComposeViewController.CanSendTweet)
            {
                return;
            }

            _tweet = new TWTweetComposeViewController();
            _tweet.SetInitialText(message);
            _tweet.SetCompletionHandler(TWTweetComposeHandler);
            _modalHost.PresentModalViewController(_tweet, true);
        }
        public void ComposeEmail(
            IEnumerable <string> to, IEnumerable <string> cc = null, string subject = null,
            string body = null, bool isHtml = false,
            IEnumerable <EmailAttachment> attachments = null, string dialogTitle = null)
        {
            if (!MFMailComposeViewController.CanSendMail)
            {
                throw new MvxException("This device cannot send mail");
            }

            _mail = new MFMailComposeViewController();
            _mail.SetMessageBody(body ?? string.Empty, isHtml);
            _mail.SetSubject(subject ?? string.Empty);

            if (cc != null)
            {
                _mail.SetCcRecipients(cc.ToArray());
            }

            _mail.SetToRecipients(to?.ToArray() ?? new[] { string.Empty });
            if (attachments != null)
            {
                foreach (var a in attachments)
                {
                    _mail.AddAttachmentData(NSData.FromStream(a.Content), a.ContentType, a.FileName);
                }
            }
            _mail.Finished += HandleMailFinished;

            _modalHost.PresentModalViewController(_mail, true);
        }
Esempio n. 3
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. 4
0
        public void ShareUrl(string url)
        {
            var item          = new NSUrl(new Uri(url).AbsoluteUri);
            var activityItems = new NSObject[] { item };

            UIActivity[] applicationActivities = null;
            var          activityController    = new UIActivityViewController(activityItems, applicationActivities);

            _modalHost.PresentModalViewController(activityController, true);
        }
        private void ChoosePictureCommon(int maxPixelDimension, int percentQuality,
                                         Action <Stream> pictureAvailable, Action assumeCancelled)
        {
            SetCurrentlyActive();
            _maxPixelDimension = maxPixelDimension;
            _percentQuality    = percentQuality;
            _pictureAvailable  = pictureAvailable;
            _assumeCancelled   = assumeCancelled;

            _modalHost.PresentModalViewController(_picker, true);
        }
        public void SendSMS(string body, string phoneNumber)
        {
            if (!MFMessageComposeViewController.CanSendText)
            {
                return;
            }

            _sms = new MFMessageComposeViewController {
                Body = body, Recipients = new[] { phoneNumber }
            };
            _sms.Finished += HandleSmsFinished;

            _modalHost.PresentModalViewController(_sms, true);
        }
Esempio n. 7
0
        public void ComposeEmail(string to, string cc, string subject, string body, bool isHtml)
        {
            if (!MFMailComposeViewController.CanSendMail)
            {
                return;
            }

            _mail = new MFMailComposeViewController();
            _mail.SetMessageBody(body ?? string.Empty, isHtml);
            _mail.SetSubject(subject ?? string.Empty);
            _mail.SetCcRecipients(new[] { cc ?? string.Empty });
            _mail.SetToRecipients(new[] { to ?? string.Empty });
            _mail.Finished += HandleMailFinished;

            _modalHost.PresentModalViewController(_mail, true);
        }