language version degraded to 9.0

This commit is contained in:
2022-02-25 13:38:42 +08:00
parent 9a6011c3d8
commit e012110b00
32 changed files with 1287 additions and 1262 deletions

View File

@ -1,44 +1,44 @@
using Billing.UI;
using System;
using Xamarin.Forms;
namespace Billing.Views;
public partial class AccountPage : BillingPage
namespace Billing.Views
{
private static readonly BindableProperty BalanceProperty = BindableProperty.Create(nameof(Balance), typeof(decimal), typeof(AccountPage));
private static readonly BindableProperty AssetProperty = BindableProperty.Create(nameof(Asset), typeof(decimal), typeof(AccountPage));
private static readonly BindableProperty LiabilityProperty = BindableProperty.Create(nameof(Liability), typeof(decimal), typeof(AccountPage));
public decimal Balance => (decimal)GetValue(BalanceProperty);
public decimal Asset => (decimal)GetValue(AssetProperty);
public decimal Liability => (decimal)GetValue(LiabilityProperty);
public Command AddAccount { get; }
public AccountPage()
public partial class AccountPage : BillingPage
{
AddAccount = new Command(OnAddAccount);
private static readonly BindableProperty BalanceProperty = BindableProperty.Create(nameof(Balance), typeof(decimal), typeof(AccountPage));
private static readonly BindableProperty AssetProperty = BindableProperty.Create(nameof(Asset), typeof(decimal), typeof(AccountPage));
private static readonly BindableProperty LiabilityProperty = BindableProperty.Create(nameof(Liability), typeof(decimal), typeof(AccountPage));
InitializeComponent();
}
public decimal Balance => (decimal)GetValue(BalanceProperty);
public decimal Asset => (decimal)GetValue(AssetProperty);
public decimal Liability => (decimal)GetValue(LiabilityProperty);
private async void OnAddAccount()
{
if (Tap.IsBusy)
public Command AddAccount { get; }
public AccountPage()
{
return;
AddAccount = new Command(OnAddAccount);
InitializeComponent();
}
using (Tap.Start())
private async void OnAddAccount()
{
var page = new AddAccountPage();
page.AccountChecked += AccountChecked;
await Navigation.PushAsync(page);
if (Tap.IsBusy)
{
return;
}
using (Tap.Start())
{
var page = new AddAccountPage();
page.AccountChecked += AccountChecked;
await Navigation.PushAsync(page);
}
}
private void AccountChecked(object sender, AccountEventArgs e)
{
Helper.Debug(e.Account.ToString());
}
}
private void AccountChecked(object sender, AccountEventArgs e)
{
Helper.Debug(e.Account.ToString());
}
}
}

View File

@ -3,84 +3,85 @@ using Billing.UI;
using System;
using Xamarin.Forms;
namespace Billing.Views;
public partial class AddAccountPage : BillingPage
namespace Billing.Views
{
private static readonly BindableProperty AccountNameProperty = BindableProperty.Create(nameof(AccountName), typeof(string), typeof(AddAccountPage));
private static readonly BindableProperty AccountIconProperty = BindableProperty.Create(nameof(AccountIcon), typeof(string), typeof(AddAccountPage));
private static readonly BindableProperty CategoryProperty = BindableProperty.Create(nameof(Category), typeof(string), typeof(AddAccountPage));
private static readonly BindableProperty BalanceProperty = BindableProperty.Create(nameof(Balance), typeof(decimal), typeof(AddAccountPage));
private static readonly BindableProperty MemoProperty = BindableProperty.Create(nameof(Memo), typeof(string), typeof(AddAccountPage));
public partial class AddAccountPage : BillingPage
{
private static readonly BindableProperty AccountNameProperty = BindableProperty.Create(nameof(AccountName), typeof(string), typeof(AddAccountPage));
private static readonly BindableProperty AccountIconProperty = BindableProperty.Create(nameof(AccountIcon), typeof(string), typeof(AddAccountPage));
private static readonly BindableProperty CategoryProperty = BindableProperty.Create(nameof(Category), typeof(string), typeof(AddAccountPage));
private static readonly BindableProperty BalanceProperty = BindableProperty.Create(nameof(Balance), typeof(decimal), typeof(AddAccountPage));
private static readonly BindableProperty MemoProperty = BindableProperty.Create(nameof(Memo), typeof(string), typeof(AddAccountPage));
public string AccountName
{
get => (string)GetValue(AccountNameProperty);
set => SetValue(AccountNameProperty, value);
}
public string AccountIcon
{
get => (string)GetValue(AccountIconProperty);
set => SetValue(AccountIconProperty, value);
}
public string Category
{
get => (string)GetValue(CategoryProperty);
set => SetValue(CategoryProperty, value);
}
public decimal Balance
{
get => (decimal)GetValue(BalanceProperty);
set => SetValue(BalanceProperty, value);
}
public string Memo
{
get => (string)GetValue(MemoProperty);
set => SetValue(MemoProperty, value);
}
private readonly Account account;
public Command CheckAccount { get; }
public event EventHandler<AccountEventArgs> AccountChecked;
public AddAccountPage()
{
CheckAccount = new Command(OnCheckAccount);
InitializeComponent();
}
public AddAccountPage(Account account)
{
this.account = account;
AccountName = account.Name;
AccountIcon = account.Icon;
Category = account.Category.ToString();
Balance = account.Balance;
Memo = account.Memo;
CheckAccount = new Command(OnCheckAccount);
InitializeComponent();
}
private void OnCheckAccount()
{
AccountChecked?.Invoke(this, new AccountEventArgs
public string AccountName
{
Account = new Account
{
Id = account?.Id ?? -1,
Name = AccountName,
Icon = AccountIcon,
//Category = Category,
Balance = Balance,
Memo = Memo
}
});
}
}
get => (string)GetValue(AccountNameProperty);
set => SetValue(AccountNameProperty, value);
}
public string AccountIcon
{
get => (string)GetValue(AccountIconProperty);
set => SetValue(AccountIconProperty, value);
}
public string Category
{
get => (string)GetValue(CategoryProperty);
set => SetValue(CategoryProperty, value);
}
public decimal Balance
{
get => (decimal)GetValue(BalanceProperty);
set => SetValue(BalanceProperty, value);
}
public string Memo
{
get => (string)GetValue(MemoProperty);
set => SetValue(MemoProperty, value);
}
public class AccountEventArgs : EventArgs
{
public Account Account { get; set; }
}
private readonly Account account;
public Command CheckAccount { get; }
public event EventHandler<AccountEventArgs> AccountChecked;
public AddAccountPage()
{
CheckAccount = new Command(OnCheckAccount);
InitializeComponent();
}
public AddAccountPage(Account account)
{
this.account = account;
AccountName = account.Name;
AccountIcon = account.Icon;
Category = account.Category.ToString();
Balance = account.Balance;
Memo = account.Memo;
CheckAccount = new Command(OnCheckAccount);
InitializeComponent();
}
private void OnCheckAccount()
{
AccountChecked?.Invoke(this, new AccountEventArgs
{
Account = new Account
{
Id = account?.Id ?? -1,
Name = AccountName,
Icon = AccountIcon,
//Category = Category,
Balance = Balance,
Memo = Memo
}
});
}
}
public class AccountEventArgs : EventArgs
{
public Account Account { get; set; }
}
}

View File

@ -1,11 +1,12 @@
using Billing.UI;
namespace Billing.Views;
public partial class AddBillPage : BillingPage
namespace Billing.Views
{
public AddBillPage()
public partial class AddBillPage : BillingPage
{
InitializeComponent();
public AddBillPage()
{
InitializeComponent();
}
}
}
}

View File

@ -2,43 +2,44 @@ using Billing.UI;
using System;
using Xamarin.Forms;
namespace Billing.Views;
public partial class BillPage : BillingPage
namespace Billing.Views
{
private static readonly BindableProperty SelectedDateProperty = BindableProperty.Create(nameof(SelectedDate), typeof(DateTime), typeof(BillPage));
public DateTime SelectedDate
public partial class BillPage : BillingPage
{
get => (DateTime)GetValue(SelectedDateProperty);
set => SetValue(SelectedDateProperty, value);
private static readonly BindableProperty SelectedDateProperty = BindableProperty.Create(nameof(SelectedDate), typeof(DateTime), typeof(BillPage));
public DateTime SelectedDate
{
get => (DateTime)GetValue(SelectedDateProperty);
set => SetValue(SelectedDateProperty, value);
}
public Command AddBilling { get; }
public BillPage()
{
AddBilling = new Command(OnAddBilling);
InitializeComponent();
billingDate.SetDateTime(DateTime.Now);
}
private void OnDateSelected(object sender, DateEventArgs e)
{
SelectedDate = e.Date;
// TODO: while selecting date
}
private void OnTitleDateLongPressed(object sender, EventArgs e)
{
billingDate.SetDateTime(DateTime.Now);
}
private async void OnAddBilling()
{
await Navigation.PushAsync(new AddBillPage());
}
}
public Command AddBilling { get; }
public BillPage()
{
AddBilling = new Command(OnAddBilling);
InitializeComponent();
billingDate.SetDateTime(DateTime.Now);
}
private void OnDateSelected(object sender, DateEventArgs e)
{
SelectedDate = e.Date;
// TODO: while selecting date
}
private void OnTitleDateLongPressed(object sender, EventArgs e)
{
billingDate.SetDateTime(DateTime.Now);
}
private async void OnAddBilling()
{
await Navigation.PushAsync(new AddBillPage());
}
}
}

View File

@ -1,11 +1,12 @@
using Billing.UI;
namespace Billing.Views;
public partial class SettingPage : BillingPage
namespace Billing.Views
{
public SettingPage()
public partial class SettingPage : BillingPage
{
InitializeComponent();
public SettingPage()
{
InitializeComponent();
}
}
}
}