From 3178ce7ac9798ff37f2bc40d3b4bba1950de2b31 Mon Sep 17 00:00:00 2001 From: Brice Friha Date: Sun, 22 Sep 2019 18:06:13 +0200 Subject: [PATCH 01/14] Updating NuGet --- .../CarouselViewChallenge.Android.csproj | 6 +++--- .../CarouselViewChallenge.UWP.csproj | 8 ++++---- .../CarouselViewChallenge.iOS.csproj | 4 ++-- .../CarouselViewChallenge/CarouselViewChallenge.csproj | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CarouselViewChallenge/CarouselViewChallenge.Android/CarouselViewChallenge.Android.csproj b/CarouselViewChallenge/CarouselViewChallenge.Android/CarouselViewChallenge.Android.csproj index 1e33499..fe257b3 100644 --- a/CarouselViewChallenge/CarouselViewChallenge.Android/CarouselViewChallenge.Android.csproj +++ b/CarouselViewChallenge/CarouselViewChallenge.Android/CarouselViewChallenge.Android.csproj @@ -54,8 +54,8 @@ - - + + @@ -101,4 +101,4 @@ - + \ No newline at end of file diff --git a/CarouselViewChallenge/CarouselViewChallenge.UWP/CarouselViewChallenge.UWP.csproj b/CarouselViewChallenge/CarouselViewChallenge.UWP/CarouselViewChallenge.UWP.csproj index 4b6b2c9..749af82 100644 --- a/CarouselViewChallenge/CarouselViewChallenge.UWP/CarouselViewChallenge.UWP.csproj +++ b/CarouselViewChallenge/CarouselViewChallenge.UWP/CarouselViewChallenge.UWP.csproj @@ -11,7 +11,7 @@ CarouselViewChallenge.UWP en-US UAP - 10.0.17763.0 + 10.0.18362.0 10.0.16299.0 14 true @@ -146,8 +146,8 @@ - - + + @@ -159,4 +159,4 @@ 14.0 - + \ No newline at end of file diff --git a/CarouselViewChallenge/CarouselViewChallenge.iOS/CarouselViewChallenge.iOS.csproj b/CarouselViewChallenge/CarouselViewChallenge.iOS/CarouselViewChallenge.iOS.csproj index 6241d2c..f5738b9 100644 --- a/CarouselViewChallenge/CarouselViewChallenge.iOS/CarouselViewChallenge.iOS.csproj +++ b/CarouselViewChallenge/CarouselViewChallenge.iOS/CarouselViewChallenge.iOS.csproj @@ -130,7 +130,7 @@ - + @@ -139,4 +139,4 @@ CarouselViewChallenge - + \ No newline at end of file diff --git a/CarouselViewChallenge/CarouselViewChallenge/CarouselViewChallenge.csproj b/CarouselViewChallenge/CarouselViewChallenge/CarouselViewChallenge.csproj index a58ec88..b3669c3 100644 --- a/CarouselViewChallenge/CarouselViewChallenge/CarouselViewChallenge.csproj +++ b/CarouselViewChallenge/CarouselViewChallenge/CarouselViewChallenge.csproj @@ -7,7 +7,7 @@ - + From 292ca47fc73fecedcba35309300b170759c8eb30 Mon Sep 17 00:00:00 2001 From: Brice Friha Date: Sun, 22 Sep 2019 18:11:41 +0200 Subject: [PATCH 02/14] I imported medels and viewmodels --- .../CarouselViewChallenge.csproj | 4 -- .../CarouselViewChallenge/Models/Game.cs | 19 +++++++ .../ViewModels/BaseViewModel.cs | 23 ++++++++ .../ViewModels/ListGamesViewModel.cs | 57 +++++++++++++++++++ 4 files changed, 99 insertions(+), 4 deletions(-) create mode 100644 CarouselViewChallenge/CarouselViewChallenge/Models/Game.cs create mode 100644 CarouselViewChallenge/CarouselViewChallenge/ViewModels/BaseViewModel.cs create mode 100644 CarouselViewChallenge/CarouselViewChallenge/ViewModels/ListGamesViewModel.cs diff --git a/CarouselViewChallenge/CarouselViewChallenge/CarouselViewChallenge.csproj b/CarouselViewChallenge/CarouselViewChallenge/CarouselViewChallenge.csproj index b3669c3..e6724ce 100644 --- a/CarouselViewChallenge/CarouselViewChallenge/CarouselViewChallenge.csproj +++ b/CarouselViewChallenge/CarouselViewChallenge/CarouselViewChallenge.csproj @@ -10,10 +10,6 @@ - - - - WelcomePage.xaml diff --git a/CarouselViewChallenge/CarouselViewChallenge/Models/Game.cs b/CarouselViewChallenge/CarouselViewChallenge/Models/Game.cs new file mode 100644 index 0000000..7f8f841 --- /dev/null +++ b/CarouselViewChallenge/CarouselViewChallenge/Models/Game.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ColumbiaMobileProject.Models +{ + public class Game + { + public string Id { get; set; } + public string Name { get; set; } + public string Img { get; set; } + public string Platform { get; set; } + public string Key { get; set; } + public string State { get; set; } + //public Visibility ShowKey { get; set; } + public bool BtnState { get; set; } + //public Brush StateColor { get; set; } + } +} diff --git a/CarouselViewChallenge/CarouselViewChallenge/ViewModels/BaseViewModel.cs b/CarouselViewChallenge/CarouselViewChallenge/ViewModels/BaseViewModel.cs new file mode 100644 index 0000000..d2f9820 --- /dev/null +++ b/CarouselViewChallenge/CarouselViewChallenge/ViewModels/BaseViewModel.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Text; + +namespace ColumbiaMobileProject.ViewModels +{ + public abstract class BaseViewModel : INotifyPropertyChanged + { + protected BaseViewModel() + { + + } + + public event PropertyChangedEventHandler PropertyChanged; + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + } +} diff --git a/CarouselViewChallenge/CarouselViewChallenge/ViewModels/ListGamesViewModel.cs b/CarouselViewChallenge/CarouselViewChallenge/ViewModels/ListGamesViewModel.cs new file mode 100644 index 0000000..2af1c33 --- /dev/null +++ b/CarouselViewChallenge/CarouselViewChallenge/ViewModels/ListGamesViewModel.cs @@ -0,0 +1,57 @@ +using ColumbiaMobileProject.Models; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; + +namespace ColumbiaMobileProject.ViewModels +{ + class ListGamesViewModel : BaseViewModel + { + Game selectedGame; + public Game SelectedGame + { + get { return selectedGame; } + set + { + selectedGame = value; + OnPropertyChanged(); + } + } + //get a collection of Game Model + ObservableCollection games; + public ObservableCollection Games + { + get { return games; } + set + { + games = value; + OnPropertyChanged(); + } + } + + public ListGamesViewModel() + { + Games = new ObservableCollection(); + Games.Add(new Game + { + Name = "Watchdog", + Img = @"http://static2.gamespot.com/uploads/scale_medium/1197/11970954/2309326-watchdogs.jpg", + Platform = "Uplay" + }); + + Games.Add(new Game + { + Name = "We Happy Few", + Img = @"https://pbs.twimg.com/profile_images/897864241566294017/QCYJPjVX_400x400.jpg", + Platform = "Steam" + }); + Games.Add(new Game + { + Name = "FIFA 19", + Img = @"https://cdn.gamer-network.net/2018/usgamer/FIFA-19-ronaldo.jpg", + Platform = "Origin" + }); + } + } +} From 52c11ce3513561f601665102919b13f78c89d64d Mon Sep 17 00:00:00 2001 From: Brice Friha Date: Sun, 22 Sep 2019 18:20:37 +0200 Subject: [PATCH 03/14] Show the games on the carouselview --- .../CarouselViewChallenge/Models/Game.cs | 2 +- .../ViewModels/BaseViewModel.cs | 2 +- .../ViewModels/ListGamesViewModel.cs | 4 ++-- .../Views/CarouselViewChallengePage.xaml | 24 ++++++++++++++++--- .../Views/CarouselViewChallengePage.xaml.cs | 5 +++- 5 files changed, 29 insertions(+), 8 deletions(-) diff --git a/CarouselViewChallenge/CarouselViewChallenge/Models/Game.cs b/CarouselViewChallenge/CarouselViewChallenge/Models/Game.cs index 7f8f841..7217af7 100644 --- a/CarouselViewChallenge/CarouselViewChallenge/Models/Game.cs +++ b/CarouselViewChallenge/CarouselViewChallenge/Models/Game.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace ColumbiaMobileProject.Models +namespace CarouselViewChallenge.Models { public class Game { diff --git a/CarouselViewChallenge/CarouselViewChallenge/ViewModels/BaseViewModel.cs b/CarouselViewChallenge/CarouselViewChallenge/ViewModels/BaseViewModel.cs index d2f9820..dd0cdc2 100644 --- a/CarouselViewChallenge/CarouselViewChallenge/ViewModels/BaseViewModel.cs +++ b/CarouselViewChallenge/CarouselViewChallenge/ViewModels/BaseViewModel.cs @@ -4,7 +4,7 @@ using System.Runtime.CompilerServices; using System.Text; -namespace ColumbiaMobileProject.ViewModels +namespace CarouselViewChallenge.ViewModels { public abstract class BaseViewModel : INotifyPropertyChanged { diff --git a/CarouselViewChallenge/CarouselViewChallenge/ViewModels/ListGamesViewModel.cs b/CarouselViewChallenge/CarouselViewChallenge/ViewModels/ListGamesViewModel.cs index 2af1c33..6140861 100644 --- a/CarouselViewChallenge/CarouselViewChallenge/ViewModels/ListGamesViewModel.cs +++ b/CarouselViewChallenge/CarouselViewChallenge/ViewModels/ListGamesViewModel.cs @@ -1,10 +1,10 @@ -using ColumbiaMobileProject.Models; +using CarouselViewChallenge.Models; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Text; -namespace ColumbiaMobileProject.ViewModels +namespace CarouselViewChallenge.ViewModels { class ListGamesViewModel : BaseViewModel { diff --git a/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml b/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml index 1a7cc0d..9b9434a 100644 --- a/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml +++ b/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml @@ -6,8 +6,26 @@ mc:Ignorable="d" x:Class="CarouselViewChallenge.Views.CarouselViewChallengePage"> - - + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml.cs b/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml.cs index 38f2e9f..7966207 100644 --- a/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml.cs +++ b/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; - +using CarouselViewChallenge.ViewModels; using Xamarin.Forms; using Xamarin.Forms.Xaml; @@ -15,6 +15,9 @@ public partial class CarouselViewChallengePage : ContentPage public CarouselViewChallengePage() { InitializeComponent(); + + // Bind the view with viewmodel + BindingContext = new ListGamesViewModel(); } } } \ No newline at end of file From e6c58874dd9eccabbb17bd4213a9248bcf6b99fe Mon Sep 17 00:00:00 2001 From: Brice Friha Date: Sun, 22 Sep 2019 18:23:26 +0200 Subject: [PATCH 04/14] Cleaning Up --- .../Views/CarouselViewChallengePage.xaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml b/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml index 9b9434a..a0d80cc 100644 --- a/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml +++ b/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml @@ -17,11 +17,6 @@ diff --git a/CarouselViewChallenge/CarouselViewChallenge.UWP/CarouselViewChallenge.UWP.csproj b/CarouselViewChallenge/CarouselViewChallenge.UWP/CarouselViewChallenge.UWP.csproj index 749af82..7474a6f 100644 --- a/CarouselViewChallenge/CarouselViewChallenge.UWP/CarouselViewChallenge.UWP.csproj +++ b/CarouselViewChallenge/CarouselViewChallenge.UWP/CarouselViewChallenge.UWP.csproj @@ -148,6 +148,9 @@ + + 1.2.1 + diff --git a/CarouselViewChallenge/CarouselViewChallenge.iOS/CarouselViewChallenge.iOS.csproj b/CarouselViewChallenge/CarouselViewChallenge.iOS/CarouselViewChallenge.iOS.csproj index f5738b9..eccff31 100644 --- a/CarouselViewChallenge/CarouselViewChallenge.iOS/CarouselViewChallenge.iOS.csproj +++ b/CarouselViewChallenge/CarouselViewChallenge.iOS/CarouselViewChallenge.iOS.csproj @@ -131,6 +131,9 @@ + + 1.2.1 + diff --git a/CarouselViewChallenge/CarouselViewChallenge/CarouselViewChallenge.csproj b/CarouselViewChallenge/CarouselViewChallenge/CarouselViewChallenge.csproj index e6724ce..b89eb14 100644 --- a/CarouselViewChallenge/CarouselViewChallenge/CarouselViewChallenge.csproj +++ b/CarouselViewChallenge/CarouselViewChallenge/CarouselViewChallenge.csproj @@ -7,7 +7,8 @@ - + + diff --git a/CarouselViewChallenge/CarouselViewChallenge/ViewModels/ListGamesViewModel.cs b/CarouselViewChallenge/CarouselViewChallenge/ViewModels/ListGamesViewModel.cs index 14f9873..95aa44a 100644 --- a/CarouselViewChallenge/CarouselViewChallenge/ViewModels/ListGamesViewModel.cs +++ b/CarouselViewChallenge/CarouselViewChallenge/ViewModels/ListGamesViewModel.cs @@ -33,12 +33,7 @@ public ObservableCollection Games public ListGamesViewModel() { Games = new ObservableCollection(); - Games.Add(new Game - { - Name = "Anno 1800", - Img = @"https://s3.gaming-cdn.com/images/products/2249/271x377/anno-1800-cover.jpg", - Platform = "Uplay" - }); + Games.Add(new Game { @@ -47,6 +42,12 @@ public ListGamesViewModel() Platform = "Steam" }); Games.Add(new Game + { + Name = "Anno 1800", + Img = @"https://s3.gaming-cdn.com/images/products/2249/271x377/anno-1800-cover.jpg", + Platform = "Uplay" + }); + Games.Add(new Game { Name = "FIFA 19", Img = @"https://cdn.gamer-network.net/2018/usgamer/FIFA-19-ronaldo.jpg", diff --git a/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml b/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml index d3d21d3..a6c0007 100644 --- a/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml +++ b/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml @@ -3,60 +3,79 @@ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:d="http://xamarin.com/schemas/2014/forms/design" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:pancakeview="clr-namespace:Xamarin.Forms.PancakeView;assembly=Xamarin.Forms.PancakeView" + xmlns:yummy="clr-namespace:Xamarin.Forms.PancakeView;assembly=Xamarin.Forms.PancakeView" mc:Ignorable="d" x:Class="CarouselViewChallenge.Views.CarouselViewChallengePage"> - + - + + - - - - + + + + - - - - - - + + + + + + + + + + - + + - + diff --git a/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml.cs b/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml.cs index 7966207..2253813 100644 --- a/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml.cs +++ b/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml.cs @@ -19,5 +19,10 @@ public CarouselViewChallengePage() // Bind the view with viewmodel BindingContext = new ListGamesViewModel(); } + + private async void CarouselView_Focused(object sender, FocusEventArgs e) + { + + } } } \ No newline at end of file From 741514575a1a7533c586e58d83df0185d2997324 Mon Sep 17 00:00:00 2001 From: Brice Friha Date: Sun, 22 Sep 2019 22:34:57 +0200 Subject: [PATCH 10/14] I displayed the price for each games --- .../CarouselViewChallenge/Models/Game.cs | 1 + .../ViewModels/ListGamesViewModel.cs | 13 +++++--- .../Views/CarouselViewChallengePage.xaml | 33 ++++++++++++++----- 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/CarouselViewChallenge/CarouselViewChallenge/Models/Game.cs b/CarouselViewChallenge/CarouselViewChallenge/Models/Game.cs index 7217af7..25477fb 100644 --- a/CarouselViewChallenge/CarouselViewChallenge/Models/Game.cs +++ b/CarouselViewChallenge/CarouselViewChallenge/Models/Game.cs @@ -14,6 +14,7 @@ public class Game public string State { get; set; } //public Visibility ShowKey { get; set; } public bool BtnState { get; set; } + public string Price { get; set; } //public Brush StateColor { get; set; } } } diff --git a/CarouselViewChallenge/CarouselViewChallenge/ViewModels/ListGamesViewModel.cs b/CarouselViewChallenge/CarouselViewChallenge/ViewModels/ListGamesViewModel.cs index 95aa44a..c959cee 100644 --- a/CarouselViewChallenge/CarouselViewChallenge/ViewModels/ListGamesViewModel.cs +++ b/CarouselViewChallenge/CarouselViewChallenge/ViewModels/ListGamesViewModel.cs @@ -39,19 +39,22 @@ public ListGamesViewModel() { Name = "We Happy Few", Img = @"https://pbs.twimg.com/profile_images/897864241566294017/QCYJPjVX_400x400.jpg", - Platform = "Steam" + Platform = "Steam", + Price = "18.77€", }); Games.Add(new Game { Name = "Anno 1800", Img = @"https://s3.gaming-cdn.com/images/products/2249/271x377/anno-1800-cover.jpg", - Platform = "Uplay" + Platform = "Uplay", + Price = "41.69€", }); Games.Add(new Game { - Name = "FIFA 19", - Img = @"https://cdn.gamer-network.net/2018/usgamer/FIFA-19-ronaldo.jpg", - Platform = "Origin" + Name = "Quantum Break", + Img = @"https://s1.qwant.com/thumbr/0x380/8/e/33fd35a2e5b3ef2ac390ac1440b0a17d8f4c17a12bdd1b4cdad5eb6bfc1c28/quantum-break-cover.jpg?u=http%3A%2F%2Fgamepreorders.com%2Fwp-content%2Fuploads%2F2016%2F02%2Fquantum-break-cover.jpg&q=0&b=1&p=0&a=1", + Platform = "Origin", + Price = "10.51€", }); } } diff --git a/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml b/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml index a6c0007..5efe3d7 100644 --- a/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml +++ b/CarouselViewChallenge/CarouselViewChallenge/Views/CarouselViewChallengePage.xaml @@ -6,7 +6,8 @@ xmlns:pancakeview="clr-namespace:Xamarin.Forms.PancakeView;assembly=Xamarin.Forms.PancakeView" xmlns:yummy="clr-namespace:Xamarin.Forms.PancakeView;assembly=Xamarin.Forms.PancakeView" mc:Ignorable="d" - x:Class="CarouselViewChallenge.Views.CarouselViewChallengePage"> + x:Class="CarouselViewChallenge.Views.CarouselViewChallengePage" + > - + @@ -67,12 +68,28 @@ - - + -