add map view page
This commit is contained in:
@ -60,6 +60,7 @@ namespace Billing.Views
|
||||
|
||||
public Command SelectCategory { get; }
|
||||
public Command SelectWallet { get; }
|
||||
public Command ViewLocation { get; }
|
||||
|
||||
public event EventHandler<Bill> BillChecked;
|
||||
|
||||
@ -76,6 +77,7 @@ namespace Billing.Views
|
||||
createDate = date;
|
||||
SelectCategory = new Command(OnSelectCategory);
|
||||
SelectWallet = new Command(OnSelectWallet);
|
||||
ViewLocation = new Command(() => { }, () => false);
|
||||
InitializeComponent();
|
||||
Title = Resource.AddBill;
|
||||
|
||||
@ -86,7 +88,12 @@ namespace Billing.Views
|
||||
{
|
||||
this.bill = bill;
|
||||
SelectCategory = new Command(OnSelectCategory);
|
||||
SelectWallet = new Command(OnSelectWallet);
|
||||
SelectWallet = new Command(OnSelectWallet);
|
||||
#if __ANDROID__
|
||||
ViewLocation = new Command(() => { }, () => false);
|
||||
#else
|
||||
ViewLocation = new Command(OnViewLocation, () => bill != null && bill.Latitude != null && bill.Longitude != null);
|
||||
#endif
|
||||
InitializeComponent();
|
||||
Title = Resource.EditBill;
|
||||
|
||||
@ -129,7 +136,7 @@ namespace Billing.Views
|
||||
{
|
||||
editorAmount.SetFocus();
|
||||
|
||||
if (App.SaveLocation)
|
||||
if (bill == null && App.SaveLocation)
|
||||
{
|
||||
_ = GetCurrentLocation();
|
||||
}
|
||||
@ -280,5 +287,22 @@ namespace Billing.Views
|
||||
{
|
||||
SetValue(WalletProperty, account);
|
||||
}
|
||||
|
||||
private async void OnViewLocation()
|
||||
{
|
||||
if (bill == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (Tap.IsBusy)
|
||||
{
|
||||
return;
|
||||
}
|
||||
using (Tap.Start())
|
||||
{
|
||||
var page = new ViewLocationPage(bill);
|
||||
await Navigation.PushAsync(page);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user