async Task ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { Reflections.Clear(); var items = await ReflectionStore.GetItemsAsync("api/reflections", true); if (items != null && items.Count() > 0) { foreach (var item in items) { item.Image = AppConstant.BaseUrl + item.Image; item.Content = String.Join(" ", item.Content.Split(' ')) + "..."; Reflections.Add(item); } } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
void ExecuteLoadItemsCommand(int id) { if (IsBusy) { return; } IsBusy = true; try { Reflections.Clear(); var items = ReflectionsFromParent; if (items != null && items.Count() > 0) { var firstItem = items.Where(n => n.Id == id).FirstOrDefault(); Title = firstItem.Title; MainTitle = firstItem.Title; Content = firstItem.Content; Image = firstItem.Image; RelatedNews = "Other Reflections"; foreach (var item in items.Where(n => n.Id != id)) { item.Image = item.Image; item.Content = String.Join(" ", firstItem.Content.Split(' ')) + "..."; Reflections.Add(item); } } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }