Add - Added "Add to Queue" button to history page
Chg - Update button is now always visible but becomes inactive if no update is available Fix - Scaling issue in calendar Fix - Refresh all button on history page not working
This commit is contained in:
parent
f911489021
commit
76ddd9241a
|
@ -273,7 +273,7 @@ public class Crunchyroll{
|
|||
return week;
|
||||
}
|
||||
|
||||
public async void AddEpisodeToQue(string epId, string locale, List<string> dubLang){
|
||||
public async Task AddEpisodeToQue(string epId, string locale, List<string> dubLang){
|
||||
await CrAuth.RefreshToken(true);
|
||||
|
||||
var episodeL = await CrEpisode.ParseEpisodeById(epId, locale);
|
||||
|
|
|
@ -34,7 +34,7 @@ public class History(Crunchyroll crunInstance){
|
|||
foreach (int season in result.Keys){
|
||||
foreach (var key in result[season].Keys){
|
||||
var s = result[season][key];
|
||||
if (seasonId != null && s.Id != seasonId) continue;
|
||||
if (!string.IsNullOrEmpty(seasonId) && s.Id != seasonId) continue;
|
||||
var seasonData = await crunInstance.CrSeries.GetSeasonDataById(s);
|
||||
UpdateWithSeasonData(seasonData);
|
||||
}
|
||||
|
@ -338,6 +338,28 @@ public class HistorySeries : INotifyPropertyChanged{
|
|||
NewEpisodes = count;
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(NewEpisodes)));
|
||||
}
|
||||
|
||||
public async Task AddNewMissingToDownloads(){
|
||||
bool foundWatched = false;
|
||||
|
||||
// Iterate over the Seasons list from the end to the beginning
|
||||
for (int i = Seasons.Count - 1; i >= 0 && !foundWatched; i--){
|
||||
|
||||
if (Seasons[i].SpecialSeason == true){
|
||||
continue;
|
||||
}
|
||||
|
||||
// Iterate over the Episodes from the end to the beginning
|
||||
for (int j = Seasons[i].EpisodesList.Count - 1; j >= 0 && !foundWatched; j--){
|
||||
if (!Seasons[i].EpisodesList[j].WasDownloaded){
|
||||
//ADD to download queue
|
||||
await Seasons[i].EpisodesList[j].DownloadEpisode();
|
||||
} else{
|
||||
foundWatched = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task FetchData(string? seasonId){
|
||||
await Crunchyroll.Instance.CrHistory.UpdateSeries(SeriesId, seasonId);
|
||||
|
@ -404,8 +426,8 @@ public partial class HistoryEpisode : INotifyPropertyChanged{
|
|||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(WasDownloaded)));
|
||||
}
|
||||
|
||||
public void DownloadEpisode(){
|
||||
Crunchyroll.Instance.AddEpisodeToQue(EpisodeId, Crunchyroll.Instance.DefaultLocale, Crunchyroll.Instance.CrunOptions.DubLang);
|
||||
public async Task DownloadEpisode(){
|
||||
await Crunchyroll.Instance.AddEpisodeToQue(EpisodeId, Crunchyroll.Instance.DefaultLocale, Crunchyroll.Instance.CrunOptions.DubLang);
|
||||
|
||||
}
|
||||
}
|
|
@ -42,10 +42,18 @@ public partial class HistoryPageViewModel : ViewModelBase{
|
|||
|
||||
[RelayCommand]
|
||||
public async void RefreshAll(){
|
||||
foreach (var historySeries in Items){
|
||||
for (int i = 0; i < Items.Count; i++) {
|
||||
ShowLoading = true;
|
||||
await historySeries.FetchData("");
|
||||
historySeries.UpdateNewEpisodes();
|
||||
await Items[i].FetchData("");
|
||||
Items[i].UpdateNewEpisodes();
|
||||
}
|
||||
ShowLoading = false;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public async void AddMissingToQueue(){
|
||||
for (int i = 0; i < Items.Count; i++) {
|
||||
await Items[i].AddNewMissingToDownloads();
|
||||
}
|
||||
ShowLoading = false;
|
||||
}
|
||||
|
|
|
@ -21,13 +21,15 @@
|
|||
<ColumnDefinition Width="Auto" /> <!-- Takes up most space for the title -->
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button Grid.Row="0" Grid.Column="0" Margin="10 10 0 0" HorizontalAlignment="Center" Command="{Binding PrevWeek}">
|
||||
<Button Grid.Row="0" Grid.Column="0" Margin="10 10 0 0" HorizontalAlignment="Center"
|
||||
Command="{Binding PrevWeek}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<controls:SymbolIcon Symbol="ChevronLeft" FontSize="18" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0 10 0 0">
|
||||
<StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center"
|
||||
Margin="0 10 0 0">
|
||||
<Button HorizontalAlignment="Center" Command="{Binding Refresh}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<controls:SymbolIcon Symbol="Refresh" FontSize="18" />
|
||||
|
@ -40,7 +42,8 @@
|
|||
</StackPanel>
|
||||
|
||||
|
||||
<Button Grid.Row="0" Grid.Column="2" Margin="0 0 10 0" HorizontalAlignment="Center" Command="{Binding NextWeek}">
|
||||
<Button Grid.Row="0" Grid.Column="2" Margin="0 0 10 0" HorizontalAlignment="Center"
|
||||
Command="{Binding NextWeek}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<controls:SymbolIcon Symbol="ChevronRight" FontSize="18" />
|
||||
</StackPanel>
|
||||
|
@ -85,7 +88,7 @@
|
|||
<ListBox Grid.Row="1" ItemsSource="{Binding CalendarEpisodes}"> <!-- Adjust MaxHeight as needed -->
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border Padding="10" Margin="5" Height="200">
|
||||
<Border Padding="10" Margin="5">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<TextBlock HorizontalAlignment="Center"
|
||||
Text="{Binding DateTime, StringFormat='hh:mm tt'}"
|
||||
|
@ -93,20 +96,23 @@
|
|||
<Grid HorizontalAlignment="Center">
|
||||
<Image HorizontalAlignment="Center" Source="{Binding ImageBitmap}" />
|
||||
<StackPanel VerticalAlignment="Top" HorizontalAlignment="Left">
|
||||
<TextBlock VerticalAlignment="Center" TextAlignment="Center" Margin="0 0 5 0" Width="30" Height="30"
|
||||
Background="Black" Opacity="0.8" Text="{Binding EpisodeNumber}"
|
||||
Padding="0,5,0,0"/>
|
||||
<TextBlock VerticalAlignment="Center" TextAlignment="Center"
|
||||
Margin="0 0 5 0" Width="30" Height="30"
|
||||
Background="Black" Opacity="0.8"
|
||||
Text="{Binding EpisodeNumber}"
|
||||
Padding="0,5,0,0" />
|
||||
</StackPanel>
|
||||
<StackPanel VerticalAlignment="Bottom" HorizontalAlignment="Right"
|
||||
IsVisible="{Binding IsPremiumOnly}" Margin="0,0,5,5">
|
||||
<Canvas Width="28" Height="28">
|
||||
<Ellipse Fill="#40FFFFFF" Width="28" Height="28"/>
|
||||
<Viewbox Width="24" Height="24" Stretch="Uniform" Canvas.Left="2" Canvas.Top="2">
|
||||
<Ellipse Fill="#40FFFFFF" Width="28" Height="28" />
|
||||
<Viewbox Width="24" Height="24" Stretch="Uniform"
|
||||
Canvas.Left="2" Canvas.Top="2">
|
||||
<Canvas Width="50" Height="50"> <!-- Ensure inner canvas is large enough to hold the path data -->
|
||||
<Path Fill="#f78c25"
|
||||
Stroke="#f78c25"
|
||||
StrokeThickness="1"
|
||||
Data="M35.7,36.2H12.3c-0.7,0-1.4-0.5-1.6-1.2L6.1,18.6c-0.2-0.6,0-1.3,0.5-1.7c0.5-0.4,1.2-0.5,1.8-0.2l8.1,4.1 l6.2-8.3c0.3-0.4,0.8-0.7,1.3-0.7h0c0.5,0,1,0.2,1.3,0.7l6.2,8.3l8.2-4.1c0.6-0.3,1.3-0.2,1.8,0.2c0.5,0.4,0.7,1.1,0.5,1.7 L37.3,35C37.1,35.7,36.4,36.2,35.7,36.2z"/>
|
||||
Data="M35.7,36.2H12.3c-0.7,0-1.4-0.5-1.6-1.2L6.1,18.6c-0.2-0.6,0-1.3,0.5-1.7c0.5-0.4,1.2-0.5,1.8-0.2l8.1,4.1 l6.2-8.3c0.3-0.4,0.8-0.7,1.3-0.7h0c0.5,0,1,0.2,1.3,0.7l6.2,8.3l8.2-4.1c0.6-0.3,1.3-0.2,1.8,0.2c0.5,0.4,0.7,1.1,0.5,1.7 L37.3,35C37.1,35.7,36.4,36.2,35.7,36.2z" />
|
||||
</Canvas>
|
||||
</Viewbox>
|
||||
</Canvas>
|
||||
|
@ -124,7 +130,8 @@
|
|||
|
||||
</TextBlock>
|
||||
<Button HorizontalAlignment="Center" Content="Download"
|
||||
IsEnabled="{Binding HasPassed}" Command="{Binding AddEpisodeToQue}"
|
||||
IsEnabled="{Binding HasPassed}"
|
||||
Command="{Binding AddEpisodeToQue}"
|
||||
CommandParameter="{Binding EpisodeUrl}" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
|
|
@ -20,8 +20,11 @@
|
|||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal" Margin="20 0 0 0 ">
|
||||
<Button Command="{Binding RefreshAll}" Margin="10">Refresh All</Button>
|
||||
<Button Command="{Binding AddMissingToQueue}" Margin="10">Add To Queue</Button>
|
||||
</StackPanel>
|
||||
|
||||
<Button Grid.Row="0" Grid.Column="0" Command="{Binding RefreshAll}" Margin="10">Refresh All</Button>
|
||||
<Grid Grid.Row="1" Grid.Column="0">
|
||||
<!-- Spinner Style ProgressBar -->
|
||||
<ProgressBar IsIndeterminate="True"
|
||||
|
@ -32,7 +35,7 @@
|
|||
</ProgressBar>
|
||||
</Grid>
|
||||
|
||||
<ListBox Grid.Row="1" ItemsSource="{Binding Items}" IsVisible="{Binding !ShowLoading}" SelectedItem="{Binding SelectedSeries}" Margin="5">
|
||||
<ListBox Grid.Row="1" Grid.Column="0" ItemsSource="{Binding Items}" IsVisible="{Binding !ShowLoading}" SelectedItem="{Binding SelectedSeries}" Margin="5">
|
||||
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
</ui:NavigationView.MenuItems>
|
||||
<ui:NavigationView.FooterMenuItems>
|
||||
<ui:NavigationViewItem Classes="SampleAppNav" Content="Update Available" Tag="UpdateAvailable"
|
||||
IconSource="CloudDownload" Focusable="False" IsVisible="{Binding UpdateAvailable}" />
|
||||
IconSource="CloudDownload" Focusable="False" IsEnabled="{Binding UpdateAvailable}" />
|
||||
<ui:NavigationViewItem Classes="SampleAppNav" Content="Account" Tag="Account"
|
||||
IconSource="Contact" />
|
||||
<ui:NavigationViewItem Classes="SampleAppNav" Content="Settings" Tag="Settings"
|
||||
|
|
Loading…
Reference in New Issue