#166: Done
This commit is contained in:
@@ -9,9 +9,29 @@
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
<ScrollViewer>
|
||||
<StackPanel>
|
||||
<ItemsControl Name="stack"/>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition Height="auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Name="path" IsTextSelectionEnabled="True" TextWrapping="WrapWholeWords"/>
|
||||
<Button Grid.Column="1" Content="Open folder" Name="open" Click="Open_Click" VerticalAlignment="Center"/>
|
||||
</Grid>
|
||||
|
||||
<ScrollViewer Grid.Row="1">
|
||||
<StackPanel Name="stack"/>
|
||||
</ScrollViewer>
|
||||
|
||||
<TextBlock Grid.Row="1" Name="empty" HorizontalAlignment="Center" VerticalAlignment="Top" FontSize="28" Text="You haven't downloaded anything yet" Margin="10" TextWrapping="WrapWholeWords" Foreground="Gray" FontWeight="SemiBold"/>
|
||||
|
||||
<CommandBar DefaultLabelPosition="Right" Grid.Row="2">
|
||||
<AppBarButton Label="Refresh" Icon="Refresh" Click="Refresh"/>
|
||||
</CommandBar>
|
||||
</Grid>
|
||||
</Page>
|
||||
|
||||
@@ -25,18 +25,46 @@ namespace FoxTube.Pages
|
||||
public Downloads()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
try
|
||||
{
|
||||
stack.ItemsSource = Methods.MainPage.Agent.items;
|
||||
}
|
||||
catch { }
|
||||
SetPath();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedFrom(e);
|
||||
stack.ItemsSource = null;
|
||||
stack.Items.Clear();
|
||||
stack.Children.Clear();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
DownloadAgent.items.ForEach(i =>
|
||||
{
|
||||
stack.Children.Add(i);
|
||||
i.Initialize();
|
||||
});
|
||||
empty.Visibility = stack.Children.Count > 0 ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
|
||||
void SetPath()
|
||||
{
|
||||
path.Text = DownloadAgent.Downloads.Path;
|
||||
}
|
||||
|
||||
void Refresh(object sender, RoutedEventArgs e)
|
||||
{
|
||||
stack.Children.Clear();
|
||||
|
||||
DownloadAgent.items.ForEach(i =>
|
||||
{
|
||||
stack.Children.Add(i);
|
||||
i.Initialize();
|
||||
});
|
||||
empty.Visibility = stack.Children.Count > 0 ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
|
||||
private async void Open_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
await Launcher.LaunchFolderAsync(DownloadAgent.Downloads);
|
||||
}
|
||||
|
||||
/*private async void changePath_Click(object sender, RoutedEventArgs e)
|
||||
|
||||
@@ -39,8 +39,6 @@ namespace FoxTube
|
||||
|
||||
public sealed partial class MainPage : Page
|
||||
{
|
||||
public DownloadAgent Agent = new DownloadAgent();
|
||||
|
||||
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
|
||||
|
||||
Sender s = Sender.None;
|
||||
@@ -96,6 +94,9 @@ namespace FoxTube
|
||||
SecretsVault.NotPurchased += () => removeAds.Visibility = Visibility.Visible;
|
||||
SecretsVault.CheckAuthorization();
|
||||
SecretsVault.CheckAddons();
|
||||
|
||||
DownloadAgent.Initialize();
|
||||
|
||||
SetTitleBar();
|
||||
Initialize();
|
||||
}
|
||||
@@ -362,6 +363,11 @@ namespace FoxTube
|
||||
content.Navigate(typeof(PlaylistPage), id);
|
||||
}
|
||||
|
||||
public void GoToDownloads()
|
||||
{
|
||||
content.Navigate(typeof(Downloads));
|
||||
}
|
||||
|
||||
private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
if (videoPlaceholder.Content != null)
|
||||
|
||||
@@ -266,7 +266,7 @@ namespace FoxTube.Pages
|
||||
|
||||
private void downloadItemSelected(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Methods.MainPage.Agent.Add(((sender as MenuFlyoutItem).Tag as object[])[0] as MediaStreamInfo, item, ((sender as MenuFlyoutItem).Tag as object[])[1] as string);
|
||||
DownloadAgent.Add(((sender as MenuFlyoutItem).Tag as object[])[0] as MediaStreamInfo, item, ((sender as MenuFlyoutItem).Tag as object[])[1] as string);
|
||||
}
|
||||
|
||||
async void LoadRelatedVideos()
|
||||
|
||||
Reference in New Issue
Block a user