category management
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using System.Xml.Linq;
|
||||
using Xamarin.Forms;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Billing.Models
|
||||
{
|
||||
@ -8,6 +9,7 @@ namespace Billing.Models
|
||||
public CategoryType Type { get; set; }
|
||||
public string Icon { get; set; } = ICON_DEFAULT;
|
||||
public string Name { get; set; }
|
||||
public Color TintColor { get; set; } = Color.Transparent;
|
||||
public int? ParentId { get; set; }
|
||||
|
||||
public override void OnXmlDeserialize(XElement node)
|
||||
@ -16,6 +18,11 @@ namespace Billing.Models
|
||||
Type = (CategoryType)Read(node, nameof(Type), 0);
|
||||
Icon = Read(node, nameof(Icon), ICON_DEFAULT);
|
||||
Name = Read(node, nameof(Name), string.Empty);
|
||||
var color = Read(node, nameof(TintColor), string.Empty);
|
||||
if (!string.IsNullOrEmpty(color))
|
||||
{
|
||||
TintColor = Color.FromHex(color);
|
||||
}
|
||||
var parentId = Read(node, nameof(ParentId), -1);
|
||||
if (parentId >= 0)
|
||||
{
|
||||
@ -29,6 +36,10 @@ namespace Billing.Models
|
||||
Write(node, nameof(Type), (int)Type);
|
||||
Write(node, nameof(Icon), Icon);
|
||||
Write(node, nameof(Name), Name);
|
||||
if (TintColor != Color.Transparent)
|
||||
{
|
||||
Write(node, nameof(TintColor), TintColor.ToHex());
|
||||
}
|
||||
if (ParentId != null)
|
||||
{
|
||||
Write(node, nameof(ParentId), ParentId.Value);
|
||||
|
Reference in New Issue
Block a user