Esempio n. 1
0
        private void DisplayCrashReport(UIViewController root)
        {
            try
            {
                string errorFilename = "Fatal.log";
                var    libraryPath   = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                var    errorFilePath = Path.Combine(libraryPath, errorFilename);

                if (!File.Exists(errorFilePath))
                {
                    return;
                }

                var errorText = File.ReadAllText(errorFilePath);
                var alertView = new UIAlertView("Crash Report", errorText, null, "Send to Dev Team", "Clear")
                {
                    UserInteractionEnabled = true
                };
                alertView.BecomeFirstResponder();
                alertView.Clicked += (sender, args) =>
                {
                    if (args.ButtonIndex != 0)
                    {
                        File.Delete(errorFilePath);
                    }
                    else
                    {
                        sendEmail(errorText, root);
                    }
                };

                alertView.Show();
            }
            catch
            {
            }
        }