public override void ViewDidLoad ()
 {
     base.ViewDidLoad ();
     
     tv.BecomeFirstResponder ();
     
     toolbar.Items[0].Clicked += (o, s) =>
     {
         string text = tv.Text;
         NSData pdfData = CreatePDF (text, 500f, 700f);
         
         if (MFMailComposeViewController.CanSendMail) {
             _mail = new MFMailComposeViewController ();
             _mail.SetMessageBody (tv.Text, false);
             _mail.AddAttachmentData (pdfData, "text/x-pdf", "test.pdf");
             _mail.Finished += HandleMailFinished;
             this.PresentModalViewController (_mail, true);
         } else {
             UIAlertView alert = new UIAlertView ("App", "Could not send mail.", null, "OK", null);
             alert.Show ();
         }
     };
     
     toolbar.Items[1].Clicked += (o, s) =>
     {
         _pdf = new PDFViewController (tv.Text);
         this.PresentModalViewController (_pdf, true);
     };
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            tv.BecomeFirstResponder();

            toolbar.Items[0].Clicked += (o, s) =>
            {
                string text    = tv.Text;
                NSData pdfData = CreatePDF(text, 500f, 700f);

                if (MFMailComposeViewController.CanSendMail)
                {
                    _mail = new MFMailComposeViewController();
                    _mail.SetMessageBody(tv.Text, false);
                    _mail.AddAttachmentData(pdfData, "text/x-pdf", "test.pdf");
                    _mail.Finished += HandleMailFinished;
                    this.PresentModalViewController(_mail, true);
                }
                else
                {
                    UIAlertView alert = new UIAlertView("App", "Could not send mail.", null, "OK", null);
                    alert.Show();
                }
            };

            toolbar.Items[1].Clicked += (o, s) =>
            {
                _pdf = new PDFViewController(tv.Text);
                this.PresentModalViewController(_pdf, true);
            };
        }