Esempio n. 1
0
        private void ShowEmail()
        {
            ExceptionUtility.Try(() =>
            {
                #if DEBUG
                string recipients = "*****@*****.**";
                #else
                string recipients = AppSettings.GetAppSettingValue <string>(AppSettings.LogEmailRecipientsAppSettingName, "*****@*****.**");
                #endif

                if (MFMailComposeViewController.CanSendMail)
                {
                    LogUtility.LogMessage("Preparing to send diagnostic email to " + recipients, LogSeverity.Info);
                    MFMailComposeViewController mailVc = new MFMailComposeViewController();
                    mailVc.SetToRecipients(new string[] { recipients });

                    string subject = StringLiterals.SupportRequestSubject;
                    //if (User.Current != null)
                    //    subject += " " + User.Current.Username;

                    mailVc.SetSubject(subject);

                    string message = StringLiterals.EmailText + this.GetDeviceInfoAsString();

                    mailVc.SetMessageBody(message, false);

                    mailVc.Finished += (object s, MFComposeResultEventArgs args) =>
                    {
                        LogUtility.LogMessage("Diagnostic email sent to " + recipients, LogSeverity.Info);
                        System.Diagnostics.Debug.WriteLine(args.Result.ToString());
                        args.Controller.DismissViewController(true, null);
                    };

                    string logData = LogUtility.GetLogData();
                    mailVc.AddAttachmentData(NSData.FromString(logData), "text/plain", "logfile.txt");

                    this.NavigationController.PresentViewController(mailVc, true, () => { });
                }
                else
                {
                    AlertUtility.ShowAlert(
                        StringLiterals.NoMailSupportAlertTitle,
                        String.Format(StringLiterals.NoMailSupportAlertMessage, recipients)
                        );
                }
            });
        }
Esempio n. 2
0
        protected virtual void OnAuthFailure()
        {
            ExceptionUtility.Try(() =>
            {
                if (this.IsShowing)
                {
                    //cancel reconnecting
                    ConnectionManager.CancelReconnecting();

                    //clear cache
                    Caches.ClearCachesForAuthFailure();

                    MainThreadUtility.InvokeOnMain(() => {
                        //show alert
                        ProgressUtility.Dismiss();
                        AlertUtility.ShowAlert(StringLiterals.AuthFailure, StringLiterals.AuthFailureMessage);

                        //nav to login screen
                        this.NavigateUserConfig();
                    });
                }
            });
        }
Esempio n. 3
0
 private void ShowError(string errorMsg)
 {
     AlertUtility.ShowAlert(StringLiterals.Error, errorMsg);
 }