Performant SettingViews on iOS

This commit is contained in:
David Britch 2018-06-11 12:28:28 +01:00
parent 33366ea4ca
commit 853492011f
2 changed files with 196 additions and 296 deletions

View File

@ -13,14 +13,8 @@ namespace eShopOnContainers.Core.ViewModels
{ {
public class SettingsViewModel : ViewModelBase public class SettingsViewModel : ViewModelBase
{ {
private string _titleUseAzureServices;
private string _descriptionUseAzureServices;
private bool _useAzureServices; private bool _useAzureServices;
private string _titleUseFakeLocation;
private string _descriptionUseFakeLocation;
private bool _allowGpsLocation; private bool _allowGpsLocation;
private string _titleAllowGpsLocation;
private string _descriptionAllowGpsLocation;
private bool _useFakeLocation; private bool _useFakeLocation;
private string _endpoint; private string _endpoint;
private double _latitude; private double _latitude;
@ -48,21 +42,16 @@ namespace eShopOnContainers.Core.ViewModels
public string TitleUseAzureServices public string TitleUseAzureServices
{ {
get => _titleUseAzureServices; get { return !UseAzureServices ? "Use Mock Services" : "Use Microservices/Containers from eShopOnContainers"; }
set
{
_titleUseAzureServices = value;
RaisePropertyChanged(() => TitleUseAzureServices);
}
} }
public string DescriptionUseAzureServices public string DescriptionUseAzureServices
{ {
get => _descriptionUseAzureServices; get
set
{ {
_descriptionUseAzureServices = value; return !UseAzureServices
RaisePropertyChanged(() => DescriptionUseAzureServices); ? "Mock Services are simulated objects that mimic the behavior of real services using a controlled approach."
: "When enabling the use of microservices/containers, the app will attempt to use real services deployed as Docker containers at the specified base endpoint, which will must be reachable through the network.";
} }
} }
@ -72,30 +61,23 @@ namespace eShopOnContainers.Core.ViewModels
set set
{ {
_useAzureServices = value; _useAzureServices = value;
UpdateUseAzureServices(); UpdateUseAzureServices();
RaisePropertyChanged(() => UseAzureServices); RaisePropertyChanged(() => UseAzureServices);
} }
} }
public string TitleUseFakeLocation public string TitleUseFakeLocation
{ {
get => _titleUseFakeLocation; get { return !UseFakeLocation ? "Use Real Location" : "Use Fake Location"; }
set
{
_titleUseFakeLocation = value;
RaisePropertyChanged(() => TitleUseFakeLocation);
}
} }
public string DescriptionUseFakeLocation public string DescriptionUseFakeLocation
{ {
get => _descriptionUseFakeLocation; get
set
{ {
_descriptionUseFakeLocation = value; return !UseFakeLocation
RaisePropertyChanged(() => DescriptionUseFakeLocation); ? "When enabling location, the app will attempt to use the location from the device."
: "Fake Location data is added for marketing campaign testing.";
} }
} }
@ -105,30 +87,23 @@ namespace eShopOnContainers.Core.ViewModels
set set
{ {
_useFakeLocation = value; _useFakeLocation = value;
UpdateFakeLocation(); UpdateFakeLocation();
RaisePropertyChanged(() => UseFakeLocation); RaisePropertyChanged(() => UseFakeLocation);
} }
} }
public string TitleAllowGpsLocation public string TitleAllowGpsLocation
{ {
get => _titleAllowGpsLocation; get { return !AllowGpsLocation ? "GPS Location Disabled" : "GPS Location Enabled"; }
set
{
_titleAllowGpsLocation = value;
RaisePropertyChanged(() => TitleAllowGpsLocation);
}
} }
public string DescriptionAllowGpsLocation public string DescriptionAllowGpsLocation
{ {
get => _descriptionAllowGpsLocation; get
set
{ {
_descriptionAllowGpsLocation = value; return !AllowGpsLocation
RaisePropertyChanged(() => DescriptionAllowGpsLocation); ? "When disabling location, you won't receive location campaigns based upon your location."
: "When enabling location, you'll receive location campaigns based upon your location.";
} }
} }
@ -148,12 +123,10 @@ namespace eShopOnContainers.Core.ViewModels
set set
{ {
_endpoint = value; _endpoint = value;
if (!string.IsNullOrEmpty(_endpoint)) if (!string.IsNullOrEmpty(_endpoint))
{ {
UpdateEndpoint(); UpdateEndpoint();
} }
RaisePropertyChanged(() => Endpoint); RaisePropertyChanged(() => Endpoint);
} }
} }
@ -164,9 +137,7 @@ namespace eShopOnContainers.Core.ViewModels
set set
{ {
_latitude = value; _latitude = value;
UpdateLatitude(); UpdateLatitude();
RaisePropertyChanged(() => Latitude); RaisePropertyChanged(() => Latitude);
} }
} }
@ -177,9 +148,7 @@ namespace eShopOnContainers.Core.ViewModels
set set
{ {
_longitude = value; _longitude = value;
UpdateLongitude(); UpdateLongitude();
RaisePropertyChanged(() => Longitude); RaisePropertyChanged(() => Longitude);
} }
} }
@ -190,9 +159,7 @@ namespace eShopOnContainers.Core.ViewModels
set set
{ {
_allowGpsLocation = value; _allowGpsLocation = value;
UpdateAllowGpsLocation(); UpdateAllowGpsLocation();
RaisePropertyChanged(() => AllowGpsLocation); RaisePropertyChanged(() => AllowGpsLocation);
} }
} }
@ -207,19 +174,11 @@ namespace eShopOnContainers.Core.ViewModels
public ICommand ToggleAllowGpsLocationCommand => new Command(ToggleAllowGpsLocation); public ICommand ToggleAllowGpsLocationCommand => new Command(ToggleAllowGpsLocation);
public override Task InitializeAsync(object navigationData)
{
UpdateInfoUseAzureServices();
UpdateInfoFakeLocation();
UpdateInfoAllowGpsLocation();
return base.InitializeAsync(navigationData);
}
private async Task ToggleMockServicesAsync() private async Task ToggleMockServicesAsync()
{ {
ViewModelLocator.UpdateDependencies(!UseAzureServices); ViewModelLocator.UpdateDependencies(!UseAzureServices);
UpdateInfoUseAzureServices(); RaisePropertyChanged(() => TitleUseAzureServices);
RaisePropertyChanged(() => DescriptionUseAzureServices);
var previousPageViewModel = NavigationService.PreviousPageViewModel; var previousPageViewModel = NavigationService.PreviousPageViewModel;
if (previousPageViewModel != null) if (previousPageViewModel != null)
@ -243,7 +202,8 @@ namespace eShopOnContainers.Core.ViewModels
private void ToggleFakeLocationAsync() private void ToggleFakeLocationAsync()
{ {
ViewModelLocator.UpdateDependencies(!UseAzureServices); ViewModelLocator.UpdateDependencies(!UseAzureServices);
UpdateInfoFakeLocation(); RaisePropertyChanged(() => TitleUseFakeLocation);
RaisePropertyChanged(() => DescriptionUseFakeLocation);
} }
private async Task ToggleSendLocationAsync() private async Task ToggleSendLocationAsync()
@ -263,51 +223,8 @@ namespace eShopOnContainers.Core.ViewModels
private void ToggleAllowGpsLocation() private void ToggleAllowGpsLocation()
{ {
UpdateInfoAllowGpsLocation(); RaisePropertyChanged(() => TitleAllowGpsLocation);
} RaisePropertyChanged(() => DescriptionAllowGpsLocation);
private void UpdateInfoUseAzureServices()
{
if (!UseAzureServices)
{
TitleUseAzureServices = "Use Mock Services";
DescriptionUseAzureServices = "Mock Services are simulated objects that mimic the behavior of real services using a controlled approach.";
}
else
{
TitleUseAzureServices = "Use Microservices/Containers from eShopOnContainers";
DescriptionUseAzureServices = "When enabling the use of microservices/containers, the app will attempt to use real services deployed as Docker containers at the specified base endpoint, which will must be reachable through the network.";
}
}
private void UpdateInfoFakeLocation()
{
if (!UseFakeLocation)
{
TitleUseFakeLocation = "Use Real Location";
DescriptionUseFakeLocation = "When enabling location, the app will attempt to use the location from the device.";
}
else
{
TitleUseFakeLocation = "Use Fake Location";
DescriptionUseFakeLocation = "Fake Location data is added for marketing campaign testing.";
}
}
private void UpdateInfoAllowGpsLocation()
{
if (!AllowGpsLocation)
{
TitleAllowGpsLocation = "GPS Location Disabled";
DescriptionAllowGpsLocation = "When disabling location, you won't receive location campaigns based upon your location.";
}
else
{
TitleAllowGpsLocation = "GPS Location Enabled";
DescriptionAllowGpsLocation = "When enabling location, you'll receive location campaigns based upon your location.";
}
} }
private void UpdateUseAzureServices() private void UpdateUseAzureServices()

View File

@ -2,12 +2,12 @@
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" <ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="eShopOnContainers.Core.Views.SettingsView" x:Class="eShopOnContainers.Core.Views.SettingsView"
xmlns:viewModelBase="clr-namespace:eShopOnContainers.Core.ViewModels.Base;assembly=eShopOnContainers.Core" xmlns:viewModelBase="clr-namespace:eShopOnContainers.Core.ViewModels.Base;assembly=eShopOnContainers.Core"
xmlns:controls="clr-namespace:eShopOnContainers.Core.Controls;assembly=eShopOnContainers.Core" xmlns:controls="clr-namespace:eShopOnContainers.Core.Controls;assembly=eShopOnContainers.Core"
xmlns:converters="clr-namespace:eShopOnContainers.Core.Converters;assembly=eShopOnContainers.Core" xmlns:converters="clr-namespace:eShopOnContainers.Core.Converters;assembly=eShopOnContainers.Core"
xmlns:animations="clr-namespace:eShopOnContainers.Core.Animations;assembly=eShopOnContainers.Core" xmlns:animations="clr-namespace:eShopOnContainers.Core.Animations;assembly=eShopOnContainers.Core"
xmlns:triggers="clr-namespace:eShopOnContainers.Core.Triggers;assembly=eShopOnContainers.Core" xmlns:triggers="clr-namespace:eShopOnContainers.Core.Triggers;assembly=eShopOnContainers.Core"
viewModelBase:ViewModelLocator.AutoWireViewModel="true" viewModelBase:ViewModelLocator.AutoWireViewModel="true"
Title="Settings"> Title="Settings">
<ContentPage.Resources> <ContentPage.Resources>
<ResourceDictionary> <ResourceDictionary>
@ -116,195 +116,178 @@
Animation="{StaticResource MockServicesAnimation}" /> Animation="{StaticResource MockServicesAnimation}" />
</EventTrigger> </EventTrigger>
</ContentPage.Triggers> </ContentPage.Triggers>
<Grid
BackgroundColor="{StaticResource BackgroundColor}">
<!-- SETTINGS -->
<ScrollView>
<StackLayout
x:Name="MockServices">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- MOCK SERVICES -->
<StackLayout
Grid.Column="0"
Grid.Row="1"
Style="{StaticResource SettingsStackLayoutStyle}">
<Label
Text="{Binding TitleUseAzureServices}"
Style="{StaticResource SettingsTitleStyle}"/>
<Label
Text="{Binding DescriptionUseAzureServices}"
Style="{StaticResource SettingsDescriptionStyle}"/>
</StackLayout>
<!-- ON / OFF -->
<controls:ToggleButton
Grid.Column="1"
Grid.Row="1"
Checked="{Binding UseAzureServices, Mode=TwoWay}"
Command="{Binding ToggleMockServicesCommand}"
Style="{StaticResource SettingsToggleButtonStyle}">
<controls:ToggleButton.CheckedImage>
<OnPlatform x:TypeArguments="ImageSource">
<On Platform="iOS" Value="switchOn.png" />
<On Platform="Android" Value="switch_on.png" />
<On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOn.png" />
</OnPlatform>
</controls:ToggleButton.CheckedImage>
<controls:ToggleButton.UnCheckedImage>
<OnPlatform x:TypeArguments="ImageSource">
<On Platform="iOS" Value="switchOff.png" />
<On Platform="Android" Value="switch_off.png" />
<On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOff.png" />
</OnPlatform>
</controls:ToggleButton.UnCheckedImage>
</controls:ToggleButton>
<!-- ENDPOINT -->
<StackLayout
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="2"
Style="{StaticResource SettingsStackLayoutStyle}"
IsVisible="{Binding UseAzureServices}">
<Label
Text="Endpoint"
Style="{StaticResource HeaderLabelStyle}"/>
<Entry
Text="{Binding Endpoint, Mode=TwoWay}">
<Entry.Style>
<OnPlatform x:TypeArguments="Style">
<On Platform="iOS, Android" Value="{StaticResource SettingsEntryStyle}" />
<On Platform="UWP, WinRT, WinPhone" Value="{StaticResource SettingsUwpEntryStyle}" />
</OnPlatform>
</Entry.Style>
</Entry>
</StackLayout>
<!-- USE LOCATIONS --> <!-- SETTINGS -->
<StackLayout <Grid x:Name="MockServices" BackgroundColor="{StaticResource BackgroundColor}">
Grid.Column="0" <Grid.ColumnDefinitions>
Grid.Row="3" <ColumnDefinition Width="*" />
IsVisible="{Binding UserIsLogged}" <ColumnDefinition Width="Auto" />
Style="{StaticResource SettingsStackLayoutStyle}"> </Grid.ColumnDefinitions>
<Label <Grid.RowDefinitions>
Text="{Binding TitleUseFakeLocation}" <RowDefinition Height="Auto" />
Style="{StaticResource SettingsTitleStyle}"/> <RowDefinition Height="Auto" />
<Label <RowDefinition Height="Auto" />
Text="{Binding DescriptionUseFakeLocation}" <RowDefinition Height="Auto" />
Style="{StaticResource SettingsDescriptionStyle}"/> <RowDefinition Height="Auto" />
</StackLayout> </Grid.RowDefinitions>
<!-- ON / OFF --> <!-- MOCK SERVICES -->
<controls:ToggleButton <StackLayout
Grid.Column="1" Style="{StaticResource SettingsStackLayoutStyle}">
Grid.Row="3" <Label
Checked="{Binding UseFakeLocation, Mode=TwoWay}" Text="{Binding TitleUseAzureServices}"
Command="{Binding ToggleFakeLocationCommand}" Style="{StaticResource SettingsTitleStyle}"/>
Style="{StaticResource SettingsToggleButtonStyle}" <Label
IsVisible="{Binding UserIsLogged}"> Text="{Binding DescriptionUseAzureServices}"
<controls:ToggleButton.CheckedImage> Style="{StaticResource SettingsDescriptionStyle}"/>
<OnPlatform x:TypeArguments="ImageSource"> </StackLayout>
<On Platform="iOS" Value="switchOn.png" /> <!-- ON / OFF -->
<On Platform="Android" Value="switch_on.png" /> <controls:ToggleButton
<On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOn.png" /> Grid.Column="1"
</OnPlatform> Checked="{Binding UseAzureServices, Mode=TwoWay}"
</controls:ToggleButton.CheckedImage> Command="{Binding ToggleMockServicesCommand}"
<controls:ToggleButton.UnCheckedImage> Style="{StaticResource SettingsToggleButtonStyle}">
<OnPlatform x:TypeArguments="ImageSource"> <controls:ToggleButton.CheckedImage>
<On Platform="iOS" Value="switchOff.png" /> <OnPlatform x:TypeArguments="ImageSource">
<On Platform="Android" Value="switch_off.png" /> <On Platform="iOS" Value="switchOn.png" />
<On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOff.png" /> <On Platform="Android" Value="switch_on.png" />
</OnPlatform> <On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOn.png" />
</controls:ToggleButton.UnCheckedImage> </OnPlatform>
</controls:ToggleButton> </controls:ToggleButton.CheckedImage>
<!-- FAKE LOCATIONS --> <controls:ToggleButton.UnCheckedImage>
<StackLayout <OnPlatform x:TypeArguments="ImageSource">
Grid.Row="4" <On Platform="iOS" Value="switchOff.png" />
Grid.Column="0" <On Platform="Android" Value="switch_off.png" />
Grid.ColumnSpan="2" <On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOff.png" />
Style="{StaticResource SettingsStackLayoutStyle}" </OnPlatform>
IsVisible="{Binding UseFakeLocation}"> </controls:ToggleButton.UnCheckedImage>
<Label </controls:ToggleButton>
Text="Latitude" <!-- ENDPOINT -->
Style="{StaticResource HeaderLabelStyle}"/> <StackLayout
<Entry Grid.Row="1"
Text="{Binding Latitude, Mode=TwoWay, Converter={StaticResource DoubleConverter}}" Grid.ColumnSpan="2"
Keyboard="Text"> Style="{StaticResource SettingsStackLayoutStyle}"
<Entry.Style> IsVisible="{Binding UseAzureServices}">
<OnPlatform x:TypeArguments="Style"> <Label
<On Platform="iOS, Android" Value="{StaticResource SettingsEntryStyle}" /> Text="Endpoint"
<On Platform="UWP, WinRT, WinPhone" Value="{StaticResource SettingsUwpEntryStyle}" /> Style="{StaticResource HeaderLabelStyle}"/>
</OnPlatform> <Entry
</Entry.Style> Text="{Binding Endpoint, Mode=TwoWay}">
</Entry> <Entry.Style>
<Label <OnPlatform x:TypeArguments="Style">
Text="Longitude" <On Platform="iOS, Android" Value="{StaticResource SettingsEntryStyle}" />
Style="{StaticResource HeaderLabelStyle}"/> <On Platform="UWP, WinRT, WinPhone" Value="{StaticResource SettingsUwpEntryStyle}" />
<Entry </OnPlatform>
Text="{Binding Longitude, Mode=TwoWay, Converter={StaticResource DoubleConverter}}" </Entry.Style>
Keyboard="Text"> </Entry>
<Entry.Style> </StackLayout>
<OnPlatform x:TypeArguments="Style"> <!-- USE LOCATIONS -->
<On Platform="iOS, Android" Value="{StaticResource SettingsEntryStyle}" /> <StackLayout
<On Platform="UWP, WinRT, WinPhone" Value="{StaticResource SettingsUwpEntryStyle}" /> Grid.Row="2"
</OnPlatform> IsVisible="{Binding UserIsLogged}"
</Entry.Style> Style="{StaticResource SettingsStackLayoutStyle}">
</Entry> <Label
<Button Text="{Binding TitleUseFakeLocation}"
Command="{Binding ToggleSendLocationCommand}" Style="{StaticResource SettingsTitleStyle}"/>
Text="Send Location"/> <Label
</StackLayout> Text="{Binding DescriptionUseFakeLocation}"
<!-- ALLOW GPS LOCATION --> Style="{StaticResource SettingsDescriptionStyle}"/>
<StackLayout </StackLayout>
Grid.Column="0" <!-- ON / OFF -->
Grid.Row="5" <controls:ToggleButton
Style="{StaticResource SettingsStackLayoutStyle}" Grid.Column="1"
IsVisible="{Binding UseFakeLocation, Converter={StaticResource InverseBoolConverter}}"> Grid.Row="2"
<Label Checked="{Binding UseFakeLocation, Mode=TwoWay}"
Text="{Binding TitleAllowGpsLocation}" Command="{Binding ToggleFakeLocationCommand}"
Style="{StaticResource SettingsToggleButtonStyle}"
Style="{StaticResource SettingsTitleStyle}"/> IsVisible="{Binding UserIsLogged}">
<Label <controls:ToggleButton.CheckedImage>
Text="{Binding DescriptionAllowGpsLocation}" <OnPlatform x:TypeArguments="ImageSource">
Style="{StaticResource SettingsDescriptionStyle}"/> <On Platform="iOS" Value="switchOn.png" />
<Label <On Platform="Android" Value="switch_on.png" />
Text="{Binding GpsWarningMessage}" <On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOn.png" />
Style="{StaticResource SettingsWarningMessageStyle}"/> </OnPlatform>
</StackLayout> </controls:ToggleButton.CheckedImage>
<!-- ON / OFF --> <controls:ToggleButton.UnCheckedImage>
<controls:ToggleButton <OnPlatform x:TypeArguments="ImageSource">
Grid.Column="1" <On Platform="iOS" Value="switchOff.png" />
Grid.Row="5" <On Platform="Android" Value="switch_off.png" />
Checked="{Binding AllowGpsLocation, Mode=TwoWay}" <On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOff.png" />
Command="{Binding ToggleAllowGpsLocationCommand}" </OnPlatform>
Style="{StaticResource SettingsToggleButtonStyle}" </controls:ToggleButton.UnCheckedImage>
IsVisible="{Binding UseFakeLocation, Converter={StaticResource InverseBoolConverter}}"> </controls:ToggleButton>
<controls:ToggleButton.CheckedImage> <!-- FAKE LOCATIONS -->
<OnPlatform x:TypeArguments="ImageSource"> <StackLayout
<On Platform="iOS" Value="switchOn.png" /> Grid.Row="3"
<On Platform="Android" Value="switch_on.png" /> Grid.ColumnSpan="2"
<On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOn.png" /> Style="{StaticResource SettingsStackLayoutStyle}"
</OnPlatform> IsVisible="{Binding UseFakeLocation}">
</controls:ToggleButton.CheckedImage> <Label
<controls:ToggleButton.UnCheckedImage> Text="Latitude"
<OnPlatform x:TypeArguments="ImageSource"> Style="{StaticResource HeaderLabelStyle}"/>
<On Platform="iOS" Value="switchOff.png" /> <Entry
<On Platform="Android" Value="switch_off.png" /> Text="{Binding Latitude, Mode=TwoWay, Converter={StaticResource DoubleConverter}}"
<On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOff.png" /> Keyboard="Text">
</OnPlatform> <Entry.Style>
</controls:ToggleButton.UnCheckedImage> <OnPlatform x:TypeArguments="Style">
</controls:ToggleButton> <On Platform="iOS, Android" Value="{StaticResource SettingsEntryStyle}" />
</Grid> <On Platform="UWP, WinRT, WinPhone" Value="{StaticResource SettingsUwpEntryStyle}" />
</StackLayout> </OnPlatform>
</ScrollView> </Entry.Style>
</Entry>
<Label
Text="Longitude"
Style="{StaticResource HeaderLabelStyle}"/>
<Entry
Text="{Binding Longitude, Mode=TwoWay, Converter={StaticResource DoubleConverter}}"
Keyboard="Text">
<Entry.Style>
<OnPlatform x:TypeArguments="Style">
<On Platform="iOS, Android" Value="{StaticResource SettingsEntryStyle}" />
<On Platform="UWP, WinRT, WinPhone" Value="{StaticResource SettingsUwpEntryStyle}" />
</OnPlatform>
</Entry.Style>
</Entry>
<Button
Command="{Binding ToggleSendLocationCommand}"
Text="Send Location"/>
</StackLayout>
<!-- ALLOW GPS LOCATION -->
<StackLayout
Grid.Row="4"
Style="{StaticResource SettingsStackLayoutStyle}"
IsVisible="{Binding UseFakeLocation, Converter={StaticResource InverseBoolConverter}}">
<Label
Text="{Binding TitleAllowGpsLocation}"
Style="{StaticResource SettingsTitleStyle}"/>
<Label
Text="{Binding DescriptionAllowGpsLocation}"
Style="{StaticResource SettingsDescriptionStyle}"/>
<Label
Text="{Binding GpsWarningMessage}"
Style="{StaticResource SettingsWarningMessageStyle}"/>
</StackLayout>
<!-- ON / OFF -->
<controls:ToggleButton
Grid.Column="1"
Grid.Row="4"
Checked="{Binding AllowGpsLocation, Mode=TwoWay}"
Command="{Binding ToggleAllowGpsLocationCommand}"
Style="{StaticResource SettingsToggleButtonStyle}"
IsVisible="{Binding UseFakeLocation, Converter={StaticResource InverseBoolConverter}}">
<controls:ToggleButton.CheckedImage>
<OnPlatform x:TypeArguments="ImageSource">
<On Platform="iOS" Value="switchOn.png" />
<On Platform="Android" Value="switch_on.png" />
<On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOn.png" />
</OnPlatform>
</controls:ToggleButton.CheckedImage>
<controls:ToggleButton.UnCheckedImage>
<OnPlatform x:TypeArguments="ImageSource">
<On Platform="iOS" Value="switchOff.png" />
<On Platform="Android" Value="switch_off.png" />
<On Platform="UWP, WinRT, WinPhone" Value="Assets/switchOff.png" />
</OnPlatform>
</controls:ToggleButton.UnCheckedImage>
</controls:ToggleButton>
</Grid> </Grid>
</ContentPage> </ContentPage>