Crunchy-Downloader/CRD/Views/HistoryPageView.axaml

894 lines
73 KiB
XML

<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:CRD.ViewModels"
xmlns:ui="clr-namespace:CRD.Utils.UI"
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
xmlns:history="clr-namespace:CRD.Utils.Structs.History"
xmlns:structs="clr-namespace:CRD.Utils.Structs"
xmlns:local="clr-namespace:CRD.Utils"
x:DataType="vm:HistoryPageViewModel"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="CRD.Views.HistoryPageView">
<UserControl.Resources>
<ui:UiIntToVisibilityConverter x:Key="UiIntToVisibilityConverter" />
<ui:UiSonarrIdToVisibilityConverter x:Key="UiSonarrIdToVisibilityConverter" />
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" /> <!-- Takes up most space for the title -->
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" Background="#2a2a2a"></StackPanel>
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal">
<Button Width="70" Height="70" Background="Transparent" BorderThickness="0" Margin="5 0"
VerticalAlignment="Center"
Command="{Binding RefreshAll}"
IsEnabled="{Binding !FetchingData}">
<StackPanel Orientation="Vertical">
<controls:SymbolIcon Symbol="Sync" FontSize="32" />
<TextBlock Text="Refresh Filtered" TextWrapping="Wrap" FontSize="12"></TextBlock>
</StackPanel>
</Button>
<Button Width="70" Height="70" Background="Transparent" BorderThickness="0" Margin="5 0"
VerticalAlignment="Center"
Command="{Binding AddMissingToQueue}"
IsEnabled="{Binding !FetchingData}">
<StackPanel Orientation="Vertical">
<controls:SymbolIcon Symbol="Import" FontSize="32" />
<TextBlock Text="Add To Queue" TextWrapping="Wrap" FontSize="12"></TextBlock>
</StackPanel>
</Button>
<ToggleButton Width="70" Height="70" Background="Transparent" BorderThickness="0" Margin="5 0"
VerticalAlignment="Center"
IsChecked="{Binding EditMode}"
IsEnabled="{Binding !FetchingData}">
<StackPanel Orientation="Vertical">
<controls:SymbolIcon Symbol="Edit" FontSize="32" />
<TextBlock Text="Edit" TextWrapping="Wrap" FontSize="12"></TextBlock>
</StackPanel>
</ToggleButton>
<Rectangle Width="1" Height="50" Fill="Gray" Margin="10,0" />
<StackPanel Margin="10,0">
<ToggleButton x:Name="DropdownButtonSonarr" Width="70" Height="70" Background="Transparent"
BorderThickness="0" CornerRadius="5"
IsVisible="{Binding SonarrAvailable}"
IsChecked="{Binding SonarrOptionsOpen}"
IsEnabled="{Binding !FetchingData}">
<StackPanel Orientation="Vertical">
<controls:ImageIcon VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0 1 0 0" Source="../Assets/sonarr.png" Width="30" Height="30" />
<TextBlock Text="Sonarr" TextWrapping="Wrap" FontSize="12"></TextBlock>
</StackPanel>
</ToggleButton>
<Popup IsLightDismissEnabled="True"
IsOpen="{Binding IsChecked, ElementName=DropdownButtonSonarr, Mode=TwoWay}"
Placement="BottomEdgeAlignedRight"
PlacementTarget="{Binding ElementName=DropdownButtonSonarr}">
<Border BorderThickness="1" Background="{DynamicResource ComboBoxDropDownBackground}">
<StackPanel>
<Button Margin="10 5"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
IsEnabled="{Binding !AddingMissingSonarrSeries}"
Content="Add Sonarr Series"
Command="{Binding AddMissingSonarrSeriesToHistory}">
</Button>
<Button Margin="10 5"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
Content="Download Missing from Sonarr"
Command="{Binding DownloadMissingSonarr}">
</Button>
</StackPanel>
</Border>
</Popup>
</StackPanel>
<TextBlock VerticalAlignment="Center" Text="{Binding ProgressText}"></TextBlock>
<!-- <Button Command="{Binding RefreshAll}" Margin="10" IsEnabled="{Binding !FetchingData}">Refresh All</Button> -->
<!-- <Button Command="{Binding AddMissingToQueue}" Margin="10 0" IsEnabled="{Binding !FetchingData}">Add To Queue</Button> -->
<!-- <ToggleButton IsChecked="{Binding EditMode}" Margin="10 0" IsEnabled="{Binding !FetchingData}">Edit</ToggleButton> -->
</StackPanel>
<StackPanel Grid.Row="0" Grid.Column="2" Orientation="Horizontal">
<Slider VerticalAlignment="Center" Minimum="0.5" Maximum="1" Width="100"
Value="{Binding ScaleValue}"
IsVisible="{Binding IsPosterViewSelected}">
</Slider>
<StackPanel>
<ToggleButton x:Name="DropdownButtonViews" Width="70" Height="70" Background="Transparent"
BorderThickness="0" Margin="5 0" VerticalAlignment="Center"
IsEnabled="{Binding !FetchingData}"
IsChecked="{Binding ViewSelectionOpen}">
<StackPanel Orientation="Vertical">
<controls:SymbolIcon Symbol="View" FontSize="32" />
<TextBlock Text="View" FontSize="12"></TextBlock>
</StackPanel>
</ToggleButton>
<Popup IsLightDismissEnabled="True"
IsOpen="{Binding IsChecked, ElementName=DropdownButtonViews, Mode=TwoWay}"
Placement="BottomEdgeAlignedRight"
PlacementTarget="{Binding ElementName=DropdownButtonViews}">
<Border BorderThickness="1" Background="{DynamicResource ComboBoxDropDownBackground}">
<ListBox SelectionMode="Single" Width="210"
MaxHeight="400"
ItemsSource="{Binding ViewsList}" SelectedItem="{Binding SelectedView}">
</ListBox>
</Border>
</Popup>
</StackPanel>
<StackPanel>
<ToggleButton x:Name="DropdownButtonSorting" Width="70" Height="70" Background="Transparent"
BorderThickness="0" Margin="5 0" VerticalAlignment="Center"
IsEnabled="{Binding !FetchingData}"
IsChecked="{Binding SortingSelectionOpen}">
<StackPanel Orientation="Vertical">
<controls:SymbolIcon Symbol="Sort" FontSize="32" />
<TextBlock Text="Sort" FontSize="12"></TextBlock>
</StackPanel>
</ToggleButton>
<Popup IsLightDismissEnabled="True"
IsOpen="{Binding IsChecked, ElementName=DropdownButtonSorting, Mode=TwoWay}"
Placement="BottomEdgeAlignedRight"
PlacementTarget="{Binding ElementName=DropdownButtonSorting}">
<Border BorderThickness="1" Background="{DynamicResource ComboBoxDropDownBackground}">
<ListBox SelectionMode="Single,Toggle" Width="210"
MaxHeight="400"
ItemsSource="{Binding SortingList}" SelectedItem="{Binding SelectedSorting}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
<controls:SymbolIcon IsVisible="{Binding !$parent[UserControl].((vm:HistoryPageViewModel)DataContext).SortDir}" Symbol="ChevronUp" FontSize="12" Margin="0 0 10 0" />
<controls:SymbolIcon IsVisible="{Binding $parent[UserControl].((vm:HistoryPageViewModel)DataContext).SortDir}" Symbol="ChevronDown" FontSize="12" Margin="0 0 10 0" />
<TextBlock Text="{Binding SortingTitle}"></TextBlock>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
</Popup>
</StackPanel>
<StackPanel>
<ToggleButton x:Name="DropdownButtonFilter" Width="70" Height="70" Background="Transparent" BorderThickness="0" Margin="5 0"
VerticalAlignment="Center"
IsEnabled="{Binding !FetchingData}">
<StackPanel Orientation="Vertical">
<controls:SymbolIcon Symbol="Filter" FontSize="32" />
<TextBlock Text="Filter" FontSize="12"></TextBlock>
</StackPanel>
</ToggleButton>
<Popup IsLightDismissEnabled="True"
IsOpen="{Binding IsChecked, ElementName=DropdownButtonFilter, Mode=TwoWay}"
Placement="BottomEdgeAlignedRight"
PlacementTarget="{Binding ElementName=DropdownButtonFilter}">
<Border BorderThickness="1" Background="{DynamicResource ComboBoxDropDownBackground}">
<ListBox SelectionMode="Single" Width="210"
MaxHeight="400"
ItemsSource="{Binding FilterList}" SelectedItem="{Binding SelectedFilter}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding FilterTitle}"></TextBlock>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
</Popup>
</StackPanel>
</StackPanel>
<ListBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" ItemsSource="{Binding FilteredItems}"
SelectedItem="{Binding SelectedSeries}"
Margin="5" IsVisible="{Binding IsPosterViewSelected}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal"></WrapPanel>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<StackPanel Orientation="Vertical" HorizontalAlignment="Center"
Width="{Binding $parent[UserControl].((vm:HistoryPageViewModel)DataContext).PosterWidth}"
Height="{Binding $parent[UserControl].((vm:HistoryPageViewModel)DataContext).PosterHeight}"
Margin="5">
<Grid>
<Image Source="{Binding ThumbnailImage}"
Width="{Binding $parent[UserControl].((vm:HistoryPageViewModel)DataContext).PosterImageWidth}"
Height="{Binding $parent[UserControl].((vm:HistoryPageViewModel)DataContext).PosterImageHeight}">
</Image>
<Border VerticalAlignment="Top" HorizontalAlignment="Right" CornerRadius="0 0 0 10"
Background="#f78c25" Opacity="1"
Margin="{Binding $parent[UserControl].((vm:HistoryPageViewModel)DataContext).CornerMargin} "
IsVisible="{Binding NewEpisodes, Converter={StaticResource UiIntToVisibilityConverter}}">
<TextBlock VerticalAlignment="Center" TextAlignment="Center" Width="30"
Height="30"
Text="{Binding NewEpisodes}"
Padding="0,5,0,0" />
</Border>
</Grid>
<TextBlock HorizontalAlignment="Center" TextAlignment="Center"
Text="{Binding SeriesTitle}"
TextWrapping="Wrap"
Width="{Binding $parent[UserControl].((vm:HistoryPageViewModel)DataContext).PosterImageWidth}"
FontSize="{Binding $parent[UserControl].((vm:HistoryPageViewModel)DataContext).PosterTextSize}"
Height="35"
Margin="4,0,4,0">
<ToolTip.Tip>
<TextBlock Text="{Binding SeriesTitle}" FontSize="15" />
</ToolTip.Tip>
</TextBlock>
<TextBlock HorizontalAlignment="Center" TextAlignment="Center"
Text="{Binding SonarrNextAirDate}"
TextWrapping="Wrap"
Width="{Binding $parent[UserControl].((vm:HistoryPageViewModel)DataContext).PosterImageWidth}"
FontSize="{Binding $parent[UserControl].((vm:HistoryPageViewModel)DataContext).PosterTextSize}"
MaxHeight="20"
Margin="4,0,4,0">
<ToolTip.Tip>
<TextBlock Text="{Binding SonarrNextAirDate}" FontSize="15" />
</ToolTip.Tip>
</TextBlock>
</StackPanel>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="#90000000" IsVisible="{Binding $parent[UserControl].((vm:HistoryPageViewModel)DataContext).EditMode}">
<Button
Background="Transparent"
BorderThickness="0"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
FontStyle="Italic"
Command="{Binding $parent[UserControl].((vm:HistoryPageViewModel)DataContext).RemoveSeries}"
CommandParameter="{Binding SeriesId}"
IsEnabled="{Binding !$parent[UserControl].((vm:HistoryPageViewModel)DataContext).FetchingData}">
<ToolTip.Tip>
<TextBlock Text="Remove Series" FontSize="15" />
</ToolTip.Tip>
<StackPanel Orientation="Horizontal">
<controls:SymbolIcon Symbol="Delete" FontSize="32" />
</StackPanel>
</Button>
</Grid>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="#90000000" IsVisible="{Binding FetchingData}">
<controls:ProgressRing Width="100" Height="100"></controls:ProgressRing>
</Grid>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" IsVisible="{Binding IsTableViewSelected}">
<ScrollViewer>
<controls:ItemsRepeater ItemsSource="{Binding FilteredItems}">
<controls:ItemsRepeater.Layout>
<controls:StackLayout Orientation="Vertical" Spacing="5" />
</controls:ItemsRepeater.Layout>
<controls:ItemsRepeater.ItemTemplate>
<DataTemplate DataType="{x:Type history:HistorySeries}">
<Grid>
<controls:SettingsExpander
x:Name="SettingsExpanderSeries"
Header="{Binding .}"
ItemsSource="{Binding .}"
IsExpanded="{Binding IsExpanded}">
<controls:SettingsExpander.HeaderTemplate>
<DataTemplate DataType="{x:Type history:HistorySeries}">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Grid.Row="1" Grid.Column="0">
<!-- Define a row with auto height to match the image height -->
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Define columns if needed -->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Image element -->
<Image Margin="10"
Source="{Binding ThumbnailImage}"
Width="120"
Height="180" />
<!-- Border element aligned within the same grid cell, overlaying the image -->
<Border VerticalAlignment="Top" HorizontalAlignment="Right"
CornerRadius="0 0 0 10"
Background="#f78c25" Opacity="1"
Margin="10"
IsVisible="{Binding NewEpisodes, Converter={StaticResource UiIntToVisibilityConverter}}"
Grid.Row="0" Grid.Column="0">
<TextBlock VerticalAlignment="Center" TextAlignment="Center"
Width="30" Height="30"
Text="{Binding NewEpisodes}"
Padding="0,5,0,0" />
</Border>
</Grid>
<Grid Grid.Row="1" Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" FontSize="25" Text="{Binding SeriesTitle}"></TextBlock>
<TextBlock Grid.Row="1" FontSize="15" TextWrapping="Wrap"
Text="{Binding SeriesDescription}">
</TextBlock>
<StackPanel Grid.Row="3" Orientation="Vertical">
<StackPanel Orientation="Horizontal" Margin="0 10 10 10">
<Button Width="34" Height="34" Margin="0 0 10 0"
Background="Transparent"
BorderThickness="0" CornerRadius="50"
Command="{Binding OpenCrPage}">
<Grid>
<controls:ImageIcon
Source="../Assets/crunchy_icon_round.png"
Width="30"
Height="30" />
</Grid>
</Button>
<Button Width="34" Height="34" Margin="0 0 10 0"
Background="Transparent"
BorderThickness="0" CornerRadius="50"
IsVisible="{Binding SonarrSeriesId, Converter={StaticResource UiSonarrIdToVisibilityConverter}}"
Command="{Binding OpenSonarrPage}">
<Grid>
<controls:ImageIcon
Source="../Assets/sonarr.png"
Width="30"
Height="30" />
</Grid>
</Button>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Command="{Binding FetchData}" Margin="0 0 5 10">Refresh Series</Button>
<ToggleButton x:Name="SeriesEditModeToggle" IsChecked="{Binding EditModeEnabled}" Margin="0 0 5 10">Edit</ToggleButton>
<Button Margin="0 0 5 10" FontStyle="Italic"
VerticalAlignment="Center"
Command="{Binding $parent[UserControl].((vm:HistoryPageViewModel)DataContext).OpenFolderDialogAsyncSeries}"
CommandParameter="{Binding .}">
<ToolTip.Tip>
<TextBlock Text="{Binding SeriesDownloadPath}"
FontSize="15" />
</ToolTip.Tip>
<StackPanel Orientation="Horizontal">
<controls:SymbolIcon Symbol="Folder" FontSize="18" />
</StackPanel>
</Button>
<StackPanel>
<ToggleButton x:Name="SeriesOverride" Margin="0 0 5 10" FontStyle="Italic"
VerticalAlignment="Center"
IsVisible="{Binding EditModeEnabled}">
<StackPanel Orientation="Horizontal">
<controls:SymbolIcon Symbol="Speaker2" FontSize="18" />
</StackPanel>
</ToggleButton>
<Popup IsLightDismissEnabled="True"
MaxWidth="400"
MaxHeight="600"
IsOpen="{Binding IsChecked, ElementName=SeriesOverride, Mode=TwoWay}"
Placement="Bottom"
PlacementTarget="{Binding ElementName=SeriesOverride}">
<Border BorderThickness="1" Background="{DynamicResource ComboBoxDropDownBackground}">
<StackPanel>
<controls:SettingsExpander Header="Language Override">
<controls:SettingsExpander.Footer>
<StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0 0 0 10">
<TextBlock Text="Dub" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0 0 10 0"></TextBlock>
<StackPanel>
<ToggleButton x:Name="DropdownButtonDub" Width="210" HorizontalContentAlignment="Stretch">
<ToggleButton.Content>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock HorizontalAlignment="Center" Text="{Binding SelectedDubs}"
VerticalAlignment="Center" />
<Path Grid.Column="1" Data="M 0,1 L 4,4 L 8,1" Stroke="White" StrokeThickness="1"
VerticalAlignment="Center" Margin="5,0,5,0" Stretch="Uniform" Width="8" />
</Grid>
</ToggleButton.Content>
</ToggleButton>
<Popup IsLightDismissEnabled="True"
IsOpen="{Binding IsChecked, ElementName=DropdownButtonDub, Mode=TwoWay}"
Placement="Bottom"
PlacementTarget="{Binding ElementName=DropdownButtonDub}">
<Border BorderThickness="1" Background="{DynamicResource ComboBoxDropDownBackground}">
<ListBox x:Name="ListBoxDubsSelection" SelectionMode="Multiple,Toggle" Width="210"
MaxHeight="400"
ItemsSource="{Binding DubLangList, Mode=OneWay}"
SelectedItems="{Binding SelectedDubLang}">
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type structs:StringItem}">
<TextBlock Text="{Binding stringValue}"></TextBlock>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
</Popup>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="Sub" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0 0 10 0"></TextBlock>
<StackPanel>
<ToggleButton x:Name="DropdownButtonSub" Width="210" HorizontalContentAlignment="Stretch">
<ToggleButton.Content>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock HorizontalAlignment="Center" Text="{Binding SelectedSubs}"
VerticalAlignment="Center" />
<Path Grid.Column="1" Data="M 0,1 L 4,4 L 8,1" Stroke="White" StrokeThickness="1"
VerticalAlignment="Center" Margin="5,0,5,0" Stretch="Uniform" Width="8" />
</Grid>
</ToggleButton.Content>
</ToggleButton>
<Popup IsLightDismissEnabled="True"
IsOpen="{Binding IsChecked, ElementName=DropdownButtonSub, Mode=TwoWay}" Placement="Bottom"
PlacementTarget="{Binding ElementName=DropdownButtonSub}">
<Border BorderThickness="1" Background="{DynamicResource ComboBoxDropDownBackground}">
<ListBox SelectionMode="Multiple,Toggle" Width="210"
MaxHeight="400"
ItemsSource="{Binding SubLangList, Mode=OneWay}"
SelectedItems="{Binding SelectedSubLang}">
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type structs:StringItem}">
<TextBlock Text="{Binding stringValue}"></TextBlock>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
</Popup>
</StackPanel>
</StackPanel>
</StackPanel>
</controls:SettingsExpander.Footer>
</controls:SettingsExpander>
</StackPanel>
</Border>
</Popup>
</StackPanel>
</StackPanel>
</StackPanel>
</Grid>
</Grid>
</DataTemplate>
</controls:SettingsExpander.HeaderTemplate>
<controls:SettingsExpanderItem>
<ScrollViewer>
<ItemsControl ItemsSource="{Binding Seasons}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type history:HistorySeason}">
<controls:SettingsExpander
Header="{Binding CombinedProperty}"
ItemsSource="{Binding EpisodesList}"
Description="{Binding SeasonTitle}"
IsExpanded="{Binding IsExpanded}">
<controls:SettingsExpander.ItemTemplate>
<DataTemplate DataType="{x:Type history:HistoryEpisode}">
<Grid VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal"
VerticalAlignment="Center">
<TextBlock Text="E"></TextBlock>
<TextBlock Text="{Binding Episode}"></TextBlock>
<TextBlock Text=" - "></TextBlock>
<TextBlock Text="{Binding EpisodeTitle}"></TextBlock>
</StackPanel>
<StackPanel Grid.Column="1"
Orientation="Horizontal"
VerticalAlignment="Center">
<StackPanel VerticalAlignment="Center"
Margin="0 0 5 0"
IsVisible="{Binding $parent[ScrollViewer].((history:HistorySeries)DataContext).SonarrSeriesId, Converter={StaticResource UiSonarrIdToVisibilityConverter}}">
<controls:ImageIcon
IsVisible="{Binding SonarrHasFile}"
Source="../Assets/sonarr.png"
Width="25"
Height="25" />
<controls:ImageIcon
IsVisible="{Binding !SonarrHasFile}"
Source="../Assets/sonarr_inactive.png"
Width="25"
Height="25" />
</StackPanel>
<Button Width="34" Height="34"
Margin="0 0 10 0" Background="Transparent"
BorderThickness="0" CornerRadius="50"
IsVisible="{Binding !WasDownloaded}"
Command="{Binding ToggleWasDownloadedSeries}"
CommandParameter="{Binding $parent[ScrollViewer].((history:HistorySeries)DataContext)}">
<Grid>
<Ellipse Width="25" Height="25"
Fill="Gray" />
<controls:SymbolIcon Symbol="Checkmark"
FontSize="18" />
</Grid>
</Button>
<Button Width="34" Height="34"
Margin="0 0 10 0" Background="Transparent"
BorderThickness="0" CornerRadius="50"
IsVisible="{Binding WasDownloaded}"
Command="{Binding ToggleWasDownloadedSeries}"
CommandParameter="{Binding $parent[ScrollViewer].((history:HistorySeries)DataContext)}">
<Grid>
<Ellipse Width="25" Height="25"
Fill="#21a556" />
<controls:SymbolIcon Symbol="Checkmark"
FontSize="18" />
</Grid>
</Button>
<Button Margin="0 0 5 0" FontStyle="Italic"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Command="{Binding DownloadEpisode}">
<StackPanel Orientation="Horizontal">
<controls:SymbolIcon Symbol="Download"
FontSize="18" />
</StackPanel>
</Button>
</StackPanel>
</Grid>
</DataTemplate>
</controls:SettingsExpander.ItemTemplate>
<controls:SettingsExpander.Footer>
<StackPanel Orientation="Horizontal"
VerticalAlignment="Center">
<TextBlock Text="{Binding DownloadedEpisodes}" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="/" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding EpisodesList.Count}" VerticalAlignment="Center"></TextBlock>
<Button Margin="10 0 0 0" FontStyle="Italic"
VerticalAlignment="Center"
Command="{Binding $parent[ScrollViewer].((history:HistorySeries)DataContext).FetchData}"
CommandParameter="{Binding SeasonId}">
<ToolTip.Tip>
<TextBlock Text="Refresh Season" FontSize="15" />
</ToolTip.Tip>
<StackPanel Orientation="Horizontal">
<controls:SymbolIcon Symbol="Refresh"
FontSize="18" />
</StackPanel>
</Button>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<ToggleButton x:Name="ToggleDownloadAdd" Margin="10 0 0 0" FontStyle="Italic"
VerticalAlignment="Center">
<StackPanel Orientation="Horizontal">
<controls:SymbolIcon Symbol="Download" FontSize="18" />
</StackPanel>
</ToggleButton>
<Popup IsLightDismissEnabled="True"
MaxWidth="400"
MaxHeight="600"
IsOpen="{Binding IsChecked, ElementName=ToggleDownloadAdd, Mode=TwoWay}"
Placement="Bottom"
PlacementTarget="{Binding ElementName=ToggleDownloadAdd}">
<Border BorderThickness="1" Background="{DynamicResource ComboBoxDropDownBackground}">
<StackPanel>
<Button Margin="10 5"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
Content="Download All"
Command="{Binding $parent[UserControl].((vm:HistoryPageViewModel)DataContext).DownloadSeasonAll}"
CommandParameter="{Binding }">
</Button>
<Button Margin="10 5"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
Content="Download Missing"
Command="{Binding $parent[UserControl].((vm:HistoryPageViewModel)DataContext).DownloadSeasonMissing}"
CommandParameter="{Binding }">
</Button>
<Button Margin="10 5"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
Content="Download Missing from Sonarr"
IsEnabled="{Binding $parent[ScrollViewer].((history:HistorySeries)DataContext).SonarrSeriesId, Converter={StaticResource UiSonarrIdToVisibilityConverter}}"
Command="{Binding $parent[UserControl].((vm:HistoryPageViewModel)DataContext).DownloadSeasonMissingSonarr}"
CommandParameter="{Binding }">
</Button>
</StackPanel>
</Border>
</Popup>
</StackPanel>
<Button Margin="10 0 0 0" FontStyle="Italic"
VerticalAlignment="Center"
Command="{Binding $parent[UserControl].((vm:HistoryPageViewModel)DataContext).OpenFolderDialogAsyncSeason}"
CommandParameter="{Binding .}">
<ToolTip.Tip>
<TextBlock Text="{Binding SeasonDownloadPath}"
FontSize="15" />
</ToolTip.Tip>
<StackPanel Orientation="Horizontal">
<controls:SymbolIcon Symbol="Folder"
FontSize="18" />
</StackPanel>
</Button>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<ToggleButton x:Name="SeasonOverride" Margin="10 0 0 0" FontStyle="Italic"
VerticalAlignment="Center"
IsVisible="{Binding $parent[ScrollViewer].((history:HistorySeries)DataContext).EditModeEnabled}">
<StackPanel Orientation="Horizontal">
<controls:SymbolIcon Symbol="Speaker2" FontSize="18" />
</StackPanel>
</ToggleButton>
<Popup IsLightDismissEnabled="True"
MaxWidth="400"
MaxHeight="600"
IsOpen="{Binding IsChecked, ElementName=SeasonOverride, Mode=TwoWay}"
Placement="Bottom"
PlacementTarget="{Binding ElementName=SeasonOverride}">
<Border BorderThickness="1" Background="{DynamicResource ComboBoxDropDownBackground}">
<StackPanel>
<controls:SettingsExpander Header="Language Override">
<controls:SettingsExpander.Footer>
<StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0 0 0 10">
<TextBlock Text="Dub" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0 0 10 0"></TextBlock>
<StackPanel>
<ToggleButton x:Name="SeasonOverrideDropdownButtonDub" Width="210" HorizontalContentAlignment="Stretch">
<ToggleButton.Content>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock HorizontalAlignment="Center" Text="{Binding SelectedDubs}"
VerticalAlignment="Center" />
<Path Grid.Column="1" Data="M 0,1 L 4,4 L 8,1" Stroke="White" StrokeThickness="1"
VerticalAlignment="Center" Margin="5,0,5,0" Stretch="Uniform" Width="8" />
</Grid>
</ToggleButton.Content>
</ToggleButton>
<Popup IsLightDismissEnabled="True"
IsOpen="{Binding IsChecked, ElementName=SeasonOverrideDropdownButtonDub, Mode=TwoWay}"
Placement="Bottom"
PlacementTarget="{Binding ElementName=SeasonOverrideDropdownButtonDub}">
<Border BorderThickness="1" Background="{DynamicResource ComboBoxDropDownBackground}">
<ListBox x:Name="ListBoxDubsSelection" SelectionMode="Multiple,Toggle" Width="210"
MaxHeight="400"
ItemsSource="{Binding DubLangList}"
SelectedItems="{Binding SelectedDubLang}">
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type structs:StringItem}">
<TextBlock Text="{Binding stringValue}"></TextBlock>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
</Popup>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="Sub" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="0 0 10 0"></TextBlock>
<StackPanel>
<ToggleButton x:Name="SeasonOverrideDropdownButtonSub" Width="210" HorizontalContentAlignment="Stretch">
<ToggleButton.Content>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock HorizontalAlignment="Center" Text="{Binding SelectedSubs}"
VerticalAlignment="Center" />
<Path Grid.Column="1" Data="M 0,1 L 4,4 L 8,1" Stroke="White" StrokeThickness="1"
VerticalAlignment="Center" Margin="5,0,5,0" Stretch="Uniform" Width="8" />
</Grid>
</ToggleButton.Content>
</ToggleButton>
<Popup IsLightDismissEnabled="True"
IsOpen="{Binding IsChecked, ElementName=SeasonOverrideDropdownButtonSub, Mode=TwoWay}" Placement="Bottom"
PlacementTarget="{Binding ElementName=SeasonOverrideDropdownButtonSub}">
<Border BorderThickness="1" Background="{DynamicResource ComboBoxDropDownBackground}">
<ListBox SelectionMode="Multiple,Toggle" Width="210"
MaxHeight="400"
ItemsSource="{Binding SubLangList}"
SelectedItems="{Binding SelectedSubLang}">
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type structs:StringItem}">
<TextBlock Text="{Binding stringValue}"></TextBlock>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
</Popup>
</StackPanel>
</StackPanel>
</StackPanel>
</controls:SettingsExpander.Footer>
</controls:SettingsExpander>
</StackPanel>
</Border>
</Popup>
</StackPanel>
<Button Margin="10 0 0 0" FontStyle="Italic"
IsVisible="{Binding $parent[ScrollViewer].((history:HistorySeries)DataContext).EditModeEnabled}"
Command="{Binding $parent[ScrollViewer].((history:HistorySeries)DataContext).RemoveSeason}"
CommandParameter="{Binding SeasonId}"
VerticalAlignment="Center">
<ToolTip.Tip>
<TextBlock Text="Remove Season" FontSize="15" />
</ToolTip.Tip>
<StackPanel Orientation="Horizontal">
<controls:SymbolIcon Symbol="Delete"
FontSize="18" />
</StackPanel>
</Button>
</StackPanel>
</controls:SettingsExpander.Footer>
</controls:SettingsExpander>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</controls:SettingsExpanderItem>
</controls:SettingsExpander>
<Grid IsVisible="{Binding FetchingData}"
Background="#90000000"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<controls:ProgressRing Width="100" Height="100" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
<Grid IsVisible="{Binding $parent[UserControl].((vm:HistoryPageViewModel)DataContext).EditMode}"
Background="#90000000"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Button
Background="Transparent"
BorderThickness="0"
FontStyle="Italic"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
Command="{Binding $parent[UserControl].((vm:HistoryPageViewModel)DataContext).RemoveSeries}"
CommandParameter="{Binding SeriesId}"
IsEnabled="{Binding !$parent[UserControl].((vm:HistoryPageViewModel)DataContext).FetchingData}">
<ToolTip.Tip>
<TextBlock Text="Remove Series" FontSize="15" />
</ToolTip.Tip>
<StackPanel Orientation="Horizontal">
<controls:SymbolIcon Symbol="Delete" FontSize="32" />
</StackPanel>
</Button>
</Grid>
</Grid>
</DataTemplate>
</controls:ItemsRepeater.ItemTemplate>
</controls:ItemsRepeater>
</ScrollViewer>
</Grid>
</Grid>
</UserControl>