mirror of
https://github.com/Crunchy-DL/Crunchy-Downloader.git
synced 2026-01-11 20:10:26 +00:00
Add - Added **Sonarr season/episode numbers** to the history view Add - Added option to **match episodes to Sonarr episodes** to correct mismatches Add - Added **button to rematch all Sonarr episodes** Add - Added an **optional secondary endpoint** Chg - Changed **changelog heading sizes** Chg - Changed Sonarr matching to only process **new or unmatched episodes** Chg - Changed logic to **request audio license keys only when needed** Fix - Fixed **Sonarr series manual matching dialog**
52 lines
No EOL
1.7 KiB
C#
52 lines
No EOL
1.7 KiB
C#
using System;
|
|
using System.Collections.ObjectModel;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Layout;
|
|
using Avalonia.Media.Imaging;
|
|
using CRD.Downloader.Crunchyroll.ViewModels;
|
|
using CRD.Downloader.Crunchyroll.Views;
|
|
using CRD.ViewModels.Utils;
|
|
using CRD.Views.Utils;
|
|
using FluentAvalonia.UI.Controls;
|
|
using Image = Avalonia.Controls.Image;
|
|
|
|
namespace CRD.ViewModels;
|
|
|
|
public class SettingsPageViewModel : ViewModelBase{
|
|
|
|
public ObservableCollection<TabViewItem> Tabs{ get; } = new();
|
|
|
|
private TabViewItem CreateTab(string header, string iconPath, UserControl content, object viewModel){
|
|
content.DataContext = viewModel;
|
|
|
|
Bitmap? bitmap = null;
|
|
try{
|
|
// Load the image using AssetLoader.Open
|
|
bitmap = new Bitmap(Avalonia.Platform.AssetLoader.Open(new Uri(iconPath)));
|
|
} catch (Exception ex){
|
|
Console.WriteLine($"Error loading image: {ex.Message}");
|
|
}
|
|
|
|
return new TabViewItem{
|
|
Header = new StackPanel{
|
|
Orientation = Orientation.Horizontal,
|
|
Spacing = 5,
|
|
Children ={
|
|
new Image{ Source = bitmap, Width = 18, Height = 18 },
|
|
new TextBlock{ Text = header, FontSize = 16}
|
|
}
|
|
},
|
|
IsClosable = false,
|
|
Content = content
|
|
};
|
|
}
|
|
|
|
public SettingsPageViewModel(){
|
|
// Add initial tabs
|
|
Tabs.Add(CreateTab("General Settings", "avares://CRD/Assets/app_icon.ico", new GeneralSettingsView(), new GeneralSettingsViewModel()));
|
|
Tabs.Add(CreateTab("Crunchyroll Settings", "avares://CRD/Assets/crunchy_icon_round.png", new CrunchyrollSettingsView(), new CrunchyrollSettingsViewModel()));
|
|
|
|
}
|
|
|
|
|
|
} |