diff --git a/src/ZonyLrcTools.Common/Configuration/TagInfoProviderOptions.cs b/src/ZonyLrcTools.Common/Configuration/TagInfoProviderOptions.cs index 8365883..c1b85c2 100644 --- a/src/ZonyLrcTools.Common/Configuration/TagInfoProviderOptions.cs +++ b/src/ZonyLrcTools.Common/Configuration/TagInfoProviderOptions.cs @@ -6,6 +6,6 @@ namespace ZonyLrcTools.Common.Configuration public int Priority { get; set; } - public Dictionary Extensions { get; set; } = null!; + public Dictionary? Extensions { get; set; } = null!; } } \ No newline at end of file diff --git a/src/ZonyLrcTools.Desktop/App.axaml b/src/ZonyLrcTools.Desktop/App.axaml index 850f55e..fb9057b 100644 --- a/src/ZonyLrcTools.Desktop/App.axaml +++ b/src/ZonyLrcTools.Desktop/App.axaml @@ -2,14 +2,27 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="ZonyLrcTools.Desktop.App" xmlns:local="using:ZonyLrcTools.Desktop" - RequestedThemeVariant="Default"> - + xmlns:styling="clr-namespace:FluentAvalonia.Styling;assembly=FluentAvalonia" + RequestedThemeVariant="Default" + xmlns:ic="using:FluentIcons.Avalonia.Fluent" + xmlns:sty="using:FluentAvalonia.Styling"> + - + - + + + + Microsoft YaHei, Simsun, Arial + + + + + \ No newline at end of file diff --git a/src/ZonyLrcTools.Desktop/App.axaml.cs b/src/ZonyLrcTools.Desktop/App.axaml.cs index 90f68ff..dba6084 100644 --- a/src/ZonyLrcTools.Desktop/App.axaml.cs +++ b/src/ZonyLrcTools.Desktop/App.axaml.cs @@ -1,6 +1,9 @@ +using System; using Avalonia; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; +using Microsoft.Extensions.DependencyInjection; +using ZonyLrcTools.Common.Infrastructure.DependencyInject; using ZonyLrcTools.Desktop.ViewModels; using ZonyLrcTools.Desktop.Views; @@ -8,6 +11,23 @@ namespace ZonyLrcTools.Desktop; public partial class App : Application { + public new static App Current => (App)Application.Current!; + public IServiceProvider Services { get; } + + public App() + { + Services = ConfigureServices(); + } + + private static IServiceProvider ConfigureServices() + { + var services = new ServiceCollection(); + + services.ConfigureConfiguration(); + + return services.BuildServiceProvider(); + } + public override void Initialize() { AvaloniaXamlLoader.Load(this); @@ -19,7 +39,7 @@ public partial class App : Application { desktop.MainWindow = new MainWindow { - DataContext = new MainWindowViewModel(), + DataContext = new HomeViewModel(), }; } diff --git a/src/ZonyLrcTools.Desktop/Assets/logo.ico b/src/ZonyLrcTools.Desktop/Assets/logo.ico new file mode 100644 index 0000000..f23d47f Binary files /dev/null and b/src/ZonyLrcTools.Desktop/Assets/logo.ico differ diff --git a/src/ZonyLrcTools.Desktop/Pages/HomePage.axaml b/src/ZonyLrcTools.Desktop/Pages/HomePage.axaml new file mode 100644 index 0000000..b84af62 --- /dev/null +++ b/src/ZonyLrcTools.Desktop/Pages/HomePage.axaml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ZonyLrcTools.Desktop/Pages/HomePage.axaml.cs b/src/ZonyLrcTools.Desktop/Pages/HomePage.axaml.cs new file mode 100644 index 0000000..b0d5d33 --- /dev/null +++ b/src/ZonyLrcTools.Desktop/Pages/HomePage.axaml.cs @@ -0,0 +1,11 @@ +using Avalonia.Controls; + +namespace ZonyLrcTools.Desktop.Pages; + +public partial class HomePage : UserControl +{ + public HomePage() + { + InitializeComponent(); + } +} \ No newline at end of file diff --git a/src/ZonyLrcTools.Desktop/Pages/SettingsPage.axaml b/src/ZonyLrcTools.Desktop/Pages/SettingsPage.axaml new file mode 100644 index 0000000..d320b3c --- /dev/null +++ b/src/ZonyLrcTools.Desktop/Pages/SettingsPage.axaml @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ZonyLrcTools.Desktop/Views/MainView.axaml.cs b/src/ZonyLrcTools.Desktop/Views/MainView.axaml.cs new file mode 100644 index 0000000..3769331 --- /dev/null +++ b/src/ZonyLrcTools.Desktop/Views/MainView.axaml.cs @@ -0,0 +1,60 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Interactivity; +using Avalonia.Platform.Storage; +using FluentAvalonia.UI.Controls; +using ZonyLrcTools.Desktop.Pages; + +namespace ZonyLrcTools.Desktop.Views; + +public partial class MainView : UserControl +{ + private Window? _window; + + private Frame? _frameView; + private Button? _settingsButton; + private Button? _openFolderButton; + private Button? _downloadButton; + + public MainView() + { + InitializeComponent(); + } + + protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e) + { + base.OnAttachedToVisualTree(e); + + _window = e.Root as Window; + + _frameView = this.FindControl("FrameView"); + _frameView?.Navigate(typeof(HomePage)); + + _settingsButton = this.FindControl