optimized and add diagnostic feature
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using Billing.Models;
|
||||
using Billing.Themes;
|
||||
using Billing.UI;
|
||||
using Billing.Views;
|
||||
using System;
|
||||
@@ -20,34 +19,35 @@ namespace Billing
|
||||
var time = DateTime.Now.ToString("HH:mm:ss.fff");
|
||||
System.Diagnostics.Debug.WriteLine($"[{time}] - {message}");
|
||||
}
|
||||
|
||||
public static void Error(string category, Exception ex)
|
||||
{
|
||||
Error(category, ex?.Message ?? "unknown error");
|
||||
}
|
||||
|
||||
public static void Error(string category, string message)
|
||||
{
|
||||
var time = DateTime.Now.ToString("HH:mm:ss.fff");
|
||||
System.Diagnostics.Debug.Fail($"[{time}] - {category}", message);
|
||||
}
|
||||
#else
|
||||
#pragma warning disable IDE0060 // Remove unused parameter
|
||||
public static void Debug(string message)
|
||||
{
|
||||
}
|
||||
#pragma warning restore IDE0060 // Remove unused parameter
|
||||
#endif
|
||||
|
||||
public static void Error(string category, Exception ex)
|
||||
{
|
||||
MainThread.BeginInvokeOnMainThread(async () => await Shell.Current.DisplayAlert(category, ex.ToString(), "Ok"));
|
||||
Error(category, ex?.ToString() ?? "unknown error");
|
||||
}
|
||||
|
||||
public static void Error(string category, string message)
|
||||
{
|
||||
}
|
||||
#pragma warning restore IDE0060 // Remove unused parameter
|
||||
#if DEBUG
|
||||
var time = DateTime.Now.ToString("HH:mm:ss.fff");
|
||||
System.Diagnostics.Debug.WriteLine($"[{time}] - {category}", message);
|
||||
MainThread.BeginInvokeOnMainThread(async () => await Shell.Current.DisplayAlert(category, message, "Ok"));
|
||||
#endif
|
||||
|
||||
_ = Store.StoreHelper.SaveLogItemAsync(new Logs()
|
||||
{
|
||||
LogTime = DateTime.Now,
|
||||
Category = category,
|
||||
Detail = message
|
||||
});
|
||||
}
|
||||
|
||||
public static bool NetworkAvailable
|
||||
{
|
||||
get
|
||||
@@ -89,9 +89,7 @@ namespace Billing
|
||||
return new UIBill(b)
|
||||
{
|
||||
Icon = category?.Icon ?? Definition.DefaultIcon,
|
||||
TintColor = category?.TintColor.IsTransparent() == false ?
|
||||
category.TintColor.ToColor() :
|
||||
BaseTheme.CurrentPrimaryColor,
|
||||
TintColor = category?.TintColor ?? Definition.TransparentColor,
|
||||
Name = b.Name,
|
||||
DateCreation = b.CreateTime,
|
||||
Amount = b.Amount,
|
||||
|
||||
Reference in New Issue
Block a user