private void BookListView_Refreshing(object sender, EventArgs e) { Task.Delay(2000); items.Clear(); if (BookDB.select_title() != null) { var query = BookDB.select_title(); var List1 = new List <String>(); foreach (var user in query) { List1.Add(user.Title); } for (var j = 0; j < query.Count; j++) { items.Add(new Book { Name = List1[j], /*Value = 2.5*/ }); } } else { items.Add(new Book { Name = "表示するものがありません" }); } BookListView.ItemsSource = items; this.BookListView.IsPullToRefreshEnabled = false; }
public BookPage() { InitializeComponent(); /* * string a = "a"; //緊急削除 * BookDB.deleteBook(a); */ if (BookDB.select_title() != null) { var query = BookDB.select_title(); var List1 = new List <String>(); foreach (var user in query) { List1.Add(user.Title); } for (var j = 0; j < query.Count; j++) { items.Add(new Book { Name = List1[j], /*Value = 2.5*/ }); } } else { items.Add(new Book { Name = "表示するものがありません" }); } for (var i = 0; i < items.Count; i++) { if (items[i].Value <= 0.25) { items[i].ValueImage = "value_0.png"; } else if (items[i].Value <= 0.75) { items[i].ValueImage = "value_0.5.png"; } else if (items[i].Value <= 1.25) { items[i].ValueImage = "value_1.png"; } else if (items[i].Value <= 1.75) { items[i].ValueImage = "value_1.5.png"; } else if (items[i].Value <= 2.25) { items[i].ValueImage = "value_2.png"; } else if (items[i].Value <= 2.75) { items[i].ValueImage = "value_2.5.png"; } else if (items[i].Value <= 3.25) { items[i].ValueImage = "value_3.png"; } else if (items[i].Value <= 3.75) { items[i].ValueImage = "value_3.5.png"; } else if (items[i].Value <= 4.25) { items[i].ValueImage = "value_4.png"; } else if (items[i].Value <= 4.75) { items[i].ValueImage = "value_4.5.png"; } else { items[i].ValueImage = "value_5.png"; } if (items[i].RedStar == true) { items[i].RedStar2 = "red_star_72.png"; } if (items[i].BlueBook == true) { items[i].BlueBook2 = "blue_book_72.png"; } } BookListView.ItemsSource = items; }