DownloadAgent fixes and improvements
This commit is contained in:
@@ -18,6 +18,7 @@ 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
|
||||
#pragma warning disable CS0252 // Possible unintended reference comparison; left hand side needs cast
|
||||
|
||||
namespace FoxTube.Pages
|
||||
{
|
||||
@@ -27,15 +28,26 @@ namespace FoxTube.Pages
|
||||
public sealed partial class Downloads : Page
|
||||
{
|
||||
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
|
||||
DownloadAgent agent = Methods.MainPage.Agent;
|
||||
public Downloads()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
path.Text = settings.Values["defaultDownload"] as string;
|
||||
|
||||
foreach (DownloadItem item in Methods.MainPage.Agent.Items)
|
||||
agent.ListChanged += UpdateList;
|
||||
|
||||
foreach (DownloadItem item in agent.Items)
|
||||
stack.Children.Add(item);
|
||||
}
|
||||
|
||||
private void UpdateList(object sender, ObjectEventArgs e)
|
||||
{
|
||||
if (e.Parameters[0] == "remove")
|
||||
stack.Children.Remove(sender as DownloadItem);
|
||||
else if (e.Parameters[0] == "add")
|
||||
stack.Children.Add(sender as DownloadItem);
|
||||
}
|
||||
|
||||
private async void changePath_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FolderPicker picker = new FolderPicker()
|
||||
|
||||
Reference in New Issue
Block a user