private async void OnBtnMail(object sender, RoutedEventArgs e) { ITrackingManager trackingManager = Ioc.Resolve <ITrackingManager>(); IMessageBoxService messageBoxService = Ioc.Resolve <IMessageBoxService>(); try { var email = new EmailMessage { Subject = "2Day Logs", Body = "Logs are available as attachments" }; await MailHelper.AddAttachment(email, "2day.db", "2day.db"); await MailHelper.AddAttachment(email, LogService.Filename, "logs.txt"); await EmailManager.ShowComposeNewEmailAsync(email); } catch (Exception ex) { string message = "Error while sending logs by email: " + ex; trackingManager.Exception(ex, message); messageBoxService.ShowAsync(StringResources.General_LabelError, message); } }
public static void Exception(Exception exception, string message = null, bool isFatal = false) { if (Ioc.HasType <ITrackingManager>()) { ITrackingManager trackingManager = Ioc.Resolve <ITrackingManager>(); trackingManager.Exception(exception, message, isFatal); } }
public static void Run(ITrackingManager trackingManager, SQLiteConnection connection) { foreach (var table in new List <string> { "folder", "tasks" }) { try { var databaseEntries = connection.Query <DatabaseEntry>("SELECT * FROM " + table); foreach (var databaseEntry in databaseEntries) { string update = string.Empty; if (!string.IsNullOrWhiteSpace(databaseEntry.Added)) { update += string.Format(" Added = '{0}',", NormalizeDatetime(databaseEntry.Added)); } if (!string.IsNullOrWhiteSpace(databaseEntry.Alarm)) { update += string.Format(" Alarm = '{0}',", NormalizeDatetime(databaseEntry.Alarm)); } if (!string.IsNullOrWhiteSpace(databaseEntry.Modified)) { update += string.Format(" Modified = '{0}',", NormalizeDatetime(databaseEntry.Modified)); } if (!string.IsNullOrWhiteSpace(databaseEntry.Due)) { update += string.Format(" Due = '{0}',", NormalizeDatetime(databaseEntry.Due)); } if (!string.IsNullOrWhiteSpace(databaseEntry.Start)) { update += string.Format(" Start = '{0}',", NormalizeDatetime(databaseEntry.Start)); } if (!string.IsNullOrWhiteSpace(databaseEntry.Completed)) { update += string.Format(" Completed = '{0}',", NormalizeDatetime(databaseEntry.Completed)); } update = update.TrimEnd(','); try { connection.Execute(string.Format("UPDATE {0} SET {1} WHERE Id = {2}", table, update, databaseEntry.Id)); } catch (Exception e1) { trackingManager.Exception(e1, "DatebaseDateTimeFixer update query"); } } } catch (Exception e2) { trackingManager.Exception(e2, "DatebaseDateTimeFixer select query"); } } }