private void Tile_Click(object sender, RoutedEventArgs e)
 {
     GlobalConsts.LoadFlyoutPage(new DownloadSettingsControl());
 }
        private async Task AddSubscriptionPanel(Subscription sub)
        {
            var channel = await sub.GetChannel();

            _ = Dispatcher.InvokeAsync(() =>
            {
                int row = SubscriptionsGrid.RowDefinitions.Count;
                RowDefinition rowDefinition = new RowDefinition
                {
                    Height = GridLength.Auto,
                };
                SubscriptionsGrid.RowDefinitions.Add(rowDefinition);

                Image logo = new Image
                {
                    MaxWidth          = 120,
                    MaxHeight         = 120,
                    Width             = 98,
                    Height            = 98,
                    Margin            = new Thickness(2),
                    Source            = new BitmapImage(new Uri(channel.LogoUrl)),
                    VerticalAlignment = VerticalAlignment.Top
                };
                Grid.SetColumn(logo, 0);
                Grid.SetRow(logo, row);
                SubscriptionsGrid.Children.Add(logo);


                TextBlock description = new TextBlock
                {
                    Height            = 40,
                    Width             = double.NaN,
                    FontSize          = 14,
                    VerticalAlignment = VerticalAlignment.Top
                };
                description.Inlines.Add(string.Concat(FindResource("PlaylistTitle"), channel.Title, "\n"));
                description.Inlines.Add(string.Concat(FindResource("LastVideoDownloadDate"), sub.LatestVideoDownloaded.ToLocalTime().ToShortDateString()));
                Grid.SetColumn(description, 1);
                Grid.SetRow(description, row);
                SubscriptionsGrid.Children.Add(description);

                StackPanel buttonsPanel = new StackPanel
                {
                    VerticalAlignment = VerticalAlignment.Center
                };
                Grid.SetColumn(buttonsPanel, 2);
                Grid.SetRow(buttonsPanel, row);
                SubscriptionsGrid.Children.Add(buttonsPanel);

                Tile settingsButton = new Tile
                {
                    Height = double.NaN,
                    Width  = double.NaN,
                    Margin = new Thickness(2.5),
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center
                },
                removeButton = new Tile
                {
                    Height = double.NaN,
                    Width  = double.NaN,
                    Margin = new Thickness(2.5),
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center
                };

                removeButton.Click += (s, e) =>
                {
                    rowDefinition.Height = new GridLength(0);
                    Subscriptions.Remove(Subscriptions.FirstOrDefault(x => x.ChannelId.Equals(sub.ChannelId)));
                };

                settingsButton.Click += (s, e) =>
                {
                    GlobalConsts.LoadFlyoutPage(new SubscriptionSettings(sub));
                };

                buttonsPanel.Children.Add(settingsButton);
                buttonsPanel.Children.Add(removeButton);

                WrapPanel settingsButtonWrapPanel = new WrapPanel(), removeButtonWrapPanel = new WrapPanel();

                //Settings button
                PackIconModern settingsButtonIcon = new PackIconModern
                {
                    Kind   = PackIconModernKind.Cogs,
                    Width  = 35,
                    Height = 35,
                    Margin = new Thickness(5)
                };
                TextBlock settingsButtonTextBlock = new TextBlock
                {
                    Text = $"{FindResource("Settings")}",
                    VerticalAlignment = VerticalAlignment.Center,
                    FontSize          = 16,
                    Margin            = new Thickness(2.5, 5, 7.5, 5)
                };
                settingsButtonWrapPanel.Children.Add(settingsButtonIcon);
                settingsButtonWrapPanel.Children.Add(settingsButtonTextBlock);
                settingsButton.Content = settingsButtonWrapPanel;

                //Remove button
                PackIconModern removeButtonIcon = new PackIconModern
                {
                    Kind   = PackIconModernKind.Close,
                    Width  = 35,
                    Height = 35,
                    Margin = new Thickness(5)
                };
                TextBlock removeButtonTextBlock = new TextBlock
                {
                    Text = $"{FindResource("Remove")}",
                    VerticalAlignment = VerticalAlignment.Center,
                    FontSize          = 16,
                    Margin            = new Thickness(2.5, 5, 7.5, 5)
                };
                removeButtonWrapPanel.Children.Add(removeButtonIcon);
                removeButtonWrapPanel.Children.Add(removeButtonTextBlock);
                removeButton.Content = removeButtonWrapPanel;

                GridScrollViewer.Height = GlobalConsts.Current.ActualHeight - 300;
                GridScrollViewer.UpdateLayout();
            });
        }