2 using System.ComponentModel;
3 using System.Collections.Generic;
4 using System.Collections.ObjectModel;
5 using Tizen.NUI.BaseComponents;
6 using Tizen.NUI.Components;
7 using Tizen.NUI.Binding;
11 class Gallery : INotifyPropertyChanged
13 string sourceDir = Tizen.NUI.Samples.CommonResource.GetDaliResourcePath()+"ItemViewDemo/gallery/gallery-medium-";
16 private bool selected;
18 public event PropertyChangedEventHandler PropertyChanged;
20 private void OnPropertyyChanged(string propertyName)
23 PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
26 public Gallery(int galleryIndex, string galleryName)
40 OnPropertyyChanged("Name");
41 OnPropertyyChanged("ViewLabel");
44 public string ViewLabel
48 return "[" + index + "] : " + name;
52 public string ImageUrl
56 return sourceDir+(index%20)+".jpg";
60 public bool Selected {
68 OnPropertyyChanged("Selected");
73 class Album : ObservableCollection<Gallery>
77 private DateTime date;
79 public Album(int albumIndex, string albumName, DateTime albumDate)
90 return "[" + index + "] " + name;
98 return date.ToLongDateString();
103 class GalleryViewModel : ObservableCollection<Gallery>
105 string[] namePool = {
118 "Tower with the Moon",
127 public GalleryViewModel(int count)
129 CreateData(this, count);
132 public ObservableCollection<Gallery> CreateData(ObservableCollection<Gallery> result , int count)
134 for (int i = 0; i < count; i++)
136 result.Add(new Gallery(i, namePool[i%20]));
142 class AlbumViewModel : ObservableCollection<Album>
144 string[] namePool = {
157 "Tower with the Moon",
167 (string name, DateTime date)[] titlePool = {
168 ("House Move", new DateTime(2021, 2, 26)),
169 ("Covid 19", new DateTime(2020, 1, 20)),
170 ("Porto Trip", new DateTime(2019, 11, 23)),
171 ("Granada Trip", new DateTime(2019, 11, 20)),
172 ("Barcelona Trip", new DateTime(2019, 11, 17)),
173 ("Developer's Day", new DateTime(2019, 11, 16)),
174 ("Tokyo Trip", new DateTime(2019, 7, 5)),
175 ("Otaru Trip", new DateTime(2019, 3, 2)),
176 ("Sapporo Trip", new DateTime(2019, 2, 28)),
177 ("Hakodate Trip", new DateTime(2019, 2, 26)),
178 ("Friend's Wedding", new DateTime(2018, 11, 23)),
179 ("Grandpa Birthday", new DateTime(2018, 9, 14)),
180 ("Family Jeju Trip", new DateTime(2018, 7, 15)),
181 ("HongKong Trip", new DateTime(2018, 3, 30)),
182 ("Mom's Birthday", new DateTime(2017, 12, 21)),
183 ("Buy new Car", new DateTime(2017, 10, 18)),
184 ("Graduation", new DateTime(2017, 6, 30)),
188 public AlbumViewModel()
193 public ObservableCollection<Album> CreateData(ObservableCollection<Album> result)
195 for (int i = 0; i < titlePool.Length; i++)
197 (string name, DateTime date) = titlePool[i];
198 Album cur = new Album(i, name, date);
199 for (int j = 0; j < 20; j++)
201 cur.Add(new Gallery(j, namePool[j]));