Skip to content

Commit

Permalink
Merge pull request #59 from dotnet-campus/t/lindexi/Uno
Browse files Browse the repository at this point in the history
准备给下载器打包一个 UOS 系统可用版本
  • Loading branch information
kkwpsv authored Jan 29, 2024
2 parents 01afef2 + a834677 commit 1da8977
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project ToolsVersion="15.0">
<Project ToolsVersion="15.0">
<ItemGroup>
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="8.0.0-rc.2.23479.6" />
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
Expand Down Expand Up @@ -46,5 +46,6 @@
<PackageVersion Include="Xamarin.Google.Android.Material" Version="1.10.0.1" />
<PackageVersion Include="Uno.UITest.Helpers" Version="1.1.0-dev.70" />
<PackageVersion Include="Xamarin.UITest" Version="4.3.0" />
<PackageVersion Include="Packaging.DebUOS" Version="3.11.0"/>
</ItemGroup>
</Project>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System;

using System.Runtime.InteropServices;
using GLib;

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

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

// 防止虚拟机内闪烁
host.RenderSurfaceType = RenderSurfaceType.Software;

host.Run();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@
<OutputType Condition="'$(Configuration)'=='Debug'">Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ApplicationManifest>app.manifest</ApplicationManifest>

<!-- 打出来的 UOS 包的 AppId 和版本号 -->
<!-- 其中 AppId 是应用的唯一标识。按照 UOS 的规范,请务必使用厂商的倒置域名+产品名作为应用包名,如 `com.example.demo` 格式,前半部分为厂商域名倒置,后半部分为产品名,只允许小写字母 -->
<AppId>com.dotnetcampus.unofiledownloader</AppId>
<UOSDebVersion>1.0.1</UOSDebVersion>
<!-- 应用名,英文名 -->
<AppName>UnoFileDownloader</AppName>
<!-- 应用名,中文名,可不写。将在开始菜单中显示 -->
<AppNameZhCN>下载器</AppNameZhCN>
<Png32x32IconFile>Download32x32Icon.png</Png32x32IconFile>
<DesktopComment>The file downloader.</DesktopComment>
<DesktopCommentZhCN>文件下载器,代码完全开源</DesktopCommentZhCN>
<DebControlDescription>The UNO file downloader.</DebControlDescription>
<DebControlHomepage>https://github.com/dotnet-campus/dotnetCampus.FileDownloader</DebControlHomepage>
<DebControlMaintainer>dotnet-campus</DebControlMaintainer>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Package.appxmanifest" />
Expand Down Expand Up @@ -31,6 +46,9 @@
<PackageReference Include="SkiaSharp.Skottie" />
<PackageReference Include="Uno.WinUI.DevServer" Condition="'$(Configuration)'=='Debug'" />
<PackageReference Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" />

<!-- 打包用的 -->
<PackageReference Include="Packaging.DebUOS" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\UnoFileDownloader\UnoFileDownloader.csproj" />
Expand Down
12 changes: 7 additions & 5 deletions src/UnoFileDownloader/UnoFileDownloader/UnoFileDownloader/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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, DebugHttpHandler>()
// DelegatingHandler will be automatically injected into Refit Client
services.AddTransient<DelegatingHandler, DebugHttpHandler>();
#endif
)
}
)
.ConfigureServices((context, services) =>
{
// TODO: Register your services
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Diagnostics;
using Uno.Logging;

namespace UnoFileDownloader.Presentation
{
Expand All @@ -24,6 +25,7 @@ private void MainPage_DataContextChanged(FrameworkElement sender, DataContextCha
{
#if DEBUG
// 谁,是谁,乱改 DataContext 的类型!
// 在 WinUI 项目里面可能进入多次,这是符合预期的,只需要最后一次的 DataContext 是正确的就行了
Debugger.Break();
#endif
}
Expand All @@ -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;
}

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

Expand Down

0 comments on commit 1da8977

Please sign in to comment.