Billing/Billing.Shared/Views/ViewLocationPage.xaml.cs
2022-03-18 00:17:40 +08:00

31 lines
860 B
C#

using Billing.Models;
using Billing.UI;
using Xamarin.Forms.Maps;
namespace Billing.Views
{
public partial class ViewLocationPage : BillingPage
{
//private readonly Bill bill;
public ViewLocationPage(Bill bill)
{
//this.bill = bill;
Title = bill.Name;
InitializeComponent();
if (bill.Latitude != null && bill.Longitude != null)
{
var address = $"({bill.Latitude}, {bill.Longitude})";
map.Pins.Add(new Pin
{
Label = string.IsNullOrEmpty(bill.Store) ? address : bill.Store,
Type = PinType.Generic,
Position = new Position(bill.Latitude.Value, bill.Longitude.Value),
Address = address
});
}
}
}
}