private void GetRandomItems() { RandomItems.Clear(); var random = CurrentItems.OrderBy(n => Guid.NewGuid()).Take(6).ToList(); random.ForEach(item => RandomItems.Add(item)); }
public async Task <bool> LoadRandomFromDB() { try { await prepareData(); } catch { }; var dbPath = "Data/places.db"; SQLiteAsyncConnection conn = new SQLiteAsyncConnection(dbPath); /*var tourist = new RssDataGroup("TouristRandom", * "Случайные достопримечательности", "Достопримечательности", "", ""); * tourist.Order = 15;*/ try { var SomeItems = await conn.QueryAsync <MapItem>("SELECT * FROM MapItem ORDER BY RANDOM() LIMIT 0,200"); foreach (var item in SomeItems) { RandomItems.Add(item); } ; RaisePropertyChanged("RandomItems"); } catch { }; return(true); }