Updated mobile settings view
This commit is contained in:
parent
0d2ec11c6a
commit
f923aa69ef
@ -1,11 +1,14 @@
|
|||||||
using eShopOnContainers.ViewModels.Base;
|
using eShopOnContainers.ViewModels.Base;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace eShopOnContainers.Core.ViewModels
|
namespace eShopOnContainers.Core.ViewModels
|
||||||
{
|
{
|
||||||
public class SettingsViewModel : ViewModelBase
|
public class SettingsViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
|
private string _title;
|
||||||
|
private string _description;
|
||||||
private bool _useMockServices;
|
private bool _useMockServices;
|
||||||
|
|
||||||
public SettingsViewModel()
|
public SettingsViewModel()
|
||||||
@ -13,6 +16,26 @@ namespace eShopOnContainers.Core.ViewModels
|
|||||||
UseMockServices = ViewModelLocator.Instance.UseMockService;
|
UseMockServices = ViewModelLocator.Instance.UseMockService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Title
|
||||||
|
{
|
||||||
|
get { return _title; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_title = value;
|
||||||
|
RaisePropertyChanged(() => Title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Description
|
||||||
|
{
|
||||||
|
get { return _description; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_description = value;
|
||||||
|
RaisePropertyChanged(() => Description);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool UseMockServices
|
public bool UseMockServices
|
||||||
{
|
{
|
||||||
get { return _useMockServices; }
|
get { return _useMockServices; }
|
||||||
@ -28,6 +51,28 @@ namespace eShopOnContainers.Core.ViewModels
|
|||||||
private void MockServices()
|
private void MockServices()
|
||||||
{
|
{
|
||||||
ViewModelLocator.Instance.UpdateServices(UseMockServices);
|
ViewModelLocator.Instance.UpdateServices(UseMockServices);
|
||||||
|
UpdateInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Task InitializeAsync(object navigationData)
|
||||||
|
{
|
||||||
|
UpdateInfo();
|
||||||
|
|
||||||
|
return base.InitializeAsync(navigationData);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateInfo()
|
||||||
|
{
|
||||||
|
if (!UseMockServices)
|
||||||
|
{
|
||||||
|
Title = "Use Mock Services";
|
||||||
|
Description = "Mock Services are simulated objects that mimic the behavior of real services in controlled ways";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Title = "Use Azure Services";
|
||||||
|
Description = "Azure Services are real objects that required a valid internet connection";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -67,11 +67,11 @@
|
|||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Grid.Row="1">
|
Grid.Row="1">
|
||||||
<Label
|
<Label
|
||||||
Text="Use Mock Services"
|
Text="{Binding Title}"
|
||||||
TextColor="{StaticResource GreenColor}"
|
TextColor="{StaticResource GreenColor}"
|
||||||
Style="{StaticResource SettingsTitleStyle}"/>
|
Style="{StaticResource SettingsTitleStyle}"/>
|
||||||
<Label
|
<Label
|
||||||
Text="Mock Services are simulated objects that mimic the behavior of real services in controlled ways"
|
Text="{Binding Description}"
|
||||||
Style="{StaticResource SettingsDescriptionStyle}"/>
|
Style="{StaticResource SettingsDescriptionStyle}"/>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<controls:ToggleButton
|
<controls:ToggleButton
|
||||||
|
Loading…
x
Reference in New Issue
Block a user