An enhancement to deal with the iOS simulator not supporting calls, messaging, or email composition.

This commit is contained in:
Joe Sauve 2016-01-12 16:56:25 -06:00
Родитель f19f53da80
Коммит 3cb12f61d9
16 изменённых файлов: 556 добавлений и 78 удалений

Просмотреть файл

@ -10,7 +10,7 @@ namespace Customers
navPage.BarTextColor = Color.White;
customerListPage.BindingContext = new CustomerListViewModel() { Navigation = navPage.Navigation }; // set the context for the customer list page to a new instance of CustomerListViewModel, giving it the same Navigation instance as the navigation page.
customerListPage.BindingContext = new CustomerListViewModel() { Navigation = navPage.Navigation, Page = customerListPage }; // set the context for the customer list page to a new instance of CustomerListViewModel, giving it the same Navigation instance as the navigation page.
}
}
}

Просмотреть файл

@ -53,6 +53,9 @@
<DependentUpon>CustomerDetailPage.xaml</DependentUpon>
</Compile>
<Compile Include="Extensions\StringExtensions.cs" />
<Compile Include="Services\IEnvironmentService.cs" />
<Compile Include="Services\ICapabilityService.cs" />
<Compile Include="Services\CapabilityService.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\packages\Xamarin.Forms.2.0.0.6490\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.2.0.0.6490\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
@ -136,5 +139,6 @@
<Folder Include="Data\" />
<Folder Include="Converters\" />
<Folder Include="Extensions\" />
<Folder Include="Services\" />
</ItemGroup>
</Project>

Просмотреть файл

@ -27,18 +27,30 @@ namespace Customers
public string PhotoUrl { get; set; }
public string SmallPhotoUrl { get { return PhotoUrl; }}
string _AddressString;
[JsonIgnore]
public string AddressString
{
get
{
return string.Format(
"{0}{1} {2} {3} {4}",
Street,
!string.IsNullOrWhiteSpace(Unit) ? " " + Unit + "," : string.Empty + ",",
!string.IsNullOrWhiteSpace(City) ? City + "," : string.Empty,
State,
PostalCode);
if (String.IsNullOrWhiteSpace(_AddressString))
{
var s = string.Format(
"{0}{1} {2} {3} {4}",
Street,
!string.IsNullOrWhiteSpace(Unit) ? " " + Unit + "," : string.Empty + ",",
!string.IsNullOrWhiteSpace(City) ? City + "," : string.Empty,
State,
PostalCode);
_AddressString = s;
}
return _AddressString;
}
set
{
_AddressString = value;
}
}

Просмотреть файл

@ -25,32 +25,35 @@
<ic:CircleImage x:Name="AvatarImage" BorderColor="#547799" BorderThickness="5" WidthRequest="120" HeightRequest="120" Source="{Binding Account.PhotoUrl}" IsVisible="{Binding IsLoading, Source={x:Reference AvatarImage}, Converter={StaticResource BooleanInverter}}" AbsoluteLayout.LayoutFlags="PositionProportional" AbsoluteLayout.LayoutBounds="0.5, 0.5, AutoSize, AutoSize" />
</AbsoluteLayout>
<ContentView Padding="5, 0, 0, 0" Grid.Row="0" Grid.Column="1">
<StackLayout Spacing="0">
<ContentView Padding="0,0,0,10">
<StackLayout Spacing="10">
<ContentView>
<StackLayout Spacing="0">
<Label Text="{Binding Account.Company}" />
<Label Text="{Binding Account.JobTitle}" FontSize="Small" TextColor="Silver" />
</StackLayout>
</ContentView>
<ContentView Padding="0,0,0,10" IsEnabled="{Binding HasAddress}" IsVisible="{Binding HasAddress}">
<AbsoluteLayout>
<ContentView Padding="0, 0, 10, 0" AbsoluteLayout.LayoutFlags="XProportional" AbsoluteLayout.LayoutBounds="0,0,AutoSize,AutoSize">
<StackLayout Spacing="0">
<Label Text="{Binding Account.Street}" FontSize="Small" />
<Label Text="{Binding Account.City}" FontSize="Micro" />
<Label Text="{Binding Account.StatePostal}" FontSize="Micro" />
</StackLayout>
</ContentView>
<Image Source="directions" Aspect="AspectFit" HeightRequest="26" WidthRequest="26" AbsoluteLayout.LayoutFlags="PositionProportional" AbsoluteLayout.LayoutBounds="1,0,AutoSize,Autosize">
<Image.GestureRecognizers>
<TapGestureRecognizer Command="{Binding GetDirectionsCommand}" />
</Image.GestureRecognizers>
</Image>
</AbsoluteLayout>
<ContentView IsEnabled="{Binding HasAddress}" IsVisible="{Binding HasAddress}">
<StackLayout>
<AbsoluteLayout>
<ContentView Padding="0, 0, 10, 0" AbsoluteLayout.LayoutFlags="XProportional" AbsoluteLayout.LayoutBounds="0,0,AutoSize,AutoSize">
<StackLayout Spacing="0">
<Label Text="{Binding Account.Street}" FontSize="Small" />
<Label Text="{Binding Account.City}" FontSize="Micro" />
<Label Text="{Binding Account.StatePostal}" FontSize="Micro" />
</StackLayout>
</ContentView>
<Image Source="directions" Aspect="AspectFit" HeightRequest="26" WidthRequest="26" AbsoluteLayout.LayoutFlags="PositionProportional" AbsoluteLayout.LayoutBounds="1,0.5,AutoSize,Autosize">
<Image.GestureRecognizers>
<TapGestureRecognizer Command="{Binding GetDirectionsCommand}" />
</Image.GestureRecognizers>
</Image>
</AbsoluteLayout>
</StackLayout>
</ContentView>
<ContentView Padding="0,0,0,15" IsEnabled="{Binding HasPhoneNumber}" IsVisible="{Binding HasPhoneNumber}">
<ContentView HeightRequest="1" BackgroundColor="Silver" />
<ContentView IsEnabled="{Binding HasPhoneNumber}" IsVisible="{Binding HasPhoneNumber}">
<AbsoluteLayout>
<Label Text="{Binding Account.Phone}" FontSize="Small" VerticalTextAlignment="Center" AbsoluteLayout.LayoutFlags="XProportional" AbsoluteLayout.LayoutBounds="0,0,AutoSize,AutoSize" />
<Label Text="{Binding Account.Phone}" FontSize="Small" HeightRequest="20" VerticalTextAlignment="Center" AbsoluteLayout.LayoutFlags="XProportional" AbsoluteLayout.LayoutBounds="0,0,AutoSize,AutoSize" />
<StackLayout Orientation="Horizontal" Spacing="0" AbsoluteLayout.LayoutFlags="XProportional,HeightProportional" AbsoluteLayout.LayoutBounds="1,0,AutoSize,1">
<Image Source="message" Aspect="AspectFit" HeightRequest="20" WidthRequest="20">
<Image.GestureRecognizers>
@ -67,10 +70,11 @@
</StackLayout>
</AbsoluteLayout>
</ContentView>
<ContentView HeightRequest="1" BackgroundColor="Silver" />
<ContentView IsEnabled="{Binding HasEmailAddress}" IsVisible="{Binding HasEmailAddress}">
<AbsoluteLayout>
<ContentView Padding="0,0,30,0">
<Label Text="{Binding Account.Email}" FontSize="Micro" VerticalTextAlignment="Center" AbsoluteLayout.LayoutFlags="XProportional" AbsoluteLayout.LayoutBounds="0,0,AutoSize,AutoSize" />
<ContentView Padding="0">
<Label Text="{Binding Account.Email}" FontSize="Micro" HeightRequest="20" VerticalTextAlignment="Center" AbsoluteLayout.LayoutFlags="XProportional" AbsoluteLayout.LayoutBounds="0,0,AutoSize,AutoSize" />
</ContentView>
<Image Source="email" Aspect="AspectFit" HeightRequest="20" WidthRequest="20" AbsoluteLayout.LayoutFlags="XProportional,HeightProportional" AbsoluteLayout.LayoutBounds="1,0,AutoSize,1">
<Image.GestureRecognizers>

Просмотреть файл

@ -30,7 +30,7 @@ namespace Customers
Map.IsVisible = false;
// set to a default posiion
Position position = new Position(0, 0);
var position = new Position(0, 0);
try
{

Просмотреть файл

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Customers.CustomerListPage" xmlns:local="clr-namespace:Customers" xmlns:ic="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions">
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Customers.CustomerListPage" xmlns:local="clr-namespace:Customers" xmlns:ic="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions" x:Name="customerListPage">
<ContentPage.Resources>
<ResourceDictionary>
<local:BooleanInverter x:Key="BooleanInverter" />
@ -15,15 +15,19 @@
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell StyleId="disclosure" Height="60">
<ViewCell.ContextActions>
<MenuItem Text="Email" Command="{Binding Source={x:Reference customerListPage}, Path=BindingContext.EmailCommand}" CommandParameter="{Binding Id}" />
<MenuItem Text="Text" Command="{Binding Source={x:Reference customerListPage}, Path=BindingContext.MessageNumberCommand}" CommandParameter="{Binding Id}" />
<MenuItem Text="Call" Command="{Binding Source={x:Reference customerListPage}, Path=BindingContext.DialNumberCommand}" CommandParameter="{Binding Id}" />
</ViewCell.ContextActions>
<ContentView Padding="10,0">
<AbsoluteLayout>
<StackLayout Orientation="Horizontal" Spacing="0" AbsoluteLayout.LayoutFlags="XProportional" AbsoluteLayout.LayoutBounds="0,0,AutoSize,AutoSize">
<ContentView Padding="3" WidthRequest="54">
<AbsoluteLayout>
<ActivityIndicator BindingContext="{x:Reference AvatarImage}" IsEnabled="{Binding IsLoading}" IsVisible="{Binding IsLoading}" IsRunning="{Binding IsLoading}" HeightRequest="54" WidthRequest="54" VerticalOptions="Center" HorizontalOptions="Center" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0,0,1,1" />
<ic:CircleImage x:Name="AvatarImage" BorderColor="#547799" BorderThickness="2" HeightRequest="50" WidthRequest="50" VerticalOptions="Center" HorizontalOptions="Center" Source="{Binding SmallPhotoUrl}" IsVisible="{Binding IsLoading, Source={x:Reference AvatarImage}, Converter={StaticResource BooleanInverter}}" AbsoluteLayout.LayoutFlags="PositionProportional" AbsoluteLayout.LayoutBounds="0.5,0.5,AutoSize,AutoSize" />
<ActivityIndicator BindingContext="{x:Reference AvatarImage}" IsEnabled="{Binding IsLoading}" IsVisible="{Binding IsLoading}" IsRunning="{Binding IsLoading}" HeightRequest="54" WidthRequest="54" VerticalOptions="Center" HorizontalOptions="Center" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0,0,1,1" />
<ic:CircleImage x:Name="AvatarImage" BorderColor="#547799" BorderThickness="2" HeightRequest="50" WidthRequest="50" VerticalOptions="Center" HorizontalOptions="Center" Source="{Binding SmallPhotoUrl}" IsVisible="{Binding IsLoading, Source={x:Reference AvatarImage}, Converter={StaticResource BooleanInverter}}" AbsoluteLayout.LayoutFlags="PositionProportional"
AbsoluteLayout.LayoutBounds="0.5,0.5,AutoSize,AutoSize" />
</AbsoluteLayout>
</ContentView>
<ContentView Padding="10,0,0,0">
@ -34,20 +38,13 @@
</StackLayout>
</ContentView>
</StackLayout>
<!-- <Image Source="phone" Aspect="AspectFit" HeightRequest="20" WidthRequest="20" AbsoluteLayout.LayoutFlags="XProportional,HeightProportional" AbsoluteLayout.LayoutBounds="1,0,AutoSize,1">
<Image.GestureRecognizers>
<TapGestureRecognizer Command="{Binding DialNumberCommand}" CommandParameter="{Binding Id}" NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>-->
</AbsoluteLayout>
</ContentView>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.ContextActions>
</ListView.ContextActions>
</ListView>
</OnPlatform.iOS>
<OnPlatform.Android>
@ -57,12 +54,18 @@
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell StyleId="disclosure" Height="60">
<ViewCell.ContextActions>
<MenuItem Text="Email" Command="{Binding Source={x:Reference customerListPage}, Path=BindingContext.EmailCommand}" CommandParameter="{Binding Id}" />
<MenuItem Text="Text" Command="{Binding Source={x:Reference customerListPage}, Path=BindingContext.MessageNumberCommand}" CommandParameter="{Binding Id}" />
<MenuItem Text="Call" Command="{Binding Source={x:Reference customerListPage}, Path=BindingContext.DialNumberCommand}" CommandParameter="{Binding Id}" />
</ViewCell.ContextActions>
<ContentView Padding="10,0">
<StackLayout Orientation="Horizontal" Spacing="0">
<ContentView Padding="3" WidthRequest="54">
<AbsoluteLayout>
<ActivityIndicator IsEnabled="{Binding IsLoading, Source={x:Reference AvatarImage}}" IsVisible="{Binding IsLoading, Source={x:Reference AvatarImage}}" IsRunning="{Binding IsLoading, Source={x:Reference AvatarImage}}" HeightRequest="54" WidthRequest="54" VerticalOptions="Center" HorizontalOptions="Center" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0.5,0.5,1,1" />
<ic:CircleImage x:Name="AvatarImage" BorderColor="#547799" BorderThickness="2" HeightRequest="50" WidthRequest="50" VerticalOptions="Center" HorizontalOptions="Center" Source="{Binding SmallPhotoUrl}" IsVisible="{Binding IsLoading, Source={x:Reference AvatarImage}, Converter={StaticResource BooleanInverter}}" AbsoluteLayout.LayoutFlags="PositionProportional" AbsoluteLayout.LayoutBounds="0,0,AutoSize,AutoSize" />
<ic:CircleImage x:Name="AvatarImage" BorderColor="#547799" BorderThickness="2" HeightRequest="50" WidthRequest="50" VerticalOptions="Center" HorizontalOptions="Center" Source="{Binding SmallPhotoUrl}" IsVisible="{Binding IsLoading, Source={x:Reference AvatarImage}, Converter={StaticResource BooleanInverter}}" AbsoluteLayout.LayoutFlags="PositionProportional"
AbsoluteLayout.LayoutBounds="0,0,AutoSize,AutoSize" />
</AbsoluteLayout>
</ContentView>
<ContentView Padding="10,0,0,0">

Просмотреть файл

@ -0,0 +1,47 @@
using System;
using Xamarin.Forms;
using Customers;
[assembly: Xamarin.Forms.Dependency (typeof (CapabilityService))]
namespace Customers
{
public class CapabilityService : ICapabilityService
{
readonly IEnvironmentService _EnvironmentService;
public CapabilityService()
{
_EnvironmentService = DependencyService.Get<IEnvironmentService>();
}
#region ICapabilityService implementation
public bool CanMakeCalls
{
get
{
return _EnvironmentService.IsRealDevice || (Device.OS != TargetPlatform.iOS);
}
}
public bool CanSendMessages
{
get
{
return _EnvironmentService.IsRealDevice || (Device.OS != TargetPlatform.iOS);
}
}
public bool CanSendEmail
{
get
{
return _EnvironmentService.IsRealDevice || (Device.OS != TargetPlatform.iOS);
}
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,12 @@
using System;
namespace Customers
{
public interface ICapabilityService
{
bool CanMakeCalls { get; }
bool CanSendMessages { get; }
bool CanSendEmail { get; }
}
}

Просмотреть файл

@ -0,0 +1,10 @@
using System;
namespace Customers
{
public interface IEnvironmentService
{
bool IsRealDevice { get; }
}
}

Просмотреть файл

@ -13,10 +13,15 @@ namespace Customers
{
bool _IsNewCustomer;
// this is just a utility service that we're using in this demo app to mitigate some limitations of the iOS simulator
ICapabilityService _CapabilityService;
readonly Geocoder _Geocoder;
public CustomerDetailViewModel(Customer account = null)
{
_CapabilityService = DependencyService.Get<ICapabilityService>();
_Geocoder = new Geocoder();
if (account == null)
@ -200,18 +205,21 @@ namespace Customers
async Task ExecuteDialNumberCommand()
{
if (String.IsNullOrWhiteSpace(Account.Phone))
return;
return;
if (await Page.DisplayAlert(
title: $"Would you like to call {Account.DisplayName}?",
message: "",
accept: "Call",
cancel: "Cancel"))
if (_CapabilityService.CanMakeCalls)
{
var phoneCallTask = MessagingPlugin.PhoneDialer;
if (phoneCallTask.CanMakePhoneCall)
phoneCallTask.MakePhoneCall(Account.Phone.SanitizePhoneNumber());
}
else
{
await Page.DisplayAlert(
title: "Simulator Not Supported",
message: "Phone calls are not supported in the iOS simulator.",
cancel: "OK");
}
}
Command _MessageNumberCommand;
@ -232,18 +240,21 @@ namespace Customers
async Task ExecuteMessageNumberCommand()
{
if (String.IsNullOrWhiteSpace(Account.Phone))
return;
return;
if (await Page.DisplayAlert(
title: $"Would you like to message {Account.DisplayName}?",
message: "",
accept: "Message",
cancel: "Cancel"))
if (_CapabilityService.CanSendMessages)
{
var messageTask = MessagingPlugin.SmsMessenger;
if (messageTask.CanSendSms)
messageTask.SendSms(Account.Phone.SanitizePhoneNumber());
}
else
{
await Page.DisplayAlert(
title: "Simulator Not Supported",
message: "Messaging is not supported in the iOS simulator.",
cancel: "OK");
}
}
Command _EmailCommand;
@ -266,16 +277,19 @@ namespace Customers
if (String.IsNullOrWhiteSpace(Account.Email))
return;
if (await Page.DisplayAlert(
title: $"Would you like to email {Account.DisplayName}?",
message: "",
accept: "Email",
cancel: "Cancel"))
if (_CapabilityService.CanSendEmail)
{
var emailTask = MessagingPlugin.EmailMessenger;
if (emailTask.CanSendEmail)
emailTask.SendEmail(Account.Email);
}
else
{
await Page.DisplayAlert(
title: "Simulator Not Supported",
message: "Email composition is not supported in the iOS simulator.",
cancel: "OK");
}
}
Command _GetDirectionsCommand;
@ -292,18 +306,11 @@ namespace Customers
async Task ExecuteGetDirectionsCommand()
{
if (await Page.DisplayAlert(
"Get Directions?",
"Getting directions will take you out of this app. Continue to get directions?",
"Yes",
"Cancel"))
{
var position = await GetPosition();
var position = await GetPosition();
var pin = new Pin() { Position = position };
var pin = new Pin() { Position = position };
CrossExternalMaps.Current.NavigateTo(pin.Label, pin.Position.Latitude, pin.Position.Longitude, NavigationType.Driving);
}
CrossExternalMaps.Current.NavigateTo(pin.Label, pin.Position.Latitude, pin.Position.Longitude, NavigationType.Driving);
}
public async Task<Position> GetPosition()
@ -324,7 +331,7 @@ namespace Customers
void SubscribeToSaveCustomerMessages()
{
// This subscribes to the "SaveCustomer" message
MessagingCenter.Subscribe<Customer>(this, "SaveCustomer", async (customer) =>
MessagingCenter.Subscribe<Customer>(this, "SaveCustomer", (customer) =>
{
Account = customer;

Просмотреть файл

@ -11,6 +11,8 @@ namespace Customers
{
public CustomerListViewModel()
{
_CapabilityService = DependencyService.Get<ICapabilityService>();
DataSource = new CustomerDataSource();
SubscribeToSaveCustomerMessages();
@ -18,6 +20,9 @@ namespace Customers
SubscribeToDeleteCustomerMessages();
}
// this is just a utility service that we're using in this demo app to mitigate some limitations of the iOS simulator
ICapabilityService _CapabilityService;
readonly IDataSource<Customer> DataSource;
ObservableCollection<Customer> _Accounts;
@ -145,16 +150,99 @@ namespace Customers
if (customer == null)
return;
if (await Page.DisplayAlert(
title: $"Would you like to call {customer.DisplayName}?",
message: "",
accept: "Call",
cancel: "Cancel"))
if (_CapabilityService.CanMakeCalls)
{
var phoneCallTask = MessagingPlugin.PhoneDialer;
if (phoneCallTask.CanMakePhoneCall)
phoneCallTask.MakePhoneCall(customer.Phone.SanitizePhoneNumber());
}
else
{
await Page.DisplayAlert(
title: "Simulator Not Supported",
message: "Phone calls are not supported in the iOS simulator.",
cancel: "OK");
}
}
Command _MessageNumberCommand;
/// <summary>
/// Command to message customer phone number
/// </summary>
public Command MessageNumberCommand
{
get
{
return _MessageNumberCommand ??
(_MessageNumberCommand = new Command(async (parameter) =>
await ExecuteMessageNumberCommand((string)parameter)));
}
}
async Task ExecuteMessageNumberCommand(string customerId)
{
if (String.IsNullOrWhiteSpace(customerId))
return;
var customer = _Accounts.SingleOrDefault(c => c.Id == customerId);
if (customer == null)
return;
if (_CapabilityService.CanSendMessages)
{
var messageTask = MessagingPlugin.SmsMessenger;
if (messageTask.CanSendSms)
messageTask.SendSms(customer.Phone.SanitizePhoneNumber());
}
else
{
await Page.DisplayAlert(
title: "Simulator Not Supported",
message: "Messaging is not supported in the iOS simulator.",
cancel: "OK");
}
}
Command _EmailCommand;
/// <summary>
/// Command to email customer
/// </summary>
public Command EmailCommand
{
get
{
return _EmailCommand ??
(_EmailCommand = new Command(async (parameter) =>
await ExecuteEmailCommandCommand((string)parameter)));
}
}
async Task ExecuteEmailCommandCommand(string customerId)
{
if (String.IsNullOrWhiteSpace(customerId))
return;
var customer = _Accounts.SingleOrDefault(c => c.Id == customerId);
if (customer == null)
return;
if (_CapabilityService.CanSendEmail)
{
var emailTask = MessagingPlugin.EmailMessenger;
if (emailTask.CanSendEmail)
emailTask.SendEmail(customer.Email);
}
else
{
await Page.DisplayAlert(
title: "Simulator Not Supported",
message: "Email composition is not supported in the iOS simulator.",
cancel: "OK");
}
}
void SubscribeToSaveCustomerMessages()

Просмотреть файл

@ -158,6 +158,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Localization.cs" />
<Compile Include="Renderers\FloatingActionButtonViewRenderer.cs" />
<Compile Include="Services\EnvironmentService.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
@ -170,6 +171,7 @@
<Folder Include="Resources\values\" />
<Folder Include="Resources\values-v21\" />
<Folder Include="Renderers\" />
<Folder Include="Services\" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\icon.png" />

246
Droid/Customers.Droid.csproj.bak Executable file
Просмотреть файл

@ -0,0 +1,246 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{186E2C95-63F1-44B9-AE99-0F436E3DADFE}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Customers.Droid</RootNamespace>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<AndroidResgenClass>Resource</AndroidResgenClass>
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AndroidApplication>True</AndroidApplication>
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
<AssemblyName>CustomersDroid</AssemblyName>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>None</AndroidLinkMode>
<ConsolePause>false</ConsolePause>
<JavaMaximumHeapSize>2G</JavaMaximumHeapSize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Mono.Android" />
<Reference Include="Xamarin.Android.Support.v4">
<HintPath>..\packages\Xamarin.Android.Support.v4.23.0.1.3\lib\MonoAndroid403\Xamarin.Android.Support.v4.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.AppCompat">
<HintPath>..\packages\Xamarin.Android.Support.v7.AppCompat.23.0.1.3\lib\MonoAndroid403\Xamarin.Android.Support.v7.AppCompat.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.Design">
<HintPath>..\packages\Xamarin.Android.Support.Design.23.0.1.3\lib\MonoAndroid403\Xamarin.Android.Support.Design.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.CardView">
<HintPath>..\packages\Xamarin.Android.Support.v7.CardView.23.0.1.3\lib\MonoAndroid403\Xamarin.Android.Support.v7.CardView.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.MediaRouter">
<HintPath>..\packages\Xamarin.Android.Support.v7.MediaRouter.23.0.1.3\lib\MonoAndroid403\Xamarin.Android.Support.v7.MediaRouter.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform.Android">
<HintPath>..\packages\Xamarin.Forms.2.0.0.6490\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll</HintPath>
</Reference>
<Reference Include="FormsViewGroup">
<HintPath>..\packages\Xamarin.Forms.2.0.0.6490\lib\MonoAndroid10\FormsViewGroup.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Core">
<HintPath>..\packages\Xamarin.Forms.2.0.0.6490\lib\MonoAndroid10\Xamarin.Forms.Core.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml">
<HintPath>..\packages\Xamarin.Forms.2.0.0.6490\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform">
<HintPath>..\packages\Xamarin.Forms.2.0.0.6490\lib\MonoAndroid10\Xamarin.Forms.Platform.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives">
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\monoandroid\System.Net.Http.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Extensions">
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\monoandroid\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http" />
<Reference Include="SQLitePCL">
<HintPath>..\packages\SQLitePCL.3.8.7.2\lib\MonoAndroid\SQLitePCL.dll</HintPath>
</Reference>
<Reference Include="SQLitePCL.Ext">
<HintPath>..\packages\SQLitePCL.3.8.7.2\lib\MonoAndroid\SQLitePCL.Ext.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Mobile">
<HintPath>..\packages\Microsoft.Azure.Mobile.Client.2.0.1\lib\monoandroid\Microsoft.WindowsAzure.Mobile.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Mobile.Ext">
<HintPath>..\packages\Microsoft.Azure.Mobile.Client.2.0.1\lib\monoandroid\Microsoft.WindowsAzure.Mobile.Ext.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Mobile.SQLiteStore">
<HintPath>..\packages\Microsoft.Azure.Mobile.Client.SQLiteStore.2.0.1\lib\portable-win+net45+wp8+wpa81+monotouch+monoandroid\Microsoft.WindowsAzure.Mobile.SQLiteStore.dll</HintPath>
</Reference>
<Reference Include="PCLStorage">
<HintPath>..\packages\PCLStorage.1.0.2\lib\monoandroid\PCLStorage.dll</HintPath>
</Reference>
<Reference Include="PCLStorage.Abstractions">
<HintPath>..\packages\PCLStorage.1.0.2\lib\monoandroid\PCLStorage.Abstractions.dll</HintPath>
</Reference>
<Reference Include="ImageCircle.Forms.Plugin.Android">
<HintPath>..\packages\Xam.Plugins.Forms.ImageCircle.1.3.0\lib\MonoAndroid10\ImageCircle.Forms.Plugin.Android.dll</HintPath>
</Reference>
<Reference Include="ImageCircle.Forms.Plugin.Abstractions">
<HintPath>..\packages\Xam.Plugins.Forms.ImageCircle.1.3.0\lib\MonoAndroid10\ImageCircle.Forms.Plugin.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Faker.Portable">
<HintPath>..\Faker.Portable.dll</HintPath>
</Reference>
<Reference Include="Xamarin.GooglePlayServices.Base">
<HintPath>..\packages\Xamarin.GooglePlayServices.Base.26.0.0.0\lib\MonoAndroid41\Xamarin.GooglePlayServices.Base.dll</HintPath>
</Reference>
<Reference Include="Xamarin.GooglePlayServices.Maps">
<HintPath>..\packages\Xamarin.GooglePlayServices.Maps.26.0.0.0\lib\MonoAndroid41\Xamarin.GooglePlayServices.Maps.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Maps.Android">
<HintPath>..\packages\Xamarin.Forms.Maps.2.0.0.6490\lib\MonoAndroid10\Xamarin.Forms.Maps.Android.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Maps">
<HintPath>..\packages\Xamarin.Forms.Maps.2.0.0.6490\lib\MonoAndroid10\Xamarin.Forms.Maps.dll</HintPath>
</Reference>
<Reference Include="Lotz.Xam.Messaging.Abstractions">
<HintPath>..\packages\Xam.Plugins.Messaging.3.0.0\lib\MonoAndroid10\Lotz.Xam.Messaging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Lotz.Xam.Messaging">
<HintPath>..\packages\Xam.Plugins.Messaging.3.0.0\lib\MonoAndroid10\Lotz.Xam.Messaging.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Android.Support.v7.RecyclerView">
<HintPath>..\packages\Xamarin.Android.Support.v7.RecyclerView.23.0.1.3\lib\MonoAndroid403\Xamarin.Android.Support.v7.RecyclerView.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Refractored.FloatingActionButton">
<HintPath>..\packages\Refractored.FloatingActionButton.1.4.0\lib\MonoAndroid10\Refractored.FloatingActionButton.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.8.0.2\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Plugin.ExternalMaps">
<HintPath>..\packages\Xam.Plugin.ExternalMaps.2.0.0\lib\MonoAndroid10\Plugin.ExternalMaps.dll</HintPath>
</Reference>
<Reference Include="Plugin.ExternalMaps.Abstractions">
<HintPath>..\packages\Xam.Plugin.ExternalMaps.2.0.0\lib\MonoAndroid10\Plugin.ExternalMaps.Abstractions.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Customers\Customers.csproj">
<Project>{55CEDCD6-E2D6-48EB-B9C6-A0E74016DCE0}</Project>
<Name>Customers</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="MainActivity.cs" />
<Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Localization.cs" />
<Compile Include="Renderers\FloatingActionButtonViewRenderer.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
<None Include="Properties\AndroidManifest.xml" />
<None Include="Assets\AboutAssets.txt" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\layout\" />
<Folder Include="Resources\values\" />
<Folder Include="Resources\values-v21\" />
<Folder Include="Renderers\" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\icon.png" />
<AndroidResource Include="Resources\drawable-hdpi\icon.png" />
<AndroidResource Include="Resources\drawable-xhdpi\icon.png" />
<AndroidResource Include="Resources\drawable-xxhdpi\icon.png" />
<AndroidResource Include="Resources\values\colors.xml" />
<AndroidResource Include="Resources\values\styles.xml" />
<AndroidResource Include="Resources\values-v21\styles.xml" />
<AndroidResource Include="Resources\layout\toolbar.axml" />
<AndroidResource Include="Resources\drawable-xxxhdpi\icon.png" />
<AndroidResource Include="Resources\drawable-xxxhdpi\save.png" />
<AndroidResource Include="Resources\drawable-xxhdpi\save.png" />
<AndroidResource Include="Resources\drawable-xhdpi\save.png" />
<AndroidResource Include="Resources\drawable-mdpi\icon.png" />
<AndroidResource Include="Resources\drawable-mdpi\save.png" />
<AndroidResource Include="Resources\drawable-hdpi\save.png" />
<AndroidResource Include="Resources\drawable\save.png" />
<AndroidResource Include="Resources\drawable-hdpi\fab_add.png" />
<AndroidResource Include="Resources\drawable\fab_add.png" />
<AndroidResource Include="Resources\drawable-xxxhdpi\fab_add.png" />
<AndroidResource Include="Resources\drawable-xxhdpi\fab_add.png" />
<AndroidResource Include="Resources\drawable-xhdpi\fab_add.png" />
<AndroidResource Include="Resources\drawable-mdpi\fab_add.png" />
<AndroidResource Include="Resources\drawable-ldpi\edit.png" />
<AndroidResource Include="Resources\drawable-ldpi\phone.png" />
<AndroidResource Include="Resources\drawable-ldpi\save.png" />
<AndroidResource Include="Resources\drawable-xxxhdpi\placeholderProfileImage.png" />
<AndroidResource Include="Resources\drawable-xxhdpi\edit.png" />
<AndroidResource Include="Resources\drawable-xxhdpi\phone.png" />
<AndroidResource Include="Resources\drawable-xxhdpi\placeholderProfileImage.png" />
<AndroidResource Include="Resources\drawable-xhdpi\edit.png" />
<AndroidResource Include="Resources\drawable-xhdpi\phone.png" />
<AndroidResource Include="Resources\drawable-xhdpi\placeholderProfileImage.png" />
<AndroidResource Include="Resources\drawable-mdpi\edit.png" />
<AndroidResource Include="Resources\drawable-mdpi\phone.png" />
<AndroidResource Include="Resources\drawable-mdpi\placeholderProfileImage.png" />
<AndroidResource Include="Resources\drawable-hdpi\edit.png" />
<AndroidResource Include="Resources\drawable-hdpi\phone.png" />
<AndroidResource Include="Resources\drawable-hdpi\placeholderProfileImage.png" />
<AndroidResource Include="Resources\drawable-ldpi\placeholderProfileImage.png" />
<AndroidResource Include="Resources\drawable-xxxhdpi\directions.png" />
<AndroidResource Include="Resources\drawable-xxhdpi\directions.png" />
<AndroidResource Include="Resources\drawable-xhdpi\directions.png" />
<AndroidResource Include="Resources\drawable-mdpi\directions.png" />
<AndroidResource Include="Resources\drawable-ldpi\directions.png" />
<AndroidResource Include="Resources\drawable-hdpi\directions.png" />
<AndroidResource Include="Resources\drawable\directions.png" />
<AndroidResource Include="Resources\drawable\phone.png" />
<AndroidResource Include="Resources\drawable\placeholderProfileImage.png" />
<AndroidResource Include="Resources\drawable-xxxhdpi\edit.png" />
<AndroidResource Include="Resources\drawable-xxxhdpi\email.png" />
<AndroidResource Include="Resources\drawable-xxxhdpi\message.png" />
<AndroidResource Include="Resources\drawable-xxxhdpi\phone.png" />
<AndroidResource Include="Resources\drawable-xxhdpi\email.png" />
<AndroidResource Include="Resources\drawable-xxhdpi\message.png" />
<AndroidResource Include="Resources\drawable-xhdpi\email.png" />
<AndroidResource Include="Resources\drawable-xhdpi\message.png" />
<AndroidResource Include="Resources\drawable-mdpi\email.png" />
<AndroidResource Include="Resources\drawable-mdpi\message.png" />
<AndroidResource Include="Resources\drawable-ldpi\email.png" />
<AndroidResource Include="Resources\drawable-ldpi\fab_add.png" />
<AndroidResource Include="Resources\drawable-ldpi\icon.png" />
<AndroidResource Include="Resources\drawable-ldpi\message.png" />
<AndroidResource Include="Resources\drawable-hdpi\email.png" />
<AndroidResource Include="Resources\drawable-hdpi\message.png" />
<AndroidResource Include="Resources\drawable\edit.png" />
<AndroidResource Include="Resources\drawable\email.png" />
<AndroidResource Include="Resources\drawable\message.png" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<Import Project="..\packages\Xamarin.Forms.2.0.0.6490\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.2.0.0.6490\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
</Project>

Просмотреть файл

@ -0,0 +1,23 @@
using System;
using Android.OS;
using Customers.Droid;
[assembly: Xamarin.Forms.Dependency (typeof (EnvironmentService))]
namespace Customers.Droid
{
public class EnvironmentService : IEnvironmentService
{
#region IEnvironmentService implementation
public bool IsRealDevice
{
get
{
string f = Build.Fingerprint;
return !(f.Contains("vbox") || f.Contains("generic") || f.Contains("vsemu"));
}
}
#endregion
}
}

Просмотреть файл

@ -178,12 +178,14 @@
<Compile Include="AppDelegate.cs" />
<Compile Include="Renderers\StandardViewCellRenderer.cs" />
<Compile Include="Localization.cs" />
<Compile Include="Services\EnvironmentService.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<Import Project="..\packages\Xamarin.Forms.2.0.0.6490\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.2.0.0.6490\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\Xamarin.Forms.targets')" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
<ItemGroup>
<Folder Include="Renderers\" />
<Folder Include="Services\" />
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\add.png" />

Просмотреть файл

@ -0,0 +1,18 @@
using ObjCRuntime;
using Customers.iOS;
[assembly: Xamarin.Forms.Dependency (typeof (EnvironmentService))]
namespace Customers.iOS
{
public class EnvironmentService : IEnvironmentService
{
#region IEnvironmentService implementation
public bool IsRealDevice
{
get { return Runtime.Arch == Arch.DEVICE; }
}
#endregion
}
}