public void ShareShort(string message) { if (!TWTweetComposeViewController.CanSendTweet) { return; } _tweet = new TWTweetComposeViewController(); _tweet.SetInitialText(message); _tweet.CompletionHandler = 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); }
public void Share(string message, string title = "", ShareType shareType = ShareType.Sms) { /* if (MFMessageComposeViewController.CanSendText) * { * var smsCtrl = new MFMessageComposeViewController(); * smsCtrl.Body = message; * smsCtrl.Subject = title; * smsCtrl.Finished += (sender, args) => * { * Debug.WriteLine("finished"); * }; * * _modalHost.PresentModalViewController(smsCtrl, true); * }*/ if (MFMailComposeViewController.CanSendMail) { var mail = new MFMailComposeViewController(); mail.SetSubject(title); // mail.SetToRecipients(new[] { "*****@*****.**" }); mail.SetMessageBody(message, false); mail.Finished += (sender, args) => { Debug.WriteLine("Finished"); args.Controller.DismissViewController(true, null); }; _modalHost.PresentModalViewController(mail, true); } }
private void ChoosePictureCommon(int maxPixelDimension, int percentQuality, Action <Stream, string> 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); }
public void ScanCardInfo(Action <AddCreditCard> callback, CreditCardScanOptions creditCardScanOptions = null) { if (creditCardScanOptions == null) { creditCardScanOptions = new CreditCardScanOptions(); } _callback = callback; _modalHost = Mvx.Resolve <IMvxIosModalHost>(); _paymentViewController = new CardIOPaymentViewController() { GuideColor = new UIColor(255, 255, 255, 1.0f)//ColorFromHex(creditCardScanOptions.GuideColor) }; _modalHost.PresentModalViewController(_paymentViewController, true); }
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); if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { var window = ((UIApplicationDelegate)UIApplication.SharedApplication.Delegate).Window; var pop = new UIPopoverController(activityController); pop.PresentFromRect(new CoreGraphics.CGRect(window.RootViewController.View.Frame.Width / 2, window.RootViewController.View.Frame.Height / 2, 0, 0), window.RootViewController.View, UIPopoverArrowDirection.Any, true); } else { _modalHost.PresentModalViewController(activityController, true); } }