Skip to content

Commit 1da8977

Browse files
authored
Merge pull request #59 from dotnet-campus/t/lindexi/Uno
准备给下载器打包一个 UOS 系统可用版本
2 parents 01afef2 + a834677 commit 1da8977

File tree

6 files changed

+36
-8
lines changed

6 files changed

+36
-8
lines changed

src/UnoFileDownloader/UnoFileDownloader/Directory.Packages.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project ToolsVersion="15.0">
1+
<Project ToolsVersion="15.0">
22
<ItemGroup>
33
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="8.0.0-rc.2.23479.6" />
44
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
@@ -46,5 +46,6 @@
4646
<PackageVersion Include="Xamarin.Google.Android.Material" Version="1.10.0.1" />
4747
<PackageVersion Include="Uno.UITest.Helpers" Version="1.1.0-dev.70" />
4848
<PackageVersion Include="Xamarin.UITest" Version="4.3.0" />
49+
<PackageVersion Include="Packaging.DebUOS" Version="3.11.0"/>
4950
</ItemGroup>
5051
</Project>
Loading

src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader.Skia.Gtk/Program.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System;
2-
2+
using System.Runtime.InteropServices;
33
using GLib;
44

55
using Uno.UI.Runtime.Skia.Gtk;
@@ -18,7 +18,10 @@ public static void Main(string[] args)
1818

1919
var host = new GtkHost(() => new AppHead());
2020

21+
// 防止虚拟机内闪烁
22+
host.RenderSurfaceType = RenderSurfaceType.Software;
23+
2124
host.Run();
2225
}
2326
}
24-
}
27+
}

src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader.Skia.Gtk/UnoFileDownloader.Skia.Gtk.csproj

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@
44
<OutputType Condition="'$(Configuration)'=='Debug'">Exe</OutputType>
55
<TargetFramework>net8.0</TargetFramework>
66
<ApplicationManifest>app.manifest</ApplicationManifest>
7+
8+
<!-- 打出来的 UOS 包的 AppId 和版本号 -->
9+
<!-- 其中 AppId 是应用的唯一标识。按照 UOS 的规范,请务必使用厂商的倒置域名+产品名作为应用包名,如 `com.example.demo` 格式,前半部分为厂商域名倒置,后半部分为产品名,只允许小写字母 -->
10+
<AppId>com.dotnetcampus.unofiledownloader</AppId>
11+
<UOSDebVersion>1.0.1</UOSDebVersion>
12+
<!-- 应用名,英文名 -->
13+
<AppName>UnoFileDownloader</AppName>
14+
<!-- 应用名,中文名,可不写。将在开始菜单中显示 -->
15+
<AppNameZhCN>下载器</AppNameZhCN>
16+
<Png32x32IconFile>Download32x32Icon.png</Png32x32IconFile>
17+
<DesktopComment>The file downloader.</DesktopComment>
18+
<DesktopCommentZhCN>文件下载器,代码完全开源</DesktopCommentZhCN>
19+
<DebControlDescription>The UNO file downloader.</DebControlDescription>
20+
<DebControlHomepage>https://github.com/dotnet-campus/dotnetCampus.FileDownloader</DebControlHomepage>
21+
<DebControlMaintainer>dotnet-campus</DebControlMaintainer>
722
</PropertyGroup>
823
<ItemGroup>
924
<EmbeddedResource Include="Package.appxmanifest" />
@@ -31,6 +46,9 @@
3146
<PackageReference Include="SkiaSharp.Skottie" />
3247
<PackageReference Include="Uno.WinUI.DevServer" Condition="'$(Configuration)'=='Debug'" />
3348
<PackageReference Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" />
49+
50+
<!-- 打包用的 -->
51+
<PackageReference Include="Packaging.DebUOS" />
3452
</ItemGroup>
3553
<ItemGroup>
3654
<ProjectReference Include="..\UnoFileDownloader\UnoFileDownloader.csproj" />

src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader/App.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,15 @@ protected async override void OnLaunched(LaunchActivatedEventArgs args)
6666
.AddContentSerializer(context)
6767
//.AddJsonTypeInfo(WeatherForecastContext.Default.IImmutableListWeatherForecast)
6868
)
69-
.UseHttp((context, services) => services
70-
// Register HttpClient
69+
.UseHttp((context, services) =>
70+
{
71+
// Register HttpClient
7172
#if DEBUG
72-
// DelegatingHandler will be automatically injected into Refit Client
73-
.AddTransient<DelegatingHandler, DebugHttpHandler>()
73+
// DelegatingHandler will be automatically injected into Refit Client
74+
services.AddTransient<DelegatingHandler, DebugHttpHandler>();
7475
#endif
75-
)
76+
}
77+
)
7678
.ConfigureServices((context, services) =>
7779
{
7880
// TODO: Register your services

src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader/Presentation/MainPage.xaml.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Diagnostics;
2+
using Uno.Logging;
23

34
namespace UnoFileDownloader.Presentation
45
{
@@ -24,6 +25,7 @@ private void MainPage_DataContextChanged(FrameworkElement sender, DataContextCha
2425
{
2526
#if DEBUG
2627
// 谁,是谁,乱改 DataContext 的类型!
28+
// 在 WinUI 项目里面可能进入多次,这是符合预期的,只需要最后一次的 DataContext 是正确的就行了
2729
Debugger.Break();
2830
#endif
2931
}
@@ -40,6 +42,7 @@ private void DownloadFileInfoViewList_CollectionChanged(object? sender, System.C
4042
private void UpdateTaskListNoItemsTextBlock()
4143
{
4244
TaskListNoItemsTextBlock.Visibility =
45+
// 如果下载列表为空,就显示“没有任务”文本块
4346
ViewModel.DownloadFileInfoViewList.Count == 0 ? Visibility.Visible : Visibility.Collapsed;
4447
}
4548

@@ -65,6 +68,7 @@ private void DownloadItemOpenFileButton_OnClick(object sender, RoutedEventArgs e
6568
catch (Exception exception)
6669
{
6770
// 忽略吧,可能是需要管理员权限,但是用户取消了
71+
this.Log().LogWarning(exception, "打开文件失败");
6872
}
6973
}
7074

0 commit comments

Comments
 (0)