/// <summary> /// Updating cache only if the data we have was retrived from API and if it is generally needs to be updated... /// </summary> /// <param name="artist">Artist object</param> /// <param name="albums">List of artist's albums</param> private static void UpdateCache(Artist artist, List <Album> albums) { ArtistSearch.UpdateCache(artist); if (_isDataFromAPI && albums.Count > 0 && Cache.CheckIfMustUpdate(artist)) { Cache.UpdateAlbums(albums); } }
/// <summary> /// The loop method for starting and continuing the album search UX routing and getting data accordignly... /// </summary> public static void Start() { _isOn = true; while (_isOn) { Artist artist = ArtistSearch.Implement(); if (artist != null) { List <Album> albums = GetAlbums(artist); ShowResults(albums); UpdateCache(artist, albums); } CheckIfUserWantsToGoOn(); } }