switch to sqlite

This commit is contained in:
2022-03-11 16:10:11 +08:00
parent f5f16d43f4
commit 5ec4119025
25 changed files with 286 additions and 435 deletions

View File

@@ -1,8 +1,11 @@
using Billing.Models;
using Billing.UI;
using Billing.Views;
using System;
using System.Globalization;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Xamarin.Essentials;
using Xamarin.Forms;
@@ -82,7 +85,7 @@ namespace Billing
{
return new UIBill(b)
{
Icon = App.Categories.FirstOrDefault(c => c.Id == b.CategoryId)?.Icon ?? BaseModel.ICON_DEFAULT,
Icon = App.Categories.FirstOrDefault(c => c.Id == b.CategoryId)?.Icon ?? Definition.DefaultIcon,
Name = b.Name,
DateCreation = b.CreateTime,
Amount = b.Amount,
@@ -130,4 +133,24 @@ namespace Billing
public delegate void PropertyValueChanged<TResult, TOwner>(TOwner obj, TResult old, TResult @new);
}
internal class AsyncLazy<T>
{
private readonly Lazy<Task<T>> instance;
public AsyncLazy(Func<T> factory)
{
instance = new Lazy<Task<T>>(() => Task.Run(factory));
}
public AsyncLazy(Func<Task<T>> factory)
{
instance = new Lazy<Task<T>>(() => Task.Run(factory));
}
public TaskAwaiter<T> GetAwaiter()
{
return instance.Value.GetAwaiter();
}
}
}