Beispiel #1
0
        private async void DisplayMedia()
        {
            IsBusy = true;

            try
            {
                var response = await App.Database.GetDownloadedAudio();

                if (response != null)
                {
                    foreach (var item in response)
                    {
                        AllMedia.Add(item);
                    }
                    AllAudio = new ObservableCollection <DownloadedMedia>(AllMedia.Where(er => er.mediaType == Models.Response.MediaType.Audio));
                    AllVideo = new ObservableCollection <DownloadedMedia>(AllMedia.Where(er => er.mediaType == Models.Response.MediaType.Video));
                }

                IsBusy = false;
            }
            catch (Exception ex)
            {
                MessageDialog.Show("Error!", ex.Message, "Cancel");
            }
        }
Beispiel #2
0
        private async void DisplayMedia()
        {
            IsBusy = true;

            try
            {
                if (Connectivity.NetworkAccess != NetworkAccess.Internet)
                {
                    AllMedia = null;
                    IsBusy   = false;
                    return;
                }
                var response = await ApiServices.GetAllChurchMedia();

                if (response != null)
                {
                    foreach (var item in response)
                    {
                        AllMedia.Add(item);
                    }
                    AllAudio = new ObservableCollection <ChurchMedia>(AllMedia.Where(er => er.mediaType == MediaType.Audio || er.mediaType == MediaType.Ebook));
                    AllVideo = new ObservableCollection <ChurchMedia>(AllMedia.Where(er => er.mediaType == MediaType.Video));
                    AllBooks = new ObservableCollection <ChurchMedia>(AllMedia.Where(er => er.mediaType == MediaType.Ebook));

                    Audio = new ObservableCollection <ChurchMedia>(AllMedia.Where(er => er.mediaType == MediaType.Audio).Take(4));
                    Video = new ObservableCollection <ChurchMedia>(AllMedia.Where(er => er.mediaType == MediaType.Video).Take(4));
                    // Video = AllMedia.Where(er => er.mediaType == 3);
                    CurrentMessage = AllMedia.First();
                }

                IsBusy = false;
            }
            catch (Exception ex)
            {
                MessageDialog.Show("Error!", ex.Message, "Cancel");
            }
        }
Beispiel #3
0
 private void OnExecuteDeleteMedia()
 {
     _mediaRepository.Delete(SelectedMedia);
     AllMedia.Remove(SelectedMedia);
     SelectedMedia = null;
 }