Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.3.0.819712-pre2" />
<PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.1" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.0" />
<PackageReference Include="Xamarin.Android.Support.Core.Utils" Version="28.0.0.3" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
<PackageReference Include="Xamarin.Forms.PancakeView">
<Version>1.2.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Compile Include="MainActivity.cs" />
Expand Down Expand Up @@ -101,4 +104,4 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<AssemblyName>CarouselViewChallenge.UWP</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.17763.0</TargetPlatformVersion>
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
Expand Down Expand Up @@ -146,8 +146,11 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.3.0.819712-pre2" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.1.9" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.0" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.9" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
<PackageReference Include="Xamarin.Forms.PancakeView">
<Version>1.2.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CarouselViewChallenge\CarouselViewChallenge.csproj">
Expand All @@ -159,4 +162,4 @@
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.3.0.819712-pre2" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.0" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
<PackageReference Include="Xamarin.Forms.PancakeView">
<Version>1.2.1</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup>
Expand All @@ -139,4 +142,4 @@
<Name>CarouselViewChallenge</Name>
</ProjectReference>
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@

<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.3.0.819712-pre2" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.0" />
</ItemGroup>

<ItemGroup>
<Folder Include="Models\" />
<PackageReference Include="Xamarin.Essentials" Version="1.3.1" />
<PackageReference Include="Xamarin.Forms.PancakeView" Version="1.2.1" />
</ItemGroup>

<ItemGroup>
Expand Down
90 changes: 90 additions & 0 deletions CarouselViewChallenge/CarouselViewChallenge/Models/CarouselItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Text;

namespace CarouselViewChallenge.Models
{
public class CarouselItem : Game, INotifyPropertyChanged
{
private double _position;
private double _rotation;
private double _scale;
private double _width;
private double _height;
private double _margin;

public CarouselItem()
{
Scale = 1;
Height = 450;
Margin = 15;

}

public double Position
{
get { return _position; }
set
{
_position = value;
OnPropertyChanged();
}
}

public double Rotation
{
get { return _rotation; }
set
{
_rotation = value;
OnPropertyChanged();
}
}

public double Scale
{
get { return _scale; }
set
{
_scale = value;
OnPropertyChanged();
}
}
public double Height
{
get { return _height; }
set
{
_height = value;
OnPropertyChanged();
}
}
public double Width
{
get { return _width; }
set
{
_width = value;
OnPropertyChanged();
}
}
public double Margin
{
get { return _margin; }
set
{
_margin = value;
OnPropertyChanged();
}
}

public event PropertyChangedEventHandler PropertyChanged;

protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
21 changes: 21 additions & 0 deletions CarouselViewChallenge/CarouselViewChallenge/Models/Game.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace CarouselViewChallenge.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 string Price { get; set; }
public string Genre { get; set; }
//public Brush StateColor { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Text;

namespace CarouselViewChallenge.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));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using CarouselViewChallenge.Models;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;

namespace CarouselViewChallenge.ViewModels
{
class ListGamesViewModel : BaseViewModel
{
Game selectedGame;
public Game SelectedGame
{
get { return selectedGame; }
set
{
selectedGame = value;
OnPropertyChanged();
}
}
//get a collection of Game Model
ObservableCollection<CarouselItem> games;
public ObservableCollection<CarouselItem> Games
{
get { return games; }
set
{
games = value;
OnPropertyChanged();
}
}

public ListGamesViewModel()
{
Games = new ObservableCollection<CarouselItem>();


Games.Add(new CarouselItem
{
Name = "We Happy Few",
Img = @"https://pbs.twimg.com/profile_images/897864241566294017/QCYJPjVX_400x400.jpg",
Platform = "Steam",
Genre = "Stealth",
Price = "18.77€",
});
Games.Add(new CarouselItem
{
Name = "Anno 1800",
Img = @"https://s3.gaming-cdn.com/images/products/2249/271x377/anno-1800-cover.jpg",
Platform = "Uplay",
Genre = "Strategy",
Price = "41.69€",
});
Games.Add(new CarouselItem
{
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 = "Microsoft store",
Genre = "Narrative",
Price = "10.51€",
});
Games.Add(new CarouselItem
{
Name = "Sherlock Holmes: The Devil's Daughter",
Img = @"https://s2.qwant.com/thumbr/0x380/6/f/d59c12435321285615b8193a2eb980646956ef51ba05fbc96df12920e45f76/3003937-xb1_esrb_3d.jpg?u=https%3A%2F%2Fstatic.gamespot.com%2Fuploads%2Fscale_medium%2F1197%2F11970954%2F3003937-xb1_esrb_3d.jpg&q=0&b=1&p=0&a=1",
Platform = "Origin",
Genre = "Detective",
Price = "8.45€",
});
}
}
}
Loading