|
@@ -1,4 +1,6 @@
|
|
|
using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.IO;
|
|
|
using System.Linq;
|
|
|
using System.Threading;
|
|
|
using System.Threading.Tasks;
|
|
@@ -57,7 +59,7 @@ namespace comal.timesheets
|
|
|
}
|
|
|
|
|
|
private async void ExitBtn_Clicked(object sender, EventArgs e)
|
|
|
- {
|
|
|
+ {
|
|
|
using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Working"))
|
|
|
{
|
|
|
//Syncfusion Masked editor still needs access before popping the page
|
|
@@ -122,6 +124,15 @@ namespace comal.timesheets
|
|
|
updateVersionBtn.Text = "Update App Version (" + latestVersionNumber + ")";
|
|
|
}
|
|
|
|
|
|
+ const string errorFilename = "Fatal.log";
|
|
|
+ var libraryPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
|
|
|
+ var errorFilePath = Path.Combine(libraryPath, errorFilename);
|
|
|
+
|
|
|
+ if (File.Exists(errorFilePath))
|
|
|
+ {
|
|
|
+ sendErrorsBtn.IsEnabled = true;
|
|
|
+ }
|
|
|
+
|
|
|
//if (Application.Current.Properties.ContainsKey("IsSharedDevice"))
|
|
|
//{
|
|
|
// if (Application.Current.Properties["IsSharedDevice"].Equals("True"))
|
|
@@ -329,5 +340,35 @@ namespace comal.timesheets
|
|
|
// DisplayAlert("Success", "", "OK");
|
|
|
// }
|
|
|
//}
|
|
|
+
|
|
|
+ private async void SendErrorsBtn_Clicked(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ const 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 message = new EmailMessage
|
|
|
+ {
|
|
|
+ Subject = "Error Logs from " + GlobalVariables.EmpName,
|
|
|
+ Body = errorText,
|
|
|
+ To = new List<string> { "nick@prsdigital.com.au" }
|
|
|
+ };
|
|
|
+
|
|
|
+ await Email.ComposeAsync(message);
|
|
|
+
|
|
|
+ File.Delete(errorFilePath);
|
|
|
+ }
|
|
|
+ catch { }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|