refactoring

This commit is contained in:
2017-03-03 00:13:15 +01:00
parent 2eea42ae57
commit 4340ace933
6 changed files with 111 additions and 55 deletions

View File

@ -12,8 +12,8 @@ namespace ZicMoove.Pages
{
public class PinPage : ContentPage
{
Map map;
protected Map map;
protected async Task<Plugin.Geolocator.Abstractions.Position> GetPos() {
var locator = CrossGeolocator.Current;
locator.DesiredAccuracy = 50;
@ -39,8 +39,35 @@ namespace ZicMoove.Pages
{
base.OnAppearing ();
}
protected virtual void OnInitMap ()
{
double lat = 0;
double lon = 0;
int pc = 0;
foreach (var query in DataManager.Instance.BookQueries)
{
var pin = new Pin
{
Type = PinType.Generic,
Position = new Xamarin.Forms.Maps.Position(
query.Location.Latitude, query.Location.Longitude),
Label = query.Reason,
Address = query.Location.Address
};
pin.BindingContext = query;
map.Pins.Add(pin);
// TODO find a true solution :-/
lat = (lat * pc + query.Location.Latitude) / (pc + 1);
lon = (lon * pc + query.Location.Longitude) / (pc + 1);
pc++;
}
// TODO build a MapSpan covering events
map.MoveToRegion(MapSpan.FromCenterAndRadius(
new Xamarin.Forms.Maps.Position(lat, lon), Distance.FromMeters(100)));
public PinPage ()
}
public PinPage ()
{
map = new Map {
@ -50,29 +77,8 @@ namespace ZicMoove.Pages
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand
};
double lat=0;
double lon=0;
int pc = 0;
foreach (var query in DataManager.Instance.BookQueries)
{
var pin = new Pin {
Type = PinType.SearchResult,
Position = new Xamarin.Forms.Maps.Position(
query.Location.Latitude, query.Location.Longitude),
Label = query.Reason,
Address = query.Location.Address
};
pin.BindingContext = query;
map.Pins.Add (pin);
// TODO find a true solution
lat = (lat * pc + query.Location.Latitude) / (pc + 1);
lon = (lon * pc + query.Location.Longitude) / (pc + 1);
pc++;
}
// TODO build a MapSpan covering events
map.MoveToRegion(MapSpan.FromCenterAndRadius (
new Xamarin.Forms.Maps.Position(lat,lon), Distance.FromMeters(100)));
/*
OnInitMap();
/*
// A "relocate" button : useless, since it yet exists
var reLocate = new Button { Text = "Re-centrer" };
@ -89,10 +95,10 @@ namespace ZicMoove.Pages
}
};
*/
// create map style buttons
var street = new Button { Text = "Street" };
var hybrid = new Button { Text = "Hybrid" };
var satellite = new Button { Text = "Satellite" };
// create map style buttons
var street = new Button { Text = Strings.Street };
var hybrid = new Button { Text = Strings.Hybrid };
var satellite = new Button { Text = Strings.Satellite };
street.Clicked += HandleMapStyleClicked;
hybrid.Clicked += HandleMapStyleClicked;
@ -111,21 +117,21 @@ namespace ZicMoove.Pages
segments
}};
}
protected StackLayout StackLayout
{ get
{
return Content as StackLayout;
} }
void HandleMapStyleClicked (object sender, EventArgs e)
void HandleMapStyleClicked (object sender, EventArgs e)
{
var b = sender as Button;
switch (b.Text) {
case "Street":
if (b.Text== Strings.Street)
map.MapType = MapType.Street;
break;
case "Hybrid":
map.MapType = MapType.Hybrid;
break;
case "Satellite":
map.MapType = MapType.Satellite;
break;
}
else if (b.Text == Strings.Hybrid)
map.MapType = MapType.Hybrid;
else if (b.Text == Strings.Satellite)
map.MapType = MapType.Satellite;
}
}
}

View File

@ -10,7 +10,7 @@ using Plugin.Geolocator;
namespace ZicMoove.Pages.ClientPages
{
public class WorkflowBookPage : PinPage
public class DatesPage : PinPage
{

View File

@ -0,0 +1,20 @@
using ZicMoove.Model.Social;
using System;
using Xamarin.Forms;
using Xamarin.Forms.Maps;
using Yavsc;
using ZicMoove.Data;
using System.Threading.Tasks;
using XLabs.Platform.Services.Geolocation;
using Plugin.Geolocator;
namespace ZicMoove.Pages.ClientPages
{
public class ProfilesPage : PinPage
{
}
}

View File

@ -232,6 +232,15 @@ namespace ZicMoove {
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Hybride.
/// </summary>
public static string Hybrid {
get {
return ResourceManager.GetString("Hybrid", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Valeur invalide.
/// </summary>
@ -331,6 +340,15 @@ namespace ZicMoove {
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Satellite.
/// </summary>
public static string Satellite {
get {
return ResourceManager.GetString("Satellite", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Rechercher un artiste.
/// </summary>
@ -358,6 +376,15 @@ namespace ZicMoove {
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Rue.
/// </summary>
public static string Street {
get {
return ResourceManager.GetString("Street", resourceCulture);
}
}
/// <summary>
/// Recherche une chaîne localisée semblable à Incontournable.
/// </summary>

View File

@ -239,4 +239,13 @@
<data name="EstimateSigningPrompt" xml:space="preserve">
<value>Signez ici</value>
</data>
<data name="Hybrid" xml:space="preserve">
<value>Hybride</value>
</data>
<data name="Satellite" xml:space="preserve">
<value>Satellite</value>
</data>
<data name="Street" xml:space="preserve">
<value>Rue</value>
</data>
</root>

View File

@ -110,7 +110,8 @@
<Compile Include="Pages\ClientPages\ActivityPage.xaml.cs">
<DependentUpon>ActivityPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\ClientPages\Workflow\WFBookPage.cs" />
<Compile Include="Pages\Workflow\WorkflowProfilesPage.cs" />
<Compile Include="Pages\Workflow\WorkflowDatesPage.cs" />
<Compile Include="Pages\ClientPages\SearchPage.xaml.cs">
<DependentUpon>SearchPage.xaml</DependentUpon>
</Compile>
@ -153,9 +154,6 @@
<DependentUpon>Strings.en.resx</DependentUpon>
</Compile>
<Compile Include="ViewModels\Validation\EditingViewModel.cs" />
<Compile Include="Pages\DocSigning.xaml.cs">
<DependentUpon>DocSigning.xaml</DependentUpon>
</Compile>
<Compile Include="ViewModels\Signing\EstimateSigningViewModel.cs" />
<Compile Include="ViewModels\Signing\SignaturePadConfigViewModel.cs" />
<Compile Include="ViewModels\UserProfile\UserProfileViewModel.cs" />
@ -205,7 +203,7 @@
<Compile Include="Pages\UserProfile\DashboardPage.xaml.cs">
<DependentUpon>DashboardPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\Oooops\EventDetail.xaml.cs">
<Compile Include="Pages\EventDetail.xaml.cs">
<DependentUpon>EventDetail.xaml</DependentUpon>
</Compile>
<Compile Include="Settings\MainSettings.cs" />
@ -297,7 +295,7 @@
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pages\Oooops\EventDetail.xaml">
<EmbeddedResource Include="Pages\EventDetail.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
<SubType>Designer</SubType>
</EmbeddedResource>
@ -306,7 +304,9 @@
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Folder Include="Pages\Oooops\" />
</ItemGroup>
<ItemGroup>
<Reference Include="ExifLib, Version=1.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\ExifLib.PCL.1.0.1\lib\portable-net45+sl50+win+WindowsPhoneApp81+wp80+Xamarin.iOS10+MonoAndroid10+MonoTouch10\ExifLib.dll</HintPath>
@ -538,12 +538,6 @@
<EmbeddedResource Include="Images\Chat\disconnected.png" />
<EmbeddedResource Include="Images\Chat\reconnecting.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Pages\DocSigning.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Views\MDSigningView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>