Skip to content

Commit ca5ec45

Browse files
committed
ECommerce application related changes are done.
1. Added Cart behavior 2. Image misalignments are corrected in catalog list/tile and feedback view. 3. Xamarin forms version is updated.
1 parent 4cb8800 commit ca5ec45

File tree

13 files changed

+130
-36
lines changed

13 files changed

+130
-36
lines changed

EssentialUIKit.Android/EssentialUIKit.Android.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<PackageReference Include="Xamarin.FFImageLoading.Svg.Forms">
7575
<Version>2.4.11.982</Version>
7676
</PackageReference>
77-
<PackageReference Include="Xamarin.Forms" Version="4.0.0.497661" />
77+
<PackageReference Include="Xamarin.Forms" Version="4.1.0.673156" />
7878
<PackageReference Include="Xamarin.Android.Support.Design" Version="28.0.0.1" />
7979
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.1" />
8080
<PackageReference Include="Xamarin.Android.Support.v4" Version="28.0.0.1" />

EssentialUIKit.UWP/EssentialUIKit.UWP.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
<PackageReference Include="Xamarin.FFImageLoading.Svg.Forms">
203203
<Version>2.4.11.982</Version>
204204
</PackageReference>
205-
<PackageReference Include="Xamarin.Forms" Version="4.0.0.497661" />
205+
<PackageReference Include="Xamarin.Forms" Version="4.1.0.673156" />
206206
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.1.5" />
207207
</ItemGroup>
208208
<ItemGroup>

EssentialUIKit.iOS/EssentialUIKit.iOS.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@
215215
<PackageReference Include="Xamarin.FFImageLoading.Svg.Forms">
216216
<Version>2.4.11.982</Version>
217217
</PackageReference>
218-
<PackageReference Include="Xamarin.Forms" Version="4.0.0.497661" />
218+
<PackageReference Include="Xamarin.Forms" Version="4.1.0.673156" />
219219
</ItemGroup>
220220
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
221221
<ItemGroup>
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
using EssentialUIKit.ViewModels.ECommerce;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Text;
5+
using Xamarin.Forms;
6+
using Xamarin.Forms.Internals;
7+
8+
namespace EssentialUIKit.Behaviors.ECommerce
9+
{
10+
/// <summary>
11+
/// This class extends the behavior of the catalog page and detail page
12+
/// </summary>
13+
[Preserve(AllMembers = true)]
14+
public class CartBehavior : Behavior<ContentPage>
15+
{
16+
#region Fields
17+
18+
private ContentPage bindablePage;
19+
20+
#endregion
21+
22+
#region Method
23+
24+
/// <summary>
25+
/// Invoked when adding catalog page and detail page.
26+
/// </summary>
27+
/// <param name="bindable">ContentPage</param>
28+
protected override void OnAttachedTo(ContentPage bindable)
29+
{
30+
base.OnAttachedTo(bindable);
31+
bindablePage = bindable;
32+
bindable.Appearing += Bindable_Appearing;
33+
}
34+
35+
/// <summary>
36+
/// Invoked when appearing the page.
37+
/// </summary>
38+
/// <param name="sender">ContentPage</param>
39+
/// <param name="e">EventArgs</param>
40+
private void Bindable_Appearing(object sender, EventArgs e)
41+
{
42+
if (bindablePage != null)
43+
{
44+
if (bindablePage.BindingContext is DetailPageViewModel)
45+
{
46+
//TODO: Manage cart item count for detail page
47+
//(bindablePage.BindingContext as DetailPageViewModel).CartItemCount
48+
}
49+
else if (bindablePage.BindingContext is CatalogPageViewModel)
50+
{
51+
//TODO: Manage cart item count for catalog page
52+
//(bindablePage.BindingContext as CatalogPageViewModel).CartItemCount
53+
}
54+
}
55+
}
56+
57+
/// <summary>
58+
/// Invoked when exit from the page.
59+
/// </summary>
60+
/// <param name="bindable">ContentPage</param>
61+
protected override void OnDetachingFrom(ContentPage bindable)
62+
{
63+
base.OnDetachingFrom(bindable);
64+
bindable.Appearing -= Bindable_Appearing;
65+
}
66+
67+
#endregion
68+
}
69+
}

EssentialUIKit/Converters/IntToThicknessConverter.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ public class IntToThicknessConverter : IValueConverter
1414
/// <summary>
1515
/// This method is used to convert the integer to thickness.
1616
/// </summary>
17-
/// <param name="value"></param>
18-
/// <param name="targetType"></param>
19-
/// <param name="parameter"></param>
20-
/// <param name="culture"></param>
21-
/// <returns></returns>
17+
/// <param name="value">Gets the value</param>
18+
/// <param name="targetType">Gets the targetType</param>
19+
/// <param name="parameter">Gets the parameter</param>
20+
/// <param name="culture">Gets the culture</param>
21+
/// <returns>Thickness</returns>
2222
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
2323
{
2424
var margin = new Thickness(0);
2525
if (value != null)
2626
{
2727
int itemCount;
2828
int.TryParse(value.ToString(), out itemCount);
29-
if (itemCount > 0)
29+
if (itemCount == 0 && itemCount > 0)
3030
return margin = new Thickness(0, -15, 0, 0);
3131
}
3232
return margin;
@@ -35,11 +35,11 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
3535
/// <summary>
3636
/// This method is used to convert the thickness to integer.
3737
/// </summary>
38-
/// <param name="value"></param>
39-
/// <param name="targetType"></param>
40-
/// <param name="parameter"></param>
41-
/// <param name="culture"></param>
42-
/// <returns></returns>
38+
/// <param name="value">Gets the value</param>
39+
/// <param name="targetType">Gets the targetType</param>
40+
/// <param name="parameter">Gets the parameter</param>
41+
/// <param name="culture">Gets the culture</param>
42+
/// <returns>true</returns>
4343
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
4444
{
4545
return true;

EssentialUIKit/EssentialUIKit.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<PackageReference Include="Syncfusion.Xamarin.Expander" Version="17.2.0.35" />
3535
<PackageReference Include="Syncfusion.Xamarin.SfBadgeView" Version="17.2.0.35" />
3636
<PackageReference Include="Xamarin.FFImageLoading.Svg.Forms" Version="2.4.11.982" />
37-
<PackageReference Include="Xamarin.Forms" Version="4.0.0.497661" />
37+
<PackageReference Include="Xamarin.Forms" Version="4.1.0.673156" />
3838
<PackageReference Include="Xamarin.FFImageLoading.Forms" Version="2.4.11.982" />
3939
</ItemGroup>
4040
<ItemGroup>

EssentialUIKit/Models/Ecommerce/Product.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public List<string> PreviewImages
6262
{
6363
for (var i = 0; i < previewImages.Count; i++)
6464
{
65-
previewImages[i] = App.BaseImageUrl + previewImages[i];
65+
previewImages[i] = !previewImages[i].Contains(App.BaseImageUrl) ? App.BaseImageUrl + previewImages[i] : previewImages[i];
6666
}
6767

6868
return previewImages;

EssentialUIKit/Models/Ecommerce/Review.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public List<string> Images
4242
{
4343
for (var i = 0; i < images.Count; i++)
4444
{
45-
images[i] = App.BaseImageUrl + images[i];
45+
images[i] = !images[i].Contains(App.BaseImageUrl) ? App.BaseImageUrl + images[i] : images[i];
4646
}
4747

4848
return images;

EssentialUIKit/ViewModels/ContactUs/ContactUsViewModel.cs

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,8 @@ public class ContactUsViewModel : INotifyPropertyChanged
3232
public ContactUsViewModel()
3333
{
3434
this.SendCommand = new Command(this.Send);
35-
this.CustomMarkers = new ObservableCollection<MapMarker>
36-
{
37-
new LocationMarker
38-
{
39-
PinImage = "Pin.png",
40-
Header = "Sipes Inc",
41-
Address = "7654 Cleveland street, Phoenixville, PA 19460",
42-
EmailId = "[email protected]",
43-
PhoneNumber = "+1-202-555-0101",
44-
CloseImage = "Close.png",
45-
Latitude = "40.133808",
46-
Longitude = "-75.516279"
47-
}
48-
};
49-
50-
foreach (var marker in this.CustomMarkers)
51-
{
52-
this.GeoCoordinate = new Point(Convert.ToDouble(marker.Latitude), Convert.ToDouble(marker.Longitude));
53-
}
35+
this.CustomMarkers = new ObservableCollection<MapMarker>();
36+
GetPinLocation();
5437
}
5538

5639
#endregion
@@ -131,6 +114,30 @@ private void Send(object obj)
131114
// Do something
132115
}
133116

117+
/// <summary>
118+
/// This method is for getting the pin location detail.
119+
/// </summary>
120+
public void GetPinLocation()
121+
{
122+
this.CustomMarkers.Add(
123+
new LocationMarker
124+
{
125+
PinImage = "Pin.png",
126+
Header = "Sipes Inc",
127+
Address = "7654 Cleveland street, Phoenixville, PA 19460",
128+
EmailId = "[email protected]",
129+
PhoneNumber = "+1-202-555-0101",
130+
CloseImage = "Close.png",
131+
Latitude = "40.133808",
132+
Longitude = "-75.516279"
133+
});
134+
135+
foreach (var marker in this.CustomMarkers)
136+
{
137+
this.GeoCoordinate = new Point(Convert.ToDouble(marker.Latitude), Convert.ToDouble(marker.Longitude));
138+
}
139+
}
140+
134141
#endregion
135142
}
136143
}

EssentialUIKit/Views/ECommerce/CatalogListPage.xaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
xmlns="http://xamarin.com/schemas/2014/forms"
55
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
66
xmlns:badge ="clr-namespace:Syncfusion.XForms.BadgeView;assembly=Syncfusion.SfBadgeView.XForms"
7+
xmlns:behavior="clr-namespace:EssentialUIKit.Behaviors.ECommerce"
78
xmlns:buttons="clr-namespace:Syncfusion.XForms.Buttons;assembly=Syncfusion.Buttons.XForms"
89
xmlns:controls="clr-namespace:EssentialUIKit.Controls"
910
xmlns:converter="clr-namespace:EssentialUIKit.Converters"
@@ -17,6 +18,10 @@
1718
Shell.NavBarIsVisible="False"
1819
Style="{StaticResource ContentPageStyle}">
1920

21+
<ContentPage.Behaviors>
22+
<behavior:CartBehavior/>
23+
</ContentPage.Behaviors>
24+
2025
<ContentPage.Resources>
2126
<ResourceDictionary>
2227
<converter:BooleanToColorConverter x:Key="boolToColorConverter" />
@@ -110,6 +115,7 @@
110115
Grid.RowSpan="4"
111116
Margin="8,0,16,0"
112117
Aspect="Fill"
118+
DownsampleToViewSize="True"
113119
BackgroundColor="{DynamicResource Gray-F0}"
114120
HeightRequest="{OnIdiom Default=150,
115121
Desktop=120}"

0 commit comments

Comments
 (0)