Skip to content

Commit 7bb1478

Browse files
committed
2 parents d289ec0 + 010f805 commit 7bb1478

10 files changed

Lines changed: 47 additions & 20 deletions

File tree

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ However, this sample application should not be considered as an "eCommerce refer
1414
> 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.
1515
1616
**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.
17-
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.
18-
<p>
19-
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>.
17+
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>.
2018
<p>
2119
<img src="img/eshop_logo.png">
2220
<img src="img/eShopOnContainers_Architecture_Diagram.png">
405 KB
Loading
37.9 KB
Loading

src/Mobile/eShopOnContainers/eShopOnContainers.Core/App.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
<converters:WebNavigatingEventArgsConverter x:Key="WebNavigatingEventArgsConverter" />
112112
<converters:WebNavigatedEventArgsConverter x:Key="WebNavigatedEventArgsConverter" />
113113
<converters:StringNullOrEmptyBoolConverter x:Key="StringNullOrEmptyBoolConverter" />
114+
<converters:DoubleConverter x:Key="DoubleConverter" />
114115

115116
<!-- STYLES -->
116117
<Style x:Key="ValidationErrorLabelStyle"

src/Mobile/eShopOnContainers/eShopOnContainers.Core/App.xaml.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Globalization;
23
using eShopOnContainers.Core.Helpers;
34
using eShopOnContainers.Services;
45
using eShopOnContainers.Core.ViewModels.Base;
@@ -79,8 +80,8 @@ private async Task GetGpsLocation()
7980

8081
var position = await locator.GetPositionAsync();
8182

82-
Settings.Latitude = position.Latitude;
83-
Settings.Longitude = position.Longitude;
83+
Settings.Latitude = position.Latitude.ToString();
84+
Settings.Longitude = position.Longitude.ToString();
8485
}
8586
else
8687
{
@@ -92,8 +93,8 @@ private async Task SendCurrentLocation()
9293
{
9394
var location = new Location
9495
{
95-
Latitude = Settings.Latitude,
96-
Longitude = Settings.Longitude
96+
Latitude = double.Parse(Settings.Latitude, CultureInfo.InvariantCulture),
97+
Longitude = double.Parse(Settings.Longitude, CultureInfo.InvariantCulture)
9798
};
9899

99100
var locationService = ViewModelLocator.Resolve<ILocationService>();
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using System.Globalization;
3+
using Xamarin.Forms;
4+
5+
namespace eShopOnContainers.Core.Converters
6+
{
7+
public class DoubleConverter : IValueConverter
8+
{
9+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
10+
{
11+
if (value is double)
12+
return value.ToString();
13+
return value;
14+
}
15+
16+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
17+
{
18+
double doub;
19+
if (double.TryParse(value as string, out doub))
20+
return doub;
21+
return value;
22+
}
23+
}
24+
}

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Helpers/Settings.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,16 @@ public static bool UseFakeLocation
6969
set => AppSettings.AddOrUpdateValue<bool>(IdUseFakeLocation, value);
7070
}
7171

72-
public static double Latitude
72+
public static string Latitude
7373
{
74-
get => AppSettings.GetValueOrDefault<double>(IdLatitude, FakeLatitudeDefault);
75-
set => AppSettings.AddOrUpdateValue<double>(IdLatitude, value);
74+
get => AppSettings.GetValueOrDefault<string>(IdLatitude, FakeLatitudeDefault.ToString());
75+
set => AppSettings.AddOrUpdateValue<string>(IdLatitude, value);
7676
}
7777

78-
public static double Longitude
78+
public static string Longitude
7979
{
80-
get => AppSettings.GetValueOrDefault<double>(IdLongitude, FakeLongitudeDefault);
81-
set => AppSettings.AddOrUpdateValue<double>(IdLongitude, value);
80+
get => AppSettings.GetValueOrDefault<string>(IdLongitude, FakeLongitudeDefault.ToString());
81+
set => AppSettings.AddOrUpdateValue<string>(IdLongitude, value);
8282
}
8383

8484
public static bool AllowGpsLocation

src/Mobile/eShopOnContainers/eShopOnContainers.Core/ViewModels/SettingsViewModel.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace eShopOnContainers.Core.ViewModels
1+
using System.Globalization;
2+
3+
namespace eShopOnContainers.Core.ViewModels
24
{
35
using System.Windows.Input;
46
using Xamarin.Forms;
@@ -34,8 +36,8 @@ public SettingsViewModel(ILocationService locationService)
3436

3537
_useAzureServices = !Settings.UseMocks;
3638
_endpoint = Settings.UrlBase;
37-
_latitude = Settings.Latitude;
38-
_longitude = Settings.Longitude;
39+
_latitude = double.Parse(Settings.Latitude, CultureInfo.CurrentCulture);
40+
_longitude = double.Parse(Settings.Longitude, CultureInfo.CurrentCulture);
3941
_useFakeLocation = Settings.UseFakeLocation;
4042
_allowGpsLocation = Settings.AllowGpsLocation;
4143
_gpsWarningMessage = string.Empty;
@@ -325,13 +327,13 @@ private void UpdateFakeLocation()
325327
private void UpdateLatitude()
326328
{
327329
// Update fake latitude (save to local storage)
328-
Settings.Latitude = _latitude;
330+
Settings.Latitude = _latitude.ToString();
329331
}
330332

331333
private void UpdateLongitude()
332334
{
333335
// Update fake longitude (save to local storage)
334-
Settings.Longitude = _longitude;
336+
Settings.Longitude = _longitude.ToString();
335337
}
336338

337339
private void UpdateAllowGpsLocation()

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/SettingsView.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@
219219
Text="Latitude"
220220
Style="{StaticResource HeaderLabelStyle}"/>
221221
<Entry
222-
Text="{Binding Latitude, Mode=TwoWay}"
222+
Text="{Binding Latitude, Mode=TwoWay, Converter={StaticResource DoubleConverter}}"
223223
Keyboard="Text">
224224
<Entry.Style>
225225
<OnPlatform
@@ -233,7 +233,7 @@
233233
Text="Longitude"
234234
Style="{StaticResource HeaderLabelStyle}"/>
235235
<Entry
236-
Text="{Binding Longitude, Mode=TwoWay}"
236+
Text="{Binding Longitude, Mode=TwoWay, Converter={StaticResource DoubleConverter}}"
237237
Keyboard="Text">
238238
<Entry.Style>
239239
<OnPlatform

src/Mobile/eShopOnContainers/eShopOnContainers.Core/eShopOnContainers.Core.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
</Compile>
5050
<Compile Include="Controls\CustomTabbedPage.cs" />
5151
<Compile Include="Controls\ToggleButton.cs" />
52+
<Compile Include="Converters\DoubleConverter.cs" />
5253
<Compile Include="Converters\StringNullOrEmptyBoolConverter.cs" />
5354
<Compile Include="Converters\CountToBoolConverter.cs" />
5455
<Compile Include="Converters\DatetimeConverter.cs" />

0 commit comments

Comments
 (0)