diff --git a/XamarinStudy/XamarinStudy/XamarinStudy/App.xaml.cs b/XamarinStudy/XamarinStudy/XamarinStudy/App.xaml.cs index e85d240..94edf7b 100644 --- a/XamarinStudy/XamarinStudy/XamarinStudy/App.xaml.cs +++ b/XamarinStudy/XamarinStudy/XamarinStudy/App.xaml.cs @@ -55,7 +55,9 @@ namespace XamarinStudy //MainPage = new NavigationPage(new SampleTableViewSimpleRegisterPage()); - MainPage = new SampleListViewPage(); + //MainPage = new SampleListViewPage(); + + MainPage = new ToyMartPage(); } protected override void OnStart() diff --git a/XamarinStudy/XamarinStudy/XamarinStudy/Commons/ValueConverter.cs b/XamarinStudy/XamarinStudy/XamarinStudy/Commons/ValueConverter.cs new file mode 100644 index 0000000..1ee3f1a --- /dev/null +++ b/XamarinStudy/XamarinStudy/XamarinStudy/Commons/ValueConverter.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Text; +using Xamarin.Forms; + +namespace XamarinStudy.Commons +{ + internal class ValueConverter : IValueConverter + { + object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return ImageSource.FromResource(string.Format("XamarinStudy.Imgs.{0}", value ?? "")); + } + + object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Block1.png b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Block1.png new file mode 100644 index 0000000..fd9659a Binary files /dev/null and b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Block1.png differ diff --git a/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Block2.png b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Block2.png new file mode 100644 index 0000000..46a9546 Binary files /dev/null and b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Block2.png differ diff --git a/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Block3.png b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Block3.png new file mode 100644 index 0000000..a595fa5 Binary files /dev/null and b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Block3.png differ diff --git a/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Car1.png b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Car1.png new file mode 100644 index 0000000..c05c21b Binary files /dev/null and b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Car1.png differ diff --git a/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Car2.png b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Car2.png new file mode 100644 index 0000000..9e58f09 Binary files /dev/null and b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Car2.png differ diff --git a/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Car3.png b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Car3.png new file mode 100644 index 0000000..907f66f Binary files /dev/null and b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Car3.png differ diff --git a/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Figure1.png b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Figure1.png new file mode 100644 index 0000000..ba56ff2 Binary files /dev/null and b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Figure1.png differ diff --git a/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Figure2.png b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Figure2.png new file mode 100644 index 0000000..6246f83 Binary files /dev/null and b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Figure2.png differ diff --git a/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Figure3.png b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Figure3.png new file mode 100644 index 0000000..ffec2c5 Binary files /dev/null and b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Figure3.png differ diff --git a/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Plane1.png b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Plane1.png new file mode 100644 index 0000000..fb011ff Binary files /dev/null and b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Plane1.png differ diff --git a/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Plane2.png b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Plane2.png new file mode 100644 index 0000000..837ea67 Binary files /dev/null and b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Plane2.png differ diff --git a/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Plane3.png b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Plane3.png new file mode 100644 index 0000000..9ee58b8 Binary files /dev/null and b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Plane3.png differ diff --git a/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Robot1.png b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Robot1.png new file mode 100644 index 0000000..8c736ac Binary files /dev/null and b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Robot1.png differ diff --git a/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Robot2.png b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Robot2.png new file mode 100644 index 0000000..b45e090 Binary files /dev/null and b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Robot2.png differ diff --git a/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Robot3.png b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Robot3.png new file mode 100644 index 0000000..46ddd33 Binary files /dev/null and b/XamarinStudy/XamarinStudy/XamarinStudy/Imgs/Robot3.png differ diff --git a/XamarinStudy/XamarinStudy/XamarinStudy/Models/Toy.cs b/XamarinStudy/XamarinStudy/XamarinStudy/Models/Toy.cs new file mode 100644 index 0000000..e5b9e29 --- /dev/null +++ b/XamarinStudy/XamarinStudy/XamarinStudy/Models/Toy.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace XamarinStudy.Models +{ + internal class Toy + { + public enum TOY_CATEGORY { Robot, Car, Plane, Figure, Block } + + public string Name { get; set; } + public int Price { get; set; } + public int Count { get; set; } + public string Image { get => $"{this.Name}.png"; } + public bool Checked { get; set; } + public TOY_CATEGORY Category { get; set; } + } + + class KindOf : List + { + public K Title { get; set; } + public KindOf(K title, IEnumerable list) + { + this.Title = title; + this.AddRange(list); + } + } + + internal class ToyRepository + { + public static List ToyList { get; private set; } + public static List>ToyListKindOf { get; set; } + + static ToyRepository() + { + ToyList = new List() + { + new Toy() {Name = "Robot1", Price = 10000, Category = Toy.TOY_CATEGORY.Robot }, + new Toy() {Name = "Robot2", Price = 80000, Category = Toy.TOY_CATEGORY.Robot }, + new Toy() {Name = "Robot3", Price = 90000, Category = Toy.TOY_CATEGORY.Robot }, + + new Toy() {Name = "Car1", Price = 1000, Category = Toy.TOY_CATEGORY.Car }, + new Toy() {Name = "Car2", Price = 60000, Category = Toy.TOY_CATEGORY.Car }, + new Toy() {Name = "Car3", Price = 70000, Category = Toy.TOY_CATEGORY.Car }, + + new Toy() {Name = "Plane1", Price = 120000, Category = Toy.TOY_CATEGORY.Plane }, + new Toy() {Name = "Plane2", Price = 60000, Category = Toy.TOY_CATEGORY.Plane }, + new Toy() {Name = "Plane3", Price = 50000, Category = Toy.TOY_CATEGORY.Plane }, + + new Toy() {Name = "Figure1", Price = 120000, Category = Toy.TOY_CATEGORY.Figure }, + new Toy() {Name = "Figure2", Price = 60000, Category = Toy.TOY_CATEGORY.Figure }, + new Toy() {Name = "Figure3", Price = 50000, Category = Toy.TOY_CATEGORY.Figure }, + + new Toy() {Name = "Block1", Price = 20000, Category = Toy.TOY_CATEGORY.Block }, + new Toy() {Name = "Block2", Price = 25000, Category = Toy.TOY_CATEGORY.Block }, + new Toy() {Name = "Block3", Price = 32000, Category = Toy.TOY_CATEGORY.Block }, + }; + + // Category로 그룹화, 그룹 내 Key = Category, + ToyListKindOf = ToyList.GroupBy(t => t.Category.ToString()).Select(g => new KindOf(g.Key, g)).ToList(); + } + } +} diff --git a/XamarinStudy/XamarinStudy/XamarinStudy/Views/ToyMartPage.xaml b/XamarinStudy/XamarinStudy/XamarinStudy/Views/ToyMartPage.xaml new file mode 100644 index 0000000..24120ea --- /dev/null +++ b/XamarinStudy/XamarinStudy/XamarinStudy/Views/ToyMartPage.xaml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/XamarinStudy/XamarinStudy/XamarinStudy/Views/ToyMartPage.xaml.cs b/XamarinStudy/XamarinStudy/XamarinStudy/Views/ToyMartPage.xaml.cs new file mode 100644 index 0000000..61ca33c --- /dev/null +++ b/XamarinStudy/XamarinStudy/XamarinStudy/Views/ToyMartPage.xaml.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using Xamarin.Forms; +using Xamarin.Forms.Xaml; +using XamarinStudy.Models; + +namespace XamarinStudy.Views +{ + [XamlCompilation(XamlCompilationOptions.Compile)] + public partial class ToyMartPage : ContentPage + { + public ToyMartPage() + { + InitializeComponent(); + InitInstance(); + } + + private void InitInstance() + { + ToyRepository dd = new ToyRepository(); + //menuListView.ItemsSource = ToyRepository.ToyList; + menuListView.ItemsSource = ToyRepository.ToyListKindOf; + } + } +} \ No newline at end of file diff --git a/XamarinStudy/XamarinStudy/XamarinStudy/XamarinStudy.csproj b/XamarinStudy/XamarinStudy/XamarinStudy/XamarinStudy.csproj index 413e9b4..8683ea8 100644 --- a/XamarinStudy/XamarinStudy/XamarinStudy/XamarinStudy.csproj +++ b/XamarinStudy/XamarinStudy/XamarinStudy/XamarinStudy.csproj @@ -5,6 +5,42 @@ true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -74,5 +110,8 @@ MSBuild:UpdateDesignTimeXaml + + MSBuild:UpdateDesignTimeXaml + \ No newline at end of file