File tree Expand file tree Collapse file tree
src/Mobile/eShopOnContainers/eShopOnContainers.Core Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -99,39 +99,25 @@ public override async Task InitializeAsync(object navigationData)
9999
100100 private void AddCatalogItem ( CatalogItem item )
101101 {
102- if ( BasketItems . Any ( o => o . ProductId . Equals ( item . Id , StringComparison . CurrentCultureIgnoreCase ) ) )
102+ BasketItems . Add ( new BasketItem
103103 {
104- var orderItem = BasketItems . First ( o => o . ProductId . Equals ( item . Id , StringComparison . CurrentCultureIgnoreCase ) ) ;
105- orderItem . Quantity ++ ;
106- }
107- else
108- {
109- BasketItems . Add ( new BasketItem
110- {
111- ProductId = item . Id ,
112- ProductName = item . Name ,
113- PictureUrl = item . PictureUri ,
114- UnitPrice = item . Price ,
115- Quantity = 1
116- } ) ;
117- }
104+ ProductId = item . Id ,
105+ ProductName = item . Name ,
106+ PictureUrl = item . PictureUri ,
107+ UnitPrice = item . Price ,
108+ Quantity = 1
109+ } ) ;
118110
119111 ReCalculateTotal ( ) ;
120112 }
121113
122- private void AddItem ( BasketItem parameter )
114+ private void AddItem ( BasketItem item )
123115 {
124116 BadgeCount ++ ;
125117
126- var basketItem = BasketItems
127- . FirstOrDefault ( bi => bi . ProductId . Equals ( parameter . ProductId ,
128- StringComparison . CurrentCultureIgnoreCase ) ) ;
129-
130- basketItem . Quantity ++ ;
118+ AddBasketItem ( item ) ;
131119
132120 RaisePropertyChanged ( ( ) => BasketItems ) ;
133-
134- ReCalculateTotal ( ) ;
135121 }
136122
137123 private void AddBasketItem ( BasketItem item )
Original file line number Diff line number Diff line change 99 <ContentPage .Resources>
1010 <ResourceDictionary >
1111
12- <Style x : Key =" LogoutLabelStyle"
13- TargetType =" {x:Type Label}" >
14- <Setter Property =" HorizontalOptions"
15- Value =" Center" />
16- <Setter Property =" VerticalOptions"
17- Value =" Center" />
18- </Style >
19-
2012 <Style x : Key =" LoginButtonStyle"
2113 TargetType =" {x:Type Label}" >
2214 <Setter Property =" FontFamily"
5547 <RowDefinition Height =" *" />
5648 </Grid .RowDefinitions>
5749 <!-- LOG OUT BUTTON -->
58- <Grid
50+ <Button
5951 Grid.Row=" 0"
60- BackgroundColor =" {StaticResource GrayColor}" >
61- <Label
62- Text =" LOG OUT"
63- Style =" {StaticResource LogoutLabelStyle}" />
64- <Grid .GestureRecognizers>
65- <TapGestureRecognizer
66- Command =" {Binding LogoutCommand}"
67- NumberOfTapsRequired =" 1" />
68- </Grid .GestureRecognizers>
69- </Grid >
52+ Text =" LOG OUT"
53+ TextColor =" {StaticResource BlackColor}"
54+ BackgroundColor =" {StaticResource GrayColor}"
55+ Command =" {Binding LogoutCommand}" />
7056 <!-- ORDERS -->
7157 <Grid
7258 Grid.Row=" 1" >
Original file line number Diff line number Diff line change 8686 <RowDefinition Height =" 1" />
8787 </Grid .RowDefinitions>
8888 <!-- IMAGE -->
89- <ffimageloading : CachedImage
89+ <Image
9090 Grid.Column=" 0"
9191 Grid.Row=" 0"
9292 Source =" {Binding PictureUrl, Converter={StaticResource ImageConverter}}"
93- CacheDuration =" 30"
94- CacheType =" Disk"
95- DownsampleToViewSize =" True"
9693 HeightRequest =" 108"
9794 WidthRequest =" 108"
9895 Aspect =" AspectFit"
9996 VerticalOptions =" Start"
100- Margin =" 12,0,0,0" >
101- <ffimageloading : CachedImage .LoadingPlaceholder>
102- <OnPlatform
103- x : TypeArguments =" ImageSource"
104- iOS =" default_product"
105- Android =" default_product"
106- WinPhone =" Assets/default_product.png" />
107- </ffimageloading : CachedImage .LoadingPlaceholder>
108- <ffimageloading : CachedImage .ErrorPlaceholder>
109- <OnPlatform
110- x : TypeArguments =" ImageSource"
111- iOS =" noimage"
112- Android =" noimage"
113- WinPhone =" Assets/noimage.png" />
114- </ffimageloading : CachedImage .ErrorPlaceholder>
115- </ffimageloading : CachedImage >
97+ Margin =" 12,0,0,0" />
11698 <Grid
11799 Grid.Column=" 1"
118100 Grid.Row=" 0"
Original file line number Diff line number Diff line change 7070 <RowDefinition Height =" 1" />
7171 </Grid .RowDefinitions>
7272 <!-- IMAGE -->
73- <ffimageloading : CachedImage
73+ <Image
7474 Grid.Column=" 0"
7575 Grid.Row=" 0"
7676 Source =" {Binding PictureUrl, Converter={StaticResource ImageConverter}}"
77- CacheDuration =" 30"
78- CacheType =" Disk"
79- DownsampleToViewSize =" True"
8077 HeightRequest =" 108"
8178 WidthRequest =" 108"
8279 Aspect =" AspectFit"
8380 VerticalOptions =" Start"
84- Margin =" 12,0,0,0" >
85- <ffimageloading : CachedImage .LoadingPlaceholder>
86- <OnPlatform
87- x : TypeArguments =" ImageSource"
88- iOS =" default_product"
89- Android =" default_product"
90- WinPhone =" Assets/default_product.png" />
91- </ffimageloading : CachedImage .LoadingPlaceholder>
92- <ffimageloading : CachedImage .ErrorPlaceholder>
93- <OnPlatform
94- x : TypeArguments =" ImageSource"
95- iOS =" noimage"
96- Android =" noimage"
97- WinPhone =" Assets/noimage.png" />
98- </ffimageloading : CachedImage .ErrorPlaceholder>
99- </ffimageloading : CachedImage >
81+ Margin =" 12,0,0,0" />
10082 <Grid
10183 Grid.Column=" 1"
10284 Grid.Row=" 0"
Original file line number Diff line number Diff line change 7474 <ffimageloading : CachedImage
7575 Grid.Row=" 0"
7676 Source =" {Binding PictureUri}"
77- CacheDuration =" 30"
78- CacheType =" Disk"
79- DownsampleToViewSize =" True"
8077 Aspect =" AspectFill" >
8178 <ffimageloading : CachedImage .LoadingPlaceholder>
8279 <OnPlatform
You can’t perform that action at this time.
0 commit comments