optimized and add diagnostic feature

This commit is contained in:
2022-03-15 15:17:02 +08:00
parent 77b4e54734
commit 5b209cc19c
45 changed files with 380 additions and 122 deletions

View File

@ -85,7 +85,9 @@ namespace Billing.Views
private void UpdateBill(UIBill bill)
{
bill.Icon = App.Categories.FirstOrDefault(c => c.Id == bill.Bill.CategoryId)?.Icon ?? Definition.DefaultIcon;
var category = App.Categories.FirstOrDefault(c => c.Id == bill.Bill.CategoryId);
bill.Icon = category?.Icon ?? Definition.DefaultIcon;
bill.TintColor = category?.TintColor ?? Definition.TransparentColor;
bill.Name = bill.Bill.Name;
bill.DateCreation = bill.Bill.CreateTime;
bill.Amount = bill.Bill.Amount;
@ -207,7 +209,7 @@ namespace Billing.Views
public class UIBill : BindableObject
{
public static readonly BindableProperty IconProperty = Helper.Create<string, UIBill>(nameof(Icon));
public static readonly BindableProperty TintColorProperty = Helper.Create<Color, UIBill>(nameof(TintColor));
public static readonly BindableProperty TintColorProperty = Helper.Create<long, UIBill>(nameof(TintColor));
public static readonly BindableProperty NameProperty = Helper.Create<string, UIBill>(nameof(Name));
public static readonly BindableProperty DateCreationProperty = Helper.Create<DateTime, UIBill>(nameof(DateCreation));
public static readonly BindableProperty AmountProperty = Helper.Create<decimal, UIBill>(nameof(Amount));
@ -218,9 +220,9 @@ namespace Billing.Views
get => (string)GetValue(IconProperty);
set => SetValue(IconProperty, value);
}
public Color TintColor
public long TintColor
{
get => (Color)GetValue(TintColorProperty);
get => (long)GetValue(TintColorProperty);
set => SetValue(TintColorProperty, value);
}
public string Name