/// <summary> /// Laod Items /// </summary> /// <returns></returns> async Task ExecuteLoadItemsCommand() { if (IsBusy) return; IsBusy = true; Items.Clear(); FavItems.Clear(); items = await DataStore.GetItemsAsync(true); string Day = ""; string Day1 = ""; foreach (var item in items) { if (item.Day != Day) Items.Add(new Item() { Type = "Day", Day = Day = item.Day }); Items.Add(item); if (AppData.Links.Contains(item.Link)) { if (item.Day != Day1) FavItems.Add(new Item() { Type = "Day", Day = Day1 = item.Day }); FavItems.Add(item); } } IsBusy = false; }
/// <summary> /// Searching in Favorits list of items /// </summary> /// <returns></returns> async Task ExecuteSearchFavotitesItems() { if (IsBusy) return; IsBusy = true; string SearchQuery = Favorite.SearchQuery; FavItems.Clear(); string Day = ""; foreach (var item in items) { if (AppData.Links.Contains(item.Link) && (item.Header.ToLower(). Contains(SearchQuery.ToLower()) || item.Description.ToLower(). Contains(SearchQuery.ToLower()) || item.Place.ToLower(). Contains(SearchQuery.ToLower()) || item.Date.ToLower(). Contains(SearchQuery.ToLower()))) { if (item.Day != Day) { FavItems.Add(new Item() { Type = "Day", Day = Day = item.Day }); } FavItems.Add(item); } } IsBusy = false; }