From f923aa69eff3f99277b2155e6b77496b6c25d61a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Su=C3=A1rez=20Ruiz?= Date: Mon, 21 Nov 2016 17:08:48 +0100 Subject: [PATCH] Updated mobile settings view --- .../ViewModels/SettingsViewModel.cs | 45 +++++++++++++++++++ .../Views/SettingsView.xaml | 4 +- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/SettingsViewModel.cs b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/SettingsViewModel.cs index e1fea8416..2cdacb480 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/SettingsViewModel.cs +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/SettingsViewModel.cs @@ -1,11 +1,14 @@ using eShopOnContainers.ViewModels.Base; using System.Windows.Input; using Xamarin.Forms; +using System.Threading.Tasks; namespace eShopOnContainers.Core.ViewModels { public class SettingsViewModel : ViewModelBase { + private string _title; + private string _description; private bool _useMockServices; public SettingsViewModel() @@ -13,6 +16,26 @@ namespace eShopOnContainers.Core.ViewModels 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 { get { return _useMockServices; } @@ -28,6 +51,28 @@ namespace eShopOnContainers.Core.ViewModels private void MockServices() { 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"; + } } } } \ No newline at end of file diff --git a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/SettingsView.xaml b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/SettingsView.xaml index db204f4c7..f23473578 100644 --- a/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/SettingsView.xaml +++ b/src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/SettingsView.xaml @@ -67,11 +67,11 @@ Grid.Column="0" Grid.Row="1">