diff --git a/Billing.Shared/Billing.Shared.projitems b/Billing.Shared/Billing.Shared.projitems index 2f2dce2..e9c4261 100644 --- a/Billing.Shared/Billing.Shared.projitems +++ b/Billing.Shared/Billing.Shared.projitems @@ -24,6 +24,7 @@ + @@ -33,10 +34,15 @@ + AccountPage.xaml + + AddAccountPage.xaml + Code + AddBillPage.xaml @@ -73,4 +79,9 @@ MSBuild:UpdateDesignTimeXaml + + + MSBuild:UpdateDesignTimeXaml + + \ No newline at end of file diff --git a/Billing.Shared/Languages/en.xml b/Billing.Shared/Languages/en.xml index 260deee..f800353 100644 --- a/Billing.Shared/Languages/en.xml +++ b/Billing.Shared/Languages/en.xml @@ -11,6 +11,20 @@ Fr Sa Bills not yet generated - Click here to record + Click here to record MM/dd/yyyy + Balance + Assets + Liability + Add Account + Account Name + Please enter account name + Icon + Category + Balance + Please enter the balance + Currency + Chinese Yuan (CNY) + Note + Please enter a note \ No newline at end of file diff --git a/Billing.Shared/Languages/zh-CN.xml b/Billing.Shared/Languages/zh-CN.xml index 21fda81..dcecf10 100644 --- a/Billing.Shared/Languages/zh-CN.xml +++ b/Billing.Shared/Languages/zh-CN.xml @@ -11,6 +11,20 @@ 周五 周六 还未产生账单 - 点此记录 + 点此记录 yyyy年MM月dd日 + 余额 + 资产 + 负债 + 新建账户 + 账户名称 + 请输入账户名称 + 图标 + 种类 + 余额 + 请输入余额 + 币种 + 人民币 (CNY) + 备注 + 请输入备注 \ No newline at end of file diff --git a/Billing.Shared/Models/Account.cs b/Billing.Shared/Models/Account.cs new file mode 100644 index 0000000..b7d57a6 --- /dev/null +++ b/Billing.Shared/Models/Account.cs @@ -0,0 +1,41 @@ +using System.Xml.Linq; + +namespace Billing.Models; + +public class Account : BaseModel +{ + public int Id { get; set; } + public string Icon { get; set; } = ICON_DEFAULT; + public AccountCategory Category { get; set; } + public string Name { get; set; } + public decimal Balance { get; set; } + public string Memo { get; set; } + + public override void OnXmlDeserialize(XElement node) + { + Id = Read(node, nameof(Id), 0); + Icon = Read(node, nameof(Icon), ICON_DEFAULT); + Category = (AccountCategory)Read(node, nameof(Category), 0); + Name = Read(node, nameof(Name), string.Empty); + Balance = Read(node, nameof(Balance), 0m); + Memo = Read(node, nameof(Memo), null); + } + + public override void OnXmlSerialize(XElement node) + { + Write(node, nameof(Id), Id); + Write(node, nameof(Icon), Icon); + Write(node, nameof(Category), (int)Category); + Write(node, nameof(Name), Name); + Write(node, nameof(Balance), Balance); + Write(node, nameof(Memo), Memo); + } +} + +public enum AccountCategory +{ + Cash = 0, + CreditCard, + DebitCard, + ElecAccount +} diff --git a/Billing.Shared/Models/BaseModel.cs b/Billing.Shared/Models/BaseModel.cs index 647af34..410765b 100644 --- a/Billing.Shared/Models/BaseModel.cs +++ b/Billing.Shared/Models/BaseModel.cs @@ -16,6 +16,8 @@ public interface IModel public abstract class BaseModel : IModel, IDisposable { + protected const string ICON_DEFAULT = "ic_default"; + private bool disposed = false; public static T ParseXml(string xml) where T : BaseModel, new() diff --git a/Billing.Shared/Models/Billing.cs b/Billing.Shared/Models/Billing.cs index 0b38869..2dbc676 100644 --- a/Billing.Shared/Models/Billing.cs +++ b/Billing.Shared/Models/Billing.cs @@ -8,6 +8,7 @@ public class Billing : BaseModel public decimal Amount { get; set; } public string Name { get; set; } public int CategoryId { get; set; } + public int WalletId { get; set; } public string Store { get; set; } public DateTime CreateTime { get; set; } @@ -16,6 +17,7 @@ public class Billing : BaseModel Amount = Read(node, nameof(Amount), 0m); Name = Read(node, nameof(Name), string.Empty); CategoryId = Read(node, nameof(CategoryId), -1); + WalletId = Read(node, nameof(WalletId), -1); Store = Read(node, nameof(Store), string.Empty); CreateTime = Read(node, nameof(CreateTime), default(DateTime)); } @@ -25,6 +27,7 @@ public class Billing : BaseModel Write(node, nameof(Amount), Amount); Write(node, nameof(Name), Name); Write(node, nameof(CategoryId), CategoryId); + Write(node, nameof(WalletId), WalletId); Write(node, nameof(Store), Store); Write(node, nameof(CreateTime), CreateTime); } diff --git a/Billing.Shared/Models/Category.cs b/Billing.Shared/Models/Category.cs index 213aa1b..b6d44d3 100644 --- a/Billing.Shared/Models/Category.cs +++ b/Billing.Shared/Models/Category.cs @@ -5,12 +5,14 @@ namespace Billing.Models; public class Category : BaseModel { public int Id { get; set; } + public string Icon { get; set; } = ICON_DEFAULT; public string Name { get; set; } public int? ParentId { get; set; } public override void OnXmlDeserialize(XElement node) { Id = Read(node, nameof(Id), 0); + Icon = Read(node, nameof(Icon), ICON_DEFAULT); Name = Read(node, nameof(Name), string.Empty); var parentId = Read(node, nameof(ParentId), -1); if (parentId >= 0) @@ -22,6 +24,7 @@ public class Category : BaseModel public override void OnXmlSerialize(XElement node) { Write(node, nameof(Id), Id); + Write(node, nameof(Icon), Icon); Write(node, nameof(Name), Name); if (ParentId != null) { diff --git a/Billing.Shared/Themes/BaseTheme.cs b/Billing.Shared/Themes/BaseTheme.cs index ccf8bc5..13b9baf 100644 --- a/Billing.Shared/Themes/BaseTheme.cs +++ b/Billing.Shared/Themes/BaseTheme.cs @@ -9,7 +9,9 @@ public abstract class BaseTheme : ResourceDictionary public const string CascadiaFontBold = nameof(CascadiaFontBold); public const string RobotoCondensedFontRegular = nameof(RobotoCondensedFontRegular); public const string RobotoCondensedFontBold = nameof(RobotoCondensedFontBold); + public const string WindowBackgroundColor = nameof(WindowBackgroundColor); + public const string OptionTintColor = nameof(OptionTintColor); public const string PromptBackgroundColor = nameof(PromptBackgroundColor); public const string PrimaryColor = nameof(PrimaryColor); public const string SecondaryColor = nameof(SecondaryColor); @@ -18,7 +20,8 @@ public abstract class BaseTheme : ResourceDictionary public const string TabBarUnselectedColor = nameof(TabBarUnselectedColor); public const string OutRangeDayColor = nameof(OutRangeDayColor); public const string TextColor = nameof(TextColor); - public const string WeekendColor = nameof(WeekendColor); + public const string SecondaryTextColor = nameof(SecondaryTextColor); + public const string RedColor = nameof(RedColor); protected abstract Color PrimaryMauiColor { get; } protected abstract Color SecondaryMauiColor { get; } @@ -44,6 +47,14 @@ public abstract class BaseTheme : ResourceDictionary new Setter { Property = Label.FontFamilyProperty, Value = robotoRegularFontFamily } } }); + Add(new Style(typeof(OptionEntry)) + { + Setters = + { + new Setter { Property = Entry.FontSizeProperty, Value = Device.GetNamedSize(NamedSize.Small, typeof(Entry)) }, + new Setter { Property = Entry.FontFamilyProperty, Value = robotoRegularFontFamily } + } + }); Add(new Style(typeof(Button)) { Setters = diff --git a/Billing.Shared/Themes/Dark.cs b/Billing.Shared/Themes/Dark.cs index 4e9f1d4..b99a16f 100644 --- a/Billing.Shared/Themes/Dark.cs +++ b/Billing.Shared/Themes/Dark.cs @@ -1,4 +1,5 @@ -using Xamarin.Forms; +using Billing.UI; +using Xamarin.Forms; namespace Billing.Themes; @@ -20,12 +21,14 @@ public class Dark : BaseTheme private void InitColors() { Add(WindowBackgroundColor, Color.Black); + Add(OptionTintColor, Color.FromRgb(28, 28, 28)); Add(PromptBackgroundColor, Color.FromRgb(0x1f, 0x1f, 0x1f)); Add(TabBarBackgroundColor, Color.Black); Add(TabBarUnselectedColor, Color.FromRgb(0x82, 0x82, 0x82)); Add(OutRangeDayColor, Color.DarkGray); Add(TextColor, Color.FromRgb(0xcc, 0xcc, 0xcc)); - Add(WeekendColor, Color.FromRgb(211, 5, 5)); + Add(SecondaryTextColor, Color.LightGray); + Add(RedColor, Color.FromRgb(211, 5, 5)); Add(new Style(typeof(TabBar)) { @@ -36,5 +39,12 @@ public class Dark : BaseTheme new Setter { Property = Shell.TabBarUnselectedColorProperty, Value = Color.FromRgb(0x82, 0x82, 0x82) } } }); + Add(new Style(typeof(TableView)) + { + Setters = + { + new Setter { Property = VisualElement.BackgroundColorProperty, Value = Color.Black } + } + }); } } diff --git a/Billing.Shared/Themes/Light.cs b/Billing.Shared/Themes/Light.cs index 4684a0e..d05b3a7 100644 --- a/Billing.Shared/Themes/Light.cs +++ b/Billing.Shared/Themes/Light.cs @@ -1,4 +1,5 @@ -using Xamarin.Forms; +using Billing.UI; +using Xamarin.Forms; namespace Billing.Themes; @@ -20,12 +21,14 @@ public class Light : BaseTheme private void InitColors() { Add(WindowBackgroundColor, Color.White); + Add(OptionTintColor, Color.White); Add(PromptBackgroundColor, Color.FromRgb(0xe0, 0xe0, 0xe0)); Add(TabBarBackgroundColor, Color.White); Add(TabBarUnselectedColor, Color.FromRgb(0x82, 0x82, 0x82)); Add(OutRangeDayColor, Color.LightGray); Add(TextColor, Color.FromRgb(0x33, 0x33, 0x33)); - Add(WeekendColor, Color.FromRgb(211, 64, 85)); + Add(SecondaryTextColor, Color.DimGray); + Add(RedColor, Color.FromRgb(211, 64, 85)); Add(new Style(typeof(TabBar)) { @@ -36,5 +39,12 @@ public class Light : BaseTheme new Setter { Property = Shell.TabBarUnselectedColorProperty, Value = Color.FromRgb(0x82, 0x82, 0x82) } } }); + Add(new Style(typeof(TableView)) + { + Setters = + { + new Setter { Property = VisualElement.BackgroundColorProperty, Value = Color.FromRgb(242, 241, 245) } + } + }); } } diff --git a/Billing.Shared/UI/BillingDate.xaml b/Billing.Shared/UI/BillingDate.xaml index 4136f90..385ceeb 100644 --- a/Billing.Shared/UI/BillingDate.xaml +++ b/Billing.Shared/UI/BillingDate.xaml @@ -37,7 +37,7 @@