diff --git a/src/UnoFileDownloader/UnoFileDownloader/Directory.Packages.props b/src/UnoFileDownloader/UnoFileDownloader/Directory.Packages.props index 8ceeac2..e33833e 100644 --- a/src/UnoFileDownloader/UnoFileDownloader/Directory.Packages.props +++ b/src/UnoFileDownloader/UnoFileDownloader/Directory.Packages.props @@ -1,4 +1,4 @@ - + @@ -46,5 +46,6 @@ + diff --git a/src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader.Skia.Gtk/Download32x32Icon.png b/src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader.Skia.Gtk/Download32x32Icon.png new file mode 100644 index 0000000..7473e8b Binary files /dev/null and b/src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader.Skia.Gtk/Download32x32Icon.png differ diff --git a/src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader.Skia.Gtk/Program.cs b/src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader.Skia.Gtk/Program.cs index ecd3cd4..38d880a 100644 --- a/src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader.Skia.Gtk/Program.cs +++ b/src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader.Skia.Gtk/Program.cs @@ -1,5 +1,5 @@ using System; - +using System.Runtime.InteropServices; using GLib; using Uno.UI.Runtime.Skia.Gtk; @@ -18,7 +18,10 @@ public static void Main(string[] args) var host = new GtkHost(() => new AppHead()); + // 防止虚拟机内闪烁 + host.RenderSurfaceType = RenderSurfaceType.Software; + host.Run(); } } -} \ No newline at end of file +} diff --git a/src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader.Skia.Gtk/UnoFileDownloader.Skia.Gtk.csproj b/src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader.Skia.Gtk/UnoFileDownloader.Skia.Gtk.csproj index 58de840..6d7b01d 100644 --- a/src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader.Skia.Gtk/UnoFileDownloader.Skia.Gtk.csproj +++ b/src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader.Skia.Gtk/UnoFileDownloader.Skia.Gtk.csproj @@ -4,6 +4,21 @@ Exe net8.0 app.manifest + + + + com.dotnetcampus.unofiledownloader + 1.0.1 + + UnoFileDownloader + + 下载器 + Download32x32Icon.png + The file downloader. + 文件下载器,代码完全开源 + The UNO file downloader. + https://github.com/dotnet-campus/dotnetCampus.FileDownloader + dotnet-campus @@ -31,6 +46,9 @@ + + + diff --git a/src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader/App.cs b/src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader/App.cs index 1e90dab..0b27028 100644 --- a/src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader/App.cs +++ b/src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader/App.cs @@ -66,13 +66,15 @@ protected async override void OnLaunched(LaunchActivatedEventArgs args) .AddContentSerializer(context) //.AddJsonTypeInfo(WeatherForecastContext.Default.IImmutableListWeatherForecast) ) - .UseHttp((context, services) => services - // Register HttpClient + .UseHttp((context, services) => + { + // Register HttpClient #if DEBUG - // DelegatingHandler will be automatically injected into Refit Client - .AddTransient() + // DelegatingHandler will be automatically injected into Refit Client + services.AddTransient(); #endif - ) + } + ) .ConfigureServices((context, services) => { // TODO: Register your services diff --git a/src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader/Presentation/MainPage.xaml.cs b/src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader/Presentation/MainPage.xaml.cs index 220a717..7e5b93d 100644 --- a/src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader/Presentation/MainPage.xaml.cs +++ b/src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader/Presentation/MainPage.xaml.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using Uno.Logging; namespace UnoFileDownloader.Presentation { @@ -24,6 +25,7 @@ private void MainPage_DataContextChanged(FrameworkElement sender, DataContextCha { #if DEBUG // 谁,是谁,乱改 DataContext 的类型! + // 在 WinUI 项目里面可能进入多次,这是符合预期的,只需要最后一次的 DataContext 是正确的就行了 Debugger.Break(); #endif } @@ -40,6 +42,7 @@ private void DownloadFileInfoViewList_CollectionChanged(object? sender, System.C private void UpdateTaskListNoItemsTextBlock() { TaskListNoItemsTextBlock.Visibility = + // 如果下载列表为空,就显示“没有任务”文本块 ViewModel.DownloadFileInfoViewList.Count == 0 ? Visibility.Visible : Visibility.Collapsed; } @@ -65,6 +68,7 @@ private void DownloadItemOpenFileButton_OnClick(object sender, RoutedEventArgs e catch (Exception exception) { // 忽略吧,可能是需要管理员权限,但是用户取消了 + this.Log().LogWarning(exception, "打开文件失败"); } }