Archived
1
0

DownloadAgent

This commit is contained in:
Michael Gordeev
2018-07-11 18:58:05 +03:00
parent 839be10ed2
commit 71cc12106c
39 changed files with 1359 additions and 55 deletions
+58
View File
@@ -0,0 +1,58 @@
using FoxTube.Controls;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Storage;
using Windows.Storage.Pickers;
using Windows.System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace FoxTube.Pages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class Downloads : Page
{
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
public Downloads()
{
this.InitializeComponent();
path.Text = settings.Values["defaultDownload"] as string;
foreach (DownloadItem item in Methods.MainPage.Agent.Items)
stack.Children.Add(item);
}
private async void changePath_Click(object sender, RoutedEventArgs e)
{
FolderPicker picker = new FolderPicker()
{
SuggestedStartLocation = PickerLocationId.Desktop,
ViewMode = PickerViewMode.Thumbnail
};
StorageFolder p = await picker.PickSingleFolderAsync();
if (p != null)
settings.Values["defaultDownload"] = p.Path;
path.Text = settings.Values["defaultDownload"] as string;
}
private async void openFolder_Click(object sender, RoutedEventArgs e)
{
await Launcher.LaunchUriAsync(new Uri(settings.Values["defaultDownload"] as string));
}
}
}