private void addNewSlide() { var index = DateListCarousel.Position; if (index == DateList.Count() - 1) { DateList.Add(new DateItem { Date = DateList[index].Date.AddDays(1), Text = WicketHelper.ConvertDate(DateList[index].Date.AddDays(1)), MatchList = WicketHelper.GetMatchList(DateList[index].Date.AddDays(1)), Loading = false, }); } else if (DateListCarousel.Position == 0) { DateList.Insert(0, new DateItem { Date = DateList[index].Date.AddDays(-1), Text = WicketHelper.ConvertDate(DateList[index].Date.AddDays(-1)), MatchList = WicketHelper.GetMatchList(DateList[index].Date.AddDays(-1)), Loading = false, }); } }
private void carouselOnItemSelected(object sender, SelectedItemChangedEventArgs e) { var position = DateListCarousel.Position; DateLabel.Text = WicketHelper.ConvertDate(DateList[position].Date); var game = DateList[position] as DateItem; if (game == null) return; addNewSlide(); }
async Task RefreshList(object sender, EventArgs e) { ListView lv = (ListView)sender; var index = DateListCarousel.Position; lv.ItemsSource = null; var matchCallResult = await WicketHelper.UpdateMatchListAsync(DateList[index]); lv.ItemsSource = matchCallResult; lv.IsRefreshing = false; }
private void addNextSlide() { int index; if (DateListCarousel.Position == DateList.Count() - 1) { index = DateList.Count() - 1; DateList.Add(new DateItem { Date = DateList[index].Date.AddDays(1), Text = WicketHelper.ConvertDate(DateList[index].Date.AddDays(1)), MatchList = WicketHelper.GetMatchList(DateList[index].Date.AddDays(1)), }); DateListCarousel.Position = index + 1; } else { index = DateListCarousel.Position + 1; DateListCarousel.Position = DateListCarousel.Position + 1; } DateLabel.Text = WicketHelper.ConvertDate(DateList[index].Date); }
private void addPreviousSlide() { int index; //Check if slide to the left already exists //If so, move back one spot. If not, add new data one less than the slide's date to the DateList if (DateListCarousel.Position == 0) { index = 0; DateList.Insert(0, new DateItem { Date = DateList[index].Date.AddDays(-1), Text = WicketHelper.ConvertDate(DateList[index].Date.AddDays(-1)), MatchList = WicketHelper.GetMatchList(DateList[index].Date.AddDays(-1)), }); DateListCarousel.Position = 0; } else { index = DateListCarousel.Position - 1; DateListCarousel.Position = DateListCarousel.Position - 1; } }
public MatchViewModel(Match match) { ActiveMatch = match; MatchScorecard = WicketHelper.GetScorecard(match); }