This commit is contained in:
Ramón Tomás 2017-07-12 12:10:25 +02:00
commit 7bb14783b1
10 changed files with 47 additions and 20 deletions

View File

@ -14,9 +14,7 @@ However, this sample application should not be considered as an "eCommerce refer
> Read the planned <a href='https://github.com/dotnet/eShopOnContainers/wiki/01.-Roadmap-and-Milestones-for-future-releases'>Roadmap and Milestones for future releases of eShopOnContainers</a> within the Wiki for further info about possible new implementations and provide feedback at the <a href='https://github.com/dotnet/eShopOnContainers/issues'>ISSUES section</a> if you'd like to see any specific scenario implemented or improved. Also, feel free to discuss on any current issue. > Read the planned <a href='https://github.com/dotnet/eShopOnContainers/wiki/01.-Roadmap-and-Milestones-for-future-releases'>Roadmap and Milestones for future releases of eShopOnContainers</a> within the Wiki for further info about possible new implementations and provide feedback at the <a href='https://github.com/dotnet/eShopOnContainers/issues'>ISSUES section</a> if you'd like to see any specific scenario implemented or improved. Also, feel free to discuss on any current issue.
**Architecture overview**: This reference application is cross-platform either at the server and client side, thanks to .NET Core services capable of running on Linux or Windows containers depending on your Docker host, and to Xamarin for mobile apps running on Android, iOS or Windows/UWP plus any browser for the client web apps. **Architecture overview**: This reference application is cross-platform either at the server and client side, thanks to .NET Core services capable of running on Linux or Windows containers depending on your Docker host, and to Xamarin for mobile apps running on Android, iOS or Windows/UWP plus any browser for the client web apps.
The architecture proposes a simplified microservice oriented architecture implementation with multiple autonomous microservices (each one owning its own data/db) and implementing different approaches within each microservice (simple CRUD vs. DDD/CQRS patterns) using Http as the current communication protocol. The architecture proposes a simplified microservice oriented architecture implementation with multiple autonomous microservices (each one owning its own data/db) and implementing different approaches within each microservice (simple CRUD vs. DDD/CQRS patterns) using Http as the communication protocol between the client apps and the microservices and supports asynchronous communication for data updates propagation across multiple services based on Integration Events and an Event Bus (a light message broker, to choose between RabbitMQ or Azure Service Bus, underneath) plus other features defined at the <a href='https://github.com/dotnet/eShopOnContainers/wiki/01.-Roadmap-and-Milestones-for-future-releases'>roadmap</a>.
<p>
It also supports asynchronous communication for data updates propagation across multiple services based on Integration Events and an Event Bus plus other features defined at the <a href='https://github.com/dotnet/eShopOnContainers/wiki/01.-Roadmap-and-Milestones-for-future-releases'>roadmap</a>.
<p> <p>
<img src="img/eshop_logo.png"> <img src="img/eshop_logo.png">
<img src="img/eShopOnContainers_Architecture_Diagram.png"> <img src="img/eShopOnContainers_Architecture_Diagram.png">

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 405 KiB

After

Width:  |  Height:  |  Size: 443 KiB

View File

@ -111,6 +111,7 @@
<converters:WebNavigatingEventArgsConverter x:Key="WebNavigatingEventArgsConverter" /> <converters:WebNavigatingEventArgsConverter x:Key="WebNavigatingEventArgsConverter" />
<converters:WebNavigatedEventArgsConverter x:Key="WebNavigatedEventArgsConverter" /> <converters:WebNavigatedEventArgsConverter x:Key="WebNavigatedEventArgsConverter" />
<converters:StringNullOrEmptyBoolConverter x:Key="StringNullOrEmptyBoolConverter" /> <converters:StringNullOrEmptyBoolConverter x:Key="StringNullOrEmptyBoolConverter" />
<converters:DoubleConverter x:Key="DoubleConverter" />
<!-- STYLES --> <!-- STYLES -->
<Style x:Key="ValidationErrorLabelStyle" <Style x:Key="ValidationErrorLabelStyle"

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Globalization;
using eShopOnContainers.Core.Helpers; using eShopOnContainers.Core.Helpers;
using eShopOnContainers.Services; using eShopOnContainers.Services;
using eShopOnContainers.Core.ViewModels.Base; using eShopOnContainers.Core.ViewModels.Base;
@ -79,8 +80,8 @@ namespace eShopOnContainers
var position = await locator.GetPositionAsync(); var position = await locator.GetPositionAsync();
Settings.Latitude = position.Latitude; Settings.Latitude = position.Latitude.ToString();
Settings.Longitude = position.Longitude; Settings.Longitude = position.Longitude.ToString();
} }
else else
{ {
@ -92,8 +93,8 @@ namespace eShopOnContainers
{ {
var location = new Location var location = new Location
{ {
Latitude = Settings.Latitude, Latitude = double.Parse(Settings.Latitude, CultureInfo.InvariantCulture),
Longitude = Settings.Longitude Longitude = double.Parse(Settings.Longitude, CultureInfo.InvariantCulture)
}; };
var locationService = ViewModelLocator.Resolve<ILocationService>(); var locationService = ViewModelLocator.Resolve<ILocationService>();

View File

@ -0,0 +1,24 @@
using System;
using System.Globalization;
using Xamarin.Forms;
namespace eShopOnContainers.Core.Converters
{
public class DoubleConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is double)
return value.ToString();
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
double doub;
if (double.TryParse(value as string, out doub))
return doub;
return value;
}
}
}

View File

@ -69,16 +69,16 @@ namespace eShopOnContainers.Core.Helpers
set => AppSettings.AddOrUpdateValue<bool>(IdUseFakeLocation, value); set => AppSettings.AddOrUpdateValue<bool>(IdUseFakeLocation, value);
} }
public static double Latitude public static string Latitude
{ {
get => AppSettings.GetValueOrDefault<double>(IdLatitude, FakeLatitudeDefault); get => AppSettings.GetValueOrDefault<string>(IdLatitude, FakeLatitudeDefault.ToString());
set => AppSettings.AddOrUpdateValue<double>(IdLatitude, value); set => AppSettings.AddOrUpdateValue<string>(IdLatitude, value);
} }
public static double Longitude public static string Longitude
{ {
get => AppSettings.GetValueOrDefault<double>(IdLongitude, FakeLongitudeDefault); get => AppSettings.GetValueOrDefault<string>(IdLongitude, FakeLongitudeDefault.ToString());
set => AppSettings.AddOrUpdateValue<double>(IdLongitude, value); set => AppSettings.AddOrUpdateValue<string>(IdLongitude, value);
} }
public static bool AllowGpsLocation public static bool AllowGpsLocation

View File

@ -1,4 +1,6 @@
namespace eShopOnContainers.Core.ViewModels using System.Globalization;
namespace eShopOnContainers.Core.ViewModels
{ {
using System.Windows.Input; using System.Windows.Input;
using Xamarin.Forms; using Xamarin.Forms;
@ -34,8 +36,8 @@
_useAzureServices = !Settings.UseMocks; _useAzureServices = !Settings.UseMocks;
_endpoint = Settings.UrlBase; _endpoint = Settings.UrlBase;
_latitude = Settings.Latitude; _latitude = double.Parse(Settings.Latitude, CultureInfo.CurrentCulture);
_longitude = Settings.Longitude; _longitude = double.Parse(Settings.Longitude, CultureInfo.CurrentCulture);
_useFakeLocation = Settings.UseFakeLocation; _useFakeLocation = Settings.UseFakeLocation;
_allowGpsLocation = Settings.AllowGpsLocation; _allowGpsLocation = Settings.AllowGpsLocation;
_gpsWarningMessage = string.Empty; _gpsWarningMessage = string.Empty;
@ -325,13 +327,13 @@
private void UpdateLatitude() private void UpdateLatitude()
{ {
// Update fake latitude (save to local storage) // Update fake latitude (save to local storage)
Settings.Latitude = _latitude; Settings.Latitude = _latitude.ToString();
} }
private void UpdateLongitude() private void UpdateLongitude()
{ {
// Update fake longitude (save to local storage) // Update fake longitude (save to local storage)
Settings.Longitude = _longitude; Settings.Longitude = _longitude.ToString();
} }
private void UpdateAllowGpsLocation() private void UpdateAllowGpsLocation()

View File

@ -219,7 +219,7 @@
Text="Latitude" Text="Latitude"
Style="{StaticResource HeaderLabelStyle}"/> Style="{StaticResource HeaderLabelStyle}"/>
<Entry <Entry
Text="{Binding Latitude, Mode=TwoWay}" Text="{Binding Latitude, Mode=TwoWay, Converter={StaticResource DoubleConverter}}"
Keyboard="Text"> Keyboard="Text">
<Entry.Style> <Entry.Style>
<OnPlatform <OnPlatform
@ -233,7 +233,7 @@
Text="Longitude" Text="Longitude"
Style="{StaticResource HeaderLabelStyle}"/> Style="{StaticResource HeaderLabelStyle}"/>
<Entry <Entry
Text="{Binding Longitude, Mode=TwoWay}" Text="{Binding Longitude, Mode=TwoWay, Converter={StaticResource DoubleConverter}}"
Keyboard="Text"> Keyboard="Text">
<Entry.Style> <Entry.Style>
<OnPlatform <OnPlatform

View File

@ -49,6 +49,7 @@
</Compile> </Compile>
<Compile Include="Controls\CustomTabbedPage.cs" /> <Compile Include="Controls\CustomTabbedPage.cs" />
<Compile Include="Controls\ToggleButton.cs" /> <Compile Include="Controls\ToggleButton.cs" />
<Compile Include="Converters\DoubleConverter.cs" />
<Compile Include="Converters\StringNullOrEmptyBoolConverter.cs" /> <Compile Include="Converters\StringNullOrEmptyBoolConverter.cs" />
<Compile Include="Converters\CountToBoolConverter.cs" /> <Compile Include="Converters\CountToBoolConverter.cs" />
<Compile Include="Converters\DatetimeConverter.cs" /> <Compile Include="Converters\DatetimeConverter.cs" />