コード例 #1
0
        private async void DeleteButton_OnClick(object sender, RoutedEventArgs e)
        {
            await WaitRingManager.ShowBlurBackground(true);

            await Library.DeletePodcast(podcast);

            GlobalStateManager.CurrentShell.Navigate(typeof(LibraryPage));
            await WaitRingManager.ShowBlurBackground(false);
        }
コード例 #2
0
        private async void PodcastSlidableListItem_RightCommandRequested(object sender, EventArgs e)
        {
            var podcast = (Podcast)DataContext;

            if (podcast != null)
            {
                await WaitRingManager.ShowBlurBackground(true);

                await Library.DeletePodcast(podcast);

                await WaitRingManager.ShowBlurBackground(false);
            }
        }
コード例 #3
0
        private async void DeletePodcastMenu_Click(object sender, RoutedEventArgs e)
        {
            MenuFlyoutItem item    = sender as MenuFlyoutItem;
            var            podcast = item?.DataContext as Podcast;

            if (podcast != null)
            {
                await WaitRingManager.ShowBlurBackground(true);

                if (await Library.DeletePodcast(podcast))
                {
                    Sync();
                }
                await WaitRingManager.ShowBlurBackground(false);
            }
        }
コード例 #4
0
        private async void Load_OnClick(object sender, RoutedEventArgs e)
        {
            var filePicker = new FileOpenPicker();

            filePicker.FileTypeFilter.Add(".cast");
            filePicker.FileTypeFilter.Add(".xml");
            filePicker.FileTypeFilter.Add(".opml");

            var file = await filePicker.PickSingleFileAsync();

            if (file != null)
            {
                WaitRingManager.IsWaitRingVisible = true;
                try
                {
                    Playlist.CurrentPlaylist.Clear();
                    if (file.FileType.ToLower() == ".cast")
                    {
                        await Library.LoadCastFile(file, false);
                    }
                    else
                    {
                        await Library.LoadOPMLFile(file, false);
                    }
                    await Library.SaveAsync();

                    WaitRingManager.IsWaitRingVisible = false;
                    await WaitRingManager.ShowBlurBackground(true);

                    await App.MessageAsync(StringsHelper.Success_LoadFromFile);

                    await WaitRingManager.ShowBlurBackground(false);

                    GlobalStateManager.CurrentShell.Navigate(typeof(LibraryPage));
                }
                catch (Exception ex)
                {
                    WaitRingManager.IsWaitRingVisible = false;
                    await WaitRingManager.ShowBlurBackground(true);

                    await Messenger.ErrorAsync($"{StringsHelper.Error_LoadFromFile}: {ex.Message}");

                    await WaitRingManager.ShowBlurBackground(false);
                }
            }
        }
コード例 #5
0
        private async void Save_OnClick(object sender, RoutedEventArgs e)
        {
            var filePicker = new FileSavePicker {
                DefaultFileExtension = ".cast"
            };

            filePicker.FileTypeChoices.Add(StringsHelper.CastFiles, new[] { ".cast" });
            filePicker.FileTypeChoices.Add(StringsHelper.OPMLFiles, new[] { ".xml", ".opml" });

            var file = await filePicker.PickSaveFileAsync();

            if (file != null)
            {
                WaitRingManager.IsWaitRingVisible = true;
                try
                {
                    if (file.FileType.ToLower() == ".cast")
                    {
                        await Library.SaveCastFile(file);
                    }
                    else
                    {
                        await Library.SaveOPMLFile(file);
                    }
                    WaitRingManager.IsWaitRingVisible = false;
                    await WaitRingManager.ShowBlurBackground(true);

                    await App.MessageAsync(StringsHelper.Success_SaveToFile);

                    await WaitRingManager.ShowBlurBackground(false);
                }
                catch
                {
                    WaitRingManager.IsWaitRingVisible = false;
                    await WaitRingManager.ShowBlurBackground(true);

                    await Messenger.ErrorAsync(StringsHelper.Error_SaveToFile);

                    await WaitRingManager.ShowBlurBackground(false);
                }
            }
        }