Skip to content

Commit cee9125

Browse files
authored
Merge pull request dotnet-architecture#185 from dotnet-architecture/xamarin
Minor fixes to Xamarin client.
2 parents f43839f + a5fe9ca commit cee9125

11 files changed

Lines changed: 26 additions & 159 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public App()
1818

1919
InitApp();
2020

21-
if (Device.OS == TargetPlatform.Windows)
21+
if (Device.RuntimePlatform == Device.Windows)
2222
{
2323
InitNavigation();
2424
}
@@ -40,7 +40,7 @@ protected override async void OnStart()
4040
{
4141
base.OnStart();
4242

43-
if (Device.OS != TargetPlatform.Windows)
43+
if (Device.RuntimePlatform != Device.Windows)
4444
{
4545
await InitNavigation();
4646
}

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Controls/BindablePicker.cs

Lines changed: 0 additions & 130 deletions
This file was deleted.

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Basket/BasketMockService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ public class BasketMockService : IBasketService
1212
BuyerId = "9245fe4a-d402-451c-b9ed-9c1a04247482",
1313
Items = new List<BasketItem>
1414
{
15-
new BasketItem { Id = "1", PictureUrl = Device.OS != TargetPlatform.Windows ? "fake_product_01.png" : "Assets/fake_product_01.png", ProductId = Common.Common.MockCatalogItemId01, ProductName = ".NET Bot Blue Sweatshirt (M)", Quantity = 1, UnitPrice = 19.50M },
16-
new BasketItem { Id = "2", PictureUrl = Device.OS != TargetPlatform.Windows ? "fake_product_04.png" : "Assets/fake_product_04.png", ProductId = Common.Common.MockCatalogItemId04, ProductName = ".NET Black Cupt", Quantity = 1, UnitPrice = 17.00M }
15+
new BasketItem { Id = "1", PictureUrl = Device.RuntimePlatform != Device.Windows ? "fake_product_01.png" : "Assets/fake_product_01.png", ProductId = Common.Common.MockCatalogItemId01, ProductName = ".NET Bot Blue Sweatshirt (M)", Quantity = 1, UnitPrice = 19.50M },
16+
new BasketItem { Id = "2", PictureUrl = Device.RuntimePlatform != Device.Windows ? "fake_product_04.png" : "Assets/fake_product_04.png", ProductId = Common.Common.MockCatalogItemId04, ProductName = ".NET Black Cupt", Quantity = 1, UnitPrice = 17.00M }
1717
}
1818
};
1919

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Catalog/CatalogMockService.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ public class CatalogMockService : ICatalogService
2424

2525
private ObservableCollection<CatalogItem> MockCatalog = new ObservableCollection<CatalogItem>
2626
{
27-
new CatalogItem { Id = Common.Common.MockCatalogItemId01, PictureUri = Device.OS != TargetPlatform.Windows ? "fake_product_01.png" : "Assets/fake_product_01.png", Name = ".NET Bot Blue Sweatshirt (M)", Price = 19.50M, CatalogBrandId = 2, CatalogBrand = "Visual Studio", CatalogTypeId = 2, CatalogType = "T-Shirt" },
28-
new CatalogItem { Id = Common.Common.MockCatalogItemId02, PictureUri = Device.OS != TargetPlatform.Windows ? "fake_product_02.png" : "Assets/fake_product_02.png", Name = ".NET Bot Purple Sweatshirt (M)", Price = 19.50M, CatalogBrandId = 2, CatalogBrand = "Visual Studio", CatalogTypeId = 2, CatalogType = "T-Shirt" },
29-
new CatalogItem { Id = Common.Common.MockCatalogItemId03, PictureUri = Device.OS != TargetPlatform.Windows ? "fake_product_03.png" : "Assets/fake_product_03.png", Name = ".NET Bot Black Sweatshirt (M)", Price = 19.95M, CatalogBrandId = 2, CatalogBrand = "Visual Studio", CatalogTypeId = 2, CatalogType = "T-Shirt" },
30-
new CatalogItem { Id = Common.Common.MockCatalogItemId04, PictureUri = Device.OS != TargetPlatform.Windows ? "fake_product_04.png" : "Assets/fake_product_04.png", Name = ".NET Black Cupt", Price = 17.00M, CatalogBrandId = 2, CatalogBrand = "Visual Studio", CatalogTypeId = 1, CatalogType = "Mug" },
31-
new CatalogItem { Id = Common.Common.MockCatalogItemId05, PictureUri = Device.OS != TargetPlatform.Windows ? "fake_product_05.png" : "Assets/fake_product_05.png", Name = "Azure Black Sweatshirt (M)", Price = 19.50M, CatalogBrandId = 1, CatalogBrand = "Azure", CatalogTypeId = 2, CatalogType = "T-Shirt" }
27+
new CatalogItem { Id = Common.Common.MockCatalogItemId01, PictureUri = Device.RuntimePlatform != Device.Windows ? "fake_product_01.png" : "Assets/fake_product_01.png", Name = ".NET Bot Blue Sweatshirt (M)", Price = 19.50M, CatalogBrandId = 2, CatalogBrand = "Visual Studio", CatalogTypeId = 2, CatalogType = "T-Shirt" },
28+
new CatalogItem { Id = Common.Common.MockCatalogItemId02, PictureUri = Device.RuntimePlatform != Device.Windows ? "fake_product_02.png" : "Assets/fake_product_02.png", Name = ".NET Bot Purple Sweatshirt (M)", Price = 19.50M, CatalogBrandId = 2, CatalogBrand = "Visual Studio", CatalogTypeId = 2, CatalogType = "T-Shirt" },
29+
new CatalogItem { Id = Common.Common.MockCatalogItemId03, PictureUri = Device.RuntimePlatform != Device.Windows ? "fake_product_03.png" : "Assets/fake_product_03.png", Name = ".NET Bot Black Sweatshirt (M)", Price = 19.95M, CatalogBrandId = 2, CatalogBrand = "Visual Studio", CatalogTypeId = 2, CatalogType = "T-Shirt" },
30+
new CatalogItem { Id = Common.Common.MockCatalogItemId04, PictureUri = Device.RuntimePlatform != Device.Windows ? "fake_product_04.png" : "Assets/fake_product_04.png", Name = ".NET Black Cupt", Price = 17.00M, CatalogBrandId = 2, CatalogBrand = "Visual Studio", CatalogTypeId = 1, CatalogType = "Mug" },
31+
new CatalogItem { Id = Common.Common.MockCatalogItemId05, PictureUri = Device.RuntimePlatform != Device.Windows ? "fake_product_05.png" : "Assets/fake_product_05.png", Name = "Azure Black Sweatshirt (M)", Price = 19.50M, CatalogBrandId = 1, CatalogBrand = "Azure", CatalogTypeId = 2, CatalogType = "T-Shirt" }
3232
};
3333

3434
public async Task<ObservableCollection<CatalogItem>> GetCatalogAsync()

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Order/OrderMockService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ public class OrderMockService : IOrderService
5353

5454
private static List<OrderItem> MockOrderItems = new List<OrderItem>()
5555
{
56-
new OrderItem { OrderId = Guid.NewGuid(), ProductId = Common.Common.MockCatalogItemId01, Discount = 15, ProductName = ".NET Bot Blue Sweatshirt (M)", Quantity = 1, UnitPrice = 16.50M, PictureUrl = Device.OS != TargetPlatform.Windows ? "fake_product_01.png" : "Assets/fake_product_01.png" },
57-
new OrderItem { OrderId = Guid.NewGuid(), ProductId = Common.Common.MockCatalogItemId03, Discount = 0, ProductName = ".NET Bot Black Sweatshirt (M)", Quantity = 2, UnitPrice = 19.95M, PictureUrl = Device.OS != TargetPlatform.Windows ? "fake_product_03.png" : "Assets/fake_product_03.png" }
56+
new OrderItem { OrderId = Guid.NewGuid(), ProductId = Common.Common.MockCatalogItemId01, Discount = 15, ProductName = ".NET Bot Blue Sweatshirt (M)", Quantity = 1, UnitPrice = 16.50M, PictureUrl = Device.RuntimePlatform != Device.Windows ? "fake_product_01.png" : "Assets/fake_product_01.png" },
57+
new OrderItem { OrderId = Guid.NewGuid(), ProductId = Common.Common.MockCatalogItemId03, Discount = 0, ProductName = ".NET Bot Black Sweatshirt (M)", Quantity = 2, UnitPrice = 19.95M, PictureUrl = Device.RuntimePlatform != Device.Windows ? "fake_product_03.png" : "Assets/fake_product_03.png" }
5858
};
5959

6060
private static List<CardType> MockCardTypes = new List<CardType>()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private void AddCatalogItem(CatalogItem catalogItem)
102102

103103
private async Task FilterAsync()
104104
{
105-
if (Brand == null && Type == null)
105+
if (Brand == null || Type == null)
106106
{
107107
return;
108108
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@
6060
</Grid.RowDefinitions>
6161
<!-- FILTERS -->
6262
<Grid
63-
BackgroundColor="{StaticResource LightGreenColor}"
64-
IsEnabled="{Binding Products.Count, Converter={StaticResource CountToBoolConverter}}">
63+
BackgroundColor="{StaticResource LightGreenColor}">
6564
<Label
6665
Text="FILTER"
6766
Style="{StaticResource FilterLabelStyle}"/>

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

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
1+
<?xml version="1.0" encoding="UTF-8"?>
22
<slideOverKit:SlideMenuView
33
xmlns="http://xamarin.com/schemas/2014/forms"
44
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
5-
xmlns:slideOverKit="clr-namespace:SlideOverKit"
6-
xmlns:controls="clr-namespace:eShopOnContainers.Core.Controls;assembly=eShopOnContainers.Core"
5+
xmlns:slideOverKit="clr-namespace:SlideOverKit"
76
x:Class="eShopOnContainers.Core.Views.FiltersView"
87
MenuOrientations="TopToBottom"
98
BackgroundColor="{StaticResource BackgroundColor}"
@@ -13,7 +12,7 @@
1312
<ResourceDictionary>
1413

1514
<Style x:Key="FilterPickerStyle"
16-
TargetType="{x:Type controls:BindablePicker}">
15+
TargetType="{x:Type Picker}">
1716
<Setter Property="HeightRequest"
1817
Value="48" />
1918
<Setter Property="BackgroundColor"
@@ -70,35 +69,35 @@
7069
<RowDefinition Height="Auto" />
7170
</Grid.RowDefinitions>
7271
<!-- BRAND -->
73-
<controls:BindablePicker
72+
<Picker
7473
Grid.Row="0"
7574
Title="BRAND"
7675
ItemsSource="{Binding Brands}"
7776
SelectedItem="{Binding Brand, Mode=TwoWay}"
7877
Style="{StaticResource FilterPickerStyle}">
79-
<controls:BindablePicker.HeightRequest>
78+
<Picker.HeightRequest>
8079
<OnPlatform
8180
x:TypeArguments="x:Double"
8281
Android="48"
8382
iOS="48"
8483
WinPhone="36"/>
85-
</controls:BindablePicker.HeightRequest>
86-
</controls:BindablePicker>
84+
</Picker.HeightRequest>
85+
</Picker>
8786
<!-- TYPE -->
88-
<controls:BindablePicker
87+
<Picker
8988
Grid.Row="1"
9089
Title="TYPE"
9190
ItemsSource="{Binding Types}"
9291
SelectedItem="{Binding Type, Mode=TwoWay}"
9392
Style="{StaticResource FilterPickerStyle}">
94-
<controls:BindablePicker.HeightRequest>
93+
<Picker.HeightRequest>
9594
<OnPlatform
9695
x:TypeArguments="x:Double"
9796
Android="48"
9897
iOS="48"
9998
WinPhone="36"/>
100-
</controls:BindablePicker.HeightRequest>
101-
</controls:BindablePicker>
99+
</Picker.HeightRequest>
100+
</Picker>
102101
<Button
103102
Grid.Row="2"
104103
Text="Apply"

src/Mobile/eShopOnContainers/eShopOnContainers.Core/Views/LoginView.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected override void OnDisappearing()
4141

4242
public async Task AnimateIn()
4343
{
44-
if (Device.OS == TargetPlatform.Windows)
44+
if (Device.RuntimePlatform == Device.Windows)
4545
{
4646
return;
4747
}

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

100755100644
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
<Compile Include="Controls\AddBasketButton.xaml.cs">
4848
<DependentUpon>AddBasketButton.xaml</DependentUpon>
4949
</Compile>
50-
<Compile Include="Controls\BindablePicker.cs" />
5150
<Compile Include="Controls\CustomTabbedPage.cs" />
5251
<Compile Include="Controls\ToggleButton.cs" />
5352
<Compile Include="Converters\CountToBoolConverter.cs" />

0 commit comments

Comments
 (0)