protected override void OnAppearing() { base.OnAppearing(); _newMatch?.Dispose(); _viewMoreListPage?.Dispose(); _viewMoreListPage = null; _newMatch = null; _matches = App.DataManager.GetMatches((m) => true).OrderByDescending(m => m.Date).Take(4).ToList(); RecentListView.ItemTemplate = new DataTemplate(() => new RecentViewCell()); RecentListView.ItemsSource = _matches; RecentListView.RowHeight = 60; StartMatchTapped.Tapped += StartMatchButtonTapped; }
private bool disposedValue; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { // dispose managed state (managed objects). _matches?.Clear(); _newMatch?.Dispose(); _viewMoreListPage?.Dispose(); } // free unmanaged resources (unmanaged objects) and override a finalizer below. // set large fields to null. _matches = null; _viewMoreListPage = null; _newMatch = null; disposedValue = true; } }
private async void ViewMoreTapped(object sender, EventArgs e) { _viewMoreListPage = new MatchListPage(); await Navigation.PushAsync(_viewMoreListPage, true); }