public UnlockableSongDetailsViewModel(MusicInfo selectedMusic) { Acr.UserDialogs.UserDialogs.Instance.ShowLoading("Wait..."); music = selectedMusic; Title = selectedMusic.SongTitle; SongBanner = selectedMusic.SongBanner; var allCharts = MusicDataStore.GetChartsItem(selectedMusic.SongId); var singles = allCharts.Where(s => s.Level.Contains("S")); var doubles = allCharts.Where(s => s.Level.Contains("D")); var coops = allCharts.Where(s => s.Level.Contains("CO-OP")); SinglesList = new ObservableCollection <Chart>(singles); DoublesList = new ObservableCollection <Chart>(doubles); CoopsList = new ObservableCollection <Chart>(coops); MessagingCenter.Subscribe <UnlockableSongDetails>(this, "Checkbock value changed!", (sender) => { UpdateAllCharts(); }); Acr.UserDialogs.UserDialogs.Instance.HideLoading(); }
private void GetSongs() { var musics = MusicDataStore.GetAllItemsAsync(); DefaultMusicsList = new ObservableCollection <MusicInfo>(musics); MusicsList = new ObservableCollection <MusicInfo>(musics); }
private void UpdateAllCharts() { var charts = SinglesList.Concat(DoublesList).Concat(CoopsList); music.Charts = new ObservableCollection <Chart>(charts); MusicDataStore.UpdateItemAsync(music); Acr.UserDialogs.UserDialogs.Instance.Toast("Success!"); }