add map view page
This commit is contained in:
@ -94,6 +94,10 @@
|
|||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Models\Logs.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Models\Logs.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Views\ViewLocationPage.xaml.cs">
|
||||||
|
<DependentUpon>ViewLocationPage.xaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)MainShell.xaml">
|
<EmbeddedResource Include="$(MSBuildThisFileDirectory)MainShell.xaml">
|
||||||
@ -153,4 +157,9 @@
|
|||||||
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Views\ViewLocationPage.xaml">
|
||||||
|
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -114,4 +114,5 @@
|
|||||||
<ManyRecords>{0} record(s)</ManyRecords>
|
<ManyRecords>{0} record(s)</ManyRecords>
|
||||||
<SendEmail>Send Eamil</SendEmail>
|
<SendEmail>Send Eamil</SendEmail>
|
||||||
<HowToShareDiagnostic>How would you like to share diagnostic logs?</HowToShareDiagnostic>
|
<HowToShareDiagnostic>How would you like to share diagnostic logs?</HowToShareDiagnostic>
|
||||||
|
<ViewLocation>View Location</ViewLocation>
|
||||||
</root>
|
</root>
|
@ -114,4 +114,5 @@
|
|||||||
<ManyRecords>{0} 条记录</ManyRecords>
|
<ManyRecords>{0} 条记录</ManyRecords>
|
||||||
<SendEmail>发送邮件</SendEmail>
|
<SendEmail>发送邮件</SendEmail>
|
||||||
<HowToShareDiagnostic>您想以哪种方式分享诊断日志?</HowToShareDiagnostic>
|
<HowToShareDiagnostic>您想以哪种方式分享诊断日志?</HowToShareDiagnostic>
|
||||||
|
<ViewLocation>查看位置</ViewLocation>
|
||||||
</root>
|
</root>
|
@ -49,6 +49,9 @@
|
|||||||
<ui:OptionEntryCell Height="44" Icon="online.png"
|
<ui:OptionEntryCell Height="44" Icon="online.png"
|
||||||
Title="{r:Text Store}"
|
Title="{r:Text Store}"
|
||||||
Text="{Binding Store, Mode=TwoWay}"/>
|
Text="{Binding Store, Mode=TwoWay}"/>
|
||||||
|
<ui:OptionSelectCell Height="44"
|
||||||
|
Detail="{r:Text ViewLocation}"
|
||||||
|
Command="{Binding ViewLocation}"/>
|
||||||
<ui:OptionDatePickerCell Height="44" Icon="bars.png"
|
<ui:OptionDatePickerCell Height="44" Icon="bars.png"
|
||||||
Title="{r:Text CreatedTime}"
|
Title="{r:Text CreatedTime}"
|
||||||
Date="{Binding CreatedDate, Mode=TwoWay}"/>
|
Date="{Binding CreatedDate, Mode=TwoWay}"/>
|
||||||
|
@ -60,6 +60,7 @@ namespace Billing.Views
|
|||||||
|
|
||||||
public Command SelectCategory { get; }
|
public Command SelectCategory { get; }
|
||||||
public Command SelectWallet { get; }
|
public Command SelectWallet { get; }
|
||||||
|
public Command ViewLocation { get; }
|
||||||
|
|
||||||
public event EventHandler<Bill> BillChecked;
|
public event EventHandler<Bill> BillChecked;
|
||||||
|
|
||||||
@ -76,6 +77,7 @@ namespace Billing.Views
|
|||||||
createDate = date;
|
createDate = date;
|
||||||
SelectCategory = new Command(OnSelectCategory);
|
SelectCategory = new Command(OnSelectCategory);
|
||||||
SelectWallet = new Command(OnSelectWallet);
|
SelectWallet = new Command(OnSelectWallet);
|
||||||
|
ViewLocation = new Command(() => { }, () => false);
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Title = Resource.AddBill;
|
Title = Resource.AddBill;
|
||||||
|
|
||||||
@ -87,6 +89,11 @@ namespace Billing.Views
|
|||||||
this.bill = bill;
|
this.bill = bill;
|
||||||
SelectCategory = new Command(OnSelectCategory);
|
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();
|
InitializeComponent();
|
||||||
Title = Resource.EditBill;
|
Title = Resource.EditBill;
|
||||||
|
|
||||||
@ -129,7 +136,7 @@ namespace Billing.Views
|
|||||||
{
|
{
|
||||||
editorAmount.SetFocus();
|
editorAmount.SetFocus();
|
||||||
|
|
||||||
if (App.SaveLocation)
|
if (bill == null && App.SaveLocation)
|
||||||
{
|
{
|
||||||
_ = GetCurrentLocation();
|
_ = GetCurrentLocation();
|
||||||
}
|
}
|
||||||
@ -280,5 +287,22 @@ namespace Billing.Views
|
|||||||
{
|
{
|
||||||
SetValue(WalletProperty, account);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
15
Billing.Shared/Views/ViewLocationPage.xaml
Normal file
15
Billing.Shared/Views/ViewLocationPage.xaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ui:BillingPage xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
xmlns:ui="clr-namespace:Billing.UI"
|
||||||
|
xmlns:v="clr-namespace:Billing.Views"
|
||||||
|
xmlns:maps="clr-namespace:Xamarin.Forms.Maps;assembly=Xamarin.Forms.Maps"
|
||||||
|
x:Class="Billing.Views.ViewLocationPage"
|
||||||
|
x:Name="viewLocationPage"
|
||||||
|
x:DataType="v:ViewLocationPage"
|
||||||
|
BindingContext="{x:Reference viewLocationPage}">
|
||||||
|
<ContentPage.Content>
|
||||||
|
<maps:Map x:Name="map" IsShowingUser="False"
|
||||||
|
MoveToLastRegionOnLayoutChange="False"/>
|
||||||
|
</ContentPage.Content>
|
||||||
|
</ui:BillingPage>
|
31
Billing.Shared/Views/ViewLocationPage.xaml.cs
Normal file
31
Billing.Shared/Views/ViewLocationPage.xaml.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -71,9 +71,10 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microcharts.Forms" Version="0.9.5.9" />
|
<PackageReference Include="Microcharts.Forms" Version="0.9.5.9" />
|
||||||
<PackageReference Include="SkiaSharp.Views.Forms" Version="2.80.3" />
|
<PackageReference Include="SkiaSharp.Views.Forms" Version="2.80.3" />
|
||||||
|
<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
|
||||||
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2337" />
|
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2337" />
|
||||||
<PackageReference Include="Xamarin.Essentials" Version="1.7.1" />
|
<PackageReference Include="Xamarin.Essentials" Version="1.7.1" />
|
||||||
<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
|
<PackageReference Include="Xamarin.Forms.Maps" Version="5.0.0.2337" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Definition.cs" />
|
<Compile Include="Definition.cs" />
|
||||||
|
12729
Billing/Billing.Android/Resources/Resource.designer.cs
generated
12729
Billing/Billing.Android/Resources/Resource.designer.cs
generated
File diff suppressed because it is too large
Load Diff
@ -180,6 +180,7 @@
|
|||||||
<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
|
<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
|
||||||
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2337" />
|
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2337" />
|
||||||
<PackageReference Include="Xamarin.Essentials" Version="1.7.1" />
|
<PackageReference Include="Xamarin.Essentials" Version="1.7.1" />
|
||||||
|
<PackageReference Include="Xamarin.Forms.Maps" Version="5.0.0.2337" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<BundleResource Include="Resources\dollar.png" />
|
<BundleResource Include="Resources\dollar.png" />
|
||||||
|
Reference in New Issue
Block a user