Compare commits

..

78 Commits

Author SHA1 Message Date
RMBGAME 0e813d4d24 🐛 Misc 2024-08-29 23:22:28 +08:00
Aigio Liu 7b7ed945d4 🎨 LogConsoleService.ConsoleMaxCharCount 2024-08-29 22:14:42 +08:00
Aigio Liu 585a7f01d0 🎨 Log format 2024-08-29 20:33:10 +08:00
RMBGAME 803d17a5f8 🐛 Misc 2024-08-29 19:10:45 +08:00
Aigio Liu c6a2cd67b4 🐛 WebApplication Logging 2024-08-29 16:32:14 +08:00
RMBGAME e3ef74f08e 💄 ProxyLog UI 2024-08-29 15:56:36 +08:00
RMBGAME b43cc93215 Merge branch 'develop' into feature/ipc-console-log 2024-08-29 13:56:51 +08:00
RMBGAME 6a3c8f6187 🐛 多平台账号切换暂只支持 Windows 2024-08-29 00:59:36 +08:00
Aigio Liu 24bb4bd625 ⬆️ Common 2024-08-28 19:30:19 +08:00
RMBGAME c5edf0a8b5 ⬇️ Avalonia 11.1.3 2024-08-28 17:41:52 +08:00
Aigio Liu c0b6d9d8e2 🐛 build error 2024-08-28 16:31:44 +08:00
Aigio Liu eefd2fa705 🐛 WinAuth 2024-08-28 16:16:04 +08:00
Aigio Liu 1a4a5887f2 ⬆️ SDK 2024-08-28 16:07:50 +08:00
Aigio Liu 5a163ae124 🐛 fix build 2024-08-28 15:56:52 +08:00
Aigio Liu 0e9def7e6a ⬆️ Common 2024-08-28 03:11:55 +08:00
Aigio Liu 6a307d97ab 🐛 try fix build 2024-08-28 02:40:36 +08:00
Aigio Liu 252eaa74c2 🐛 PackageVersion 2024-08-28 02:05:38 +08:00
Aigio Liu 6149625373 🐛 ref 2024-08-28 01:54:58 +08:00
Aigio Liu c6f6dbd7ef 🎨 LogConsole 2024-08-28 01:50:09 +08:00
RMBGAME 4115216a41 ⬆️ Avalonia 11.2.0-beta1 2024-08-28 01:02:12 +08:00
RMBGAME a99e410196 🐛 Misc 2024-08-27 19:01:28 +08:00
RMBGAME 4154b68c79 🐛 修复 RiotGames 账号切换无法添加账号的问题
✨账号切换新增 GOG Discord平台
2024-08-27 18:38:24 +08:00
k1mlka fa20e3a945 💄 窗口无边框化页面调整 2024-08-27 17:55:07 +08:00
ff m a15a166b5c ↑ 更新子模块 2024-08-26 18:41:19 +08:00
ff m 0fcd736259 ↑ 更新子模块修复报错 2024-08-26 18:38:22 +08:00
ff m 925c735557 ↑ 更新子模块 2024-08-26 17:59:00 +08:00
RMBGAME 19651ddeb1 🐛 update afdian domain 2024-08-22 18:57:56 +08:00
RMBGAME 6ebbeb000f 🐛 账号切换 修正在某些情况下也应该尝试正常打开新账号登录窗口 2024-08-19 21:08:45 +08:00
RMBGAME e3cf3195a8 🐛 FixedWrapPanel adaptive width 2024-08-19 16:52:02 +08:00
Aigio Liu 1734a03d41 IPCSubProcessFileSystem.GetLogDirPath 2024-08-19 16:03:08 +08:00
RMBGAME 7c47f01a77 🚧 GameAccelerator 2024-08-17 05:00:30 +08:00
RMBGAME dd622fb5e9 🚧 GameAccelerator 2024-08-16 20:50:06 +08:00
Aigio Liu 59636940c5 ➕ xunyou_show 2024-08-16 18:24:25 +08:00
Aigio Liu c7922c915b 🚧 XYShow 2024-08-16 17:51:59 +08:00
Aigio Liu 7d3a74daf2 🎨 Safe P/Invoke 2024-08-16 14:28:46 +08:00
k1mlka dccce87293 💄 无边框窗口页面UI改进 2024-08-09 15:29:31 +08:00
Aigio Liu 442ad2dac7 Revert "🔥 Remove ProxyMode.DNSIntercept"
This reverts commit 3eae8a8c84.
2024-08-08 17:03:03 +08:00
RMBGAME ae9a6350a7 🐛 修复 TaskDialog 在主窗口为null时不在抛出异常
修复加速脚本url匹配问题
2024-08-08 02:38:23 +08:00
Aigio Liu d49e38f314 🐛 ISettings 0kb 2024-08-08 01:14:06 +08:00
lxy829 5244009b02 🎨 cs:go vac 修复功能调整 2024-08-06 17:25:36 +08:00
Aigio Liu eef7478585 🐛 CheckUpdateAsync 2024-08-06 14:19:01 +08:00
Aigio Liu 3eae8a8c84 🔥 Remove ProxyMode.DNSIntercept 2024-08-06 12:24:13 +08:00
Aigio Liu c8509e94cf 🔖 3.0.909 rc.9 ms-store Attempt to fix the audit 2024-08-06 11:48:38 +08:00
RMBGAME 7140fc79c9 🐛 修复最新 SteamBeta 版在某些情况下管理成就无限加载问题 2024-08-06 11:44:58 +08:00
Mossimo 7d25393d6e ✨ 程序版本差异 二进制修补 发布工具 打包 上传 发布差异包 ( br 压缩 ) 修补测试 2024-08-05 18:37:49 +08:00
RMBGAME 149c5bbfd3 fix #3412 #2695 #3115
修复某些情况下加速后会将非加速网站自动跳转至加速页的BUG
修复在开启失效代理设置的情况下 加速进程依然错误的使用失效代理解析doh导致加速失败的问题
2024-08-02 00:49:36 +08:00
RMBGAME 38485f1e24 Revert "🐛 DomainMatch"
This reverts commit 008ab5fd4f.
2024-08-01 15:00:47 +08:00
Aigio Liu 008ab5fd4f 🐛 DomainMatch 2024-07-31 02:58:35 +08:00
john.jiang 178c074eb6 🎨 ASF 增加一键下载功能 2024-07-30 19:17:52 +08:00
yingpanwang c3279e78c2 ✨ 添加网络测试服务 NetworkTestService (#3401)
* ✨ 添加网络测试服务 NetworkTestService

* 🚧 清理日志

* ✨ 添加dns 测试

* ⚡️ 添加 DNS Over Https 测试方式, 调整 DNS解析格式
2024-07-18 11:25:28 +08:00
lxy829 7c8f8448af 🎨 cs:go vac repair 2024-07-18 10:18:48 +08:00
RMBGAME 66fdfb728e ⬆️ Avalonia 11.1.0-rc2 2024-07-17 06:01:11 +08:00
RMBGAME 9261344a3c 🐛 修复高dpi下窗口大小及位置变化问题 2024-07-17 05:47:00 +08:00
RMBGAME 95190efa5c 🐛 doh默认地址调整
加速项目默认选中问题修复
2024-07-12 19:36:04 +08:00
ff m dd71972adc ✨ macOS 支持从 dock 栏 打开窗口显示 2024-07-11 15:43:34 +08:00
wangyingpan 6c1e6d40e9 🎨 优化令牌重置 client 代码 2024-07-02 18:07:34 +08:00
wangyingpan 187c7f3b58 🐛 刷新 access_token 时重置对应 client 状态 2024-07-02 17:16:34 +08:00
john.jiang 4e3c86d009 🎨 挂卡剩最后一个游戏不自动切换 2024-07-02 13:40:10 +08:00
RMBGAME ed5cc929d3 📃 Text 2024-07-02 09:51:11 +08:00
Aigio Liu 213b2c2644 🔖 3.0.0 rc.9 2024-07-01 16:45:04 +08:00
RMBGAME e1adf07789 🐛 加速数据树结构某些情况下选中状态也异常问题修复 2024-07-01 16:38:08 +08:00
john.jiang 83f0634863 🎨 挂卡自动刷新token,bug修复 2024-07-01 16:16:18 +08:00
yingpanwang f08122769f 🐛 本地令牌 "确认交易" 时,当access_token 过期时使用refresh_token 刷新当前 access_token 以保持会话 (#3381)
* 🐛 本地令牌 "确认交易" 时,当access_token 过期时使用refresh_token 刷新当前 access_token 以保持会话

* 🎨 调整代码排版
2024-07-01 16:15:51 +08:00
RMBGAME 49fdeadfd2 🐛 HttpVersion 因按原本逻辑转发 2024-07-01 15:08:46 +08:00
RMBGAME bca80245bb 🐛 Misc 2024-06-30 19:00:17 +08:00
RMBGAME 0f6c127ad3 🐛 Misc 2024-06-30 16:00:46 +08:00
Aigio L c087a02303 Update CI.yml 2024-06-29 17:01:31 +08:00
Aigio Liu 6c84a876ff 🐛 ClrearLastLookNoticeDateTime 2024-06-29 16:52:52 +08:00
ff m df27068329 🐛 防止 添加 cookie 报错 2024-06-29 16:41:52 +08:00
ff m f10df31edd 🐛 更新子模块 适配转发请求头 2024-06-29 16:30:35 +08:00
RMBGAME 902919cf98 💄 Misc 2024-06-29 15:55:11 +08:00
RMBGAME a6aec5ad62 🐛 fixed Misc 2024-06-29 15:20:02 +08:00
RMBGAME 2fd651fd25 🐛 窗口偏移位置调整 2024-06-29 13:52:03 +08:00
RMBGAME 67615028e1 ✨🐛 新增 网络加速 二级代理支持
修复 Request Header 中存在非 ASCII 字符导致代理异常的状况
close #2753 #2523 #1661 #488
fix #1825
2024-06-29 00:43:17 +08:00
RMBGAME 1eca159e23 💄 Misc 2024-06-28 16:32:31 +08:00
RMBGAME d1d9ca82df 🐛 fix #3360
修复重启程序窗口增高问题
修复挂卡登录状态丢失挂卡依然继续问题
2024-06-28 16:02:06 +08:00
RMBGAME 88bd2dbfe9 🚑 库存游戏新 appinfo 解析 2024-06-28 13:57:44 +08:00
Mossimo ae2b2970db 🐛 修复 Linux 非 Host 模式不检测 443 占用 2024-06-27 16:32:47 +08:00
429 changed files with 8144 additions and 3832 deletions
+5 -5
View File
@@ -68,19 +68,19 @@ jobs:
run: dotnet --info
- name: Build BD.WTTS.Client.AppHost
run: dotnet build -c Release src\BD.WTTS.Client.AppHost\BD.WTTS.Client.AppHost.csproj --nologo -v q --property:WarningLevel=1;DebugType=pdbonly
run: dotnet build -c Release src\BD.WTTS.Client.AppHost\BD.WTTS.Client.AppHost.csproj --nologo -v q --property:WarningLevel=1 --property:DebugType=pdbonly
- name: Build BD.WTTS.Client.Plugins.Accelerator.ReverseProxy
run: dotnet build -c Release src\BD.WTTS.Client.Plugins.Accelerator.ReverseProxy\BD.WTTS.Client.Plugins.Accelerator.ReverseProxy.csproj --nologo -v q --property:WarningLevel=1;DebugType=pdbonly
run: dotnet build -c Release src\BD.WTTS.Client.Plugins.Accelerator.ReverseProxy\BD.WTTS.Client.Plugins.Accelerator.ReverseProxy.csproj --nologo -v q --property:WarningLevel=1 --property:DebugType=pdbonly
- name: Build BD.WTTS.Client.Avalonia.App
run: dotnet build -c Release src\BD.WTTS.Client.Avalonia.App\BD.WTTS.Client.Avalonia.App.csproj --nologo -v q --property:WarningLevel=1;DebugType=pdbonly
run: dotnet build -c Release src\BD.WTTS.Client.Avalonia.App\BD.WTTS.Client.Avalonia.App.csproj --nologo -v q --property:WarningLevel=1 --property:DebugType=pdbonly
- name: Build BD.WTTS.Client.Avalonia.Designer.HostApp
run: dotnet build -c Release src\BD.WTTS.Client.Avalonia.Designer.HostApp\BD.WTTS.Client.Avalonia.Designer.HostApp.csproj --nologo -v q --property:WarningLevel=1;DebugType=pdbonly
run: dotnet build -c Release src\BD.WTTS.Client.Avalonia.Designer.HostApp\BD.WTTS.Client.Avalonia.Designer.HostApp.csproj --nologo -v q --property:WarningLevel=1 --property:DebugType=pdbonly
- name: Test
run: dotnet test src/BD.WTTS.UnitTest/BD.WTTS.UnitTest.csproj -c Release -p:GeneratePackageOnBuild=false --nologo -v q --property:WarningLevel=1;DebugType=pdbonly
run: dotnet test src/BD.WTTS.UnitTest/BD.WTTS.UnitTest.csproj -c Release -p:GeneratePackageOnBuild=false --nologo -v q --property:WarningLevel=1 --property:DebugType=pdbonly
# release:
# name: Release
+1 -1
View File
@@ -16,7 +16,7 @@
[![NET 7.0](https://img.shields.io/badge/dotnet-7.0-purple.svg?style=flat-square&color=512bd4)](https://learn.microsoft.com/zh-cn/dotnet/core/whats-new/dotnet-7)
[![C# 11](https://img.shields.io/badge/c%23-11-brightgreen.svg?style=flat-square&color=6da86a)](https://learn.microsoft.com/zh-cn/dotnet/csharp/whats-new/csharp-11)
[![爱发电](https://img.shields.io/badge/爱发电-软妹币玩家-blue.svg?style=flat-square&color=ea4aaa&logo=github-sponsors)](https://afdian.net/@rmbgame)
[![爱发电](https://img.shields.io/badge/爱发电-软妹币玩家-blue.svg?style=flat-square&color=ea4aaa&logo=github-sponsors)](https://afdian.com/@rmbgame)
[![Kofi](https://img.shields.io/badge/Kofi-RMBGAME-orange.svg?style=flat-square&logo=kofi)](https://ko-fi.com/rmbgame)
[![Patreon](https://img.shields.io/badge/Patreon-RMBGAME-red.svg?style=flat-square&logo=patreon)](https://www.patreon.com/rmbgame)
+9
View File
@@ -988,6 +988,15 @@
"Summary": "加速页面 Tab 选项卡选中下标",
"IsRegionOrEndregion": null,
"IsValueType": null
},
{
"TypeName": "bool",
"PropertyName": "AutoShowWattAcceleratorWindow",
"DefaultValue": "true",
"DefaultValueIsConst": true,
"Summary": "加速后自动唤起 Watt 加速器界面",
"IsRegionOrEndregion": null,
"IsValueType": null
}
],
"Usings": ""
+5
View File
@@ -0,0 +1,5 @@
<Project>
<PropertyGroup>
<CheckEolWorkloads>false</CheckEolWorkloads>
</PropertyGroup>
</Project>
BIN
View File
Binary file not shown.
+11
View File
@@ -0,0 +1,11 @@
static void WinDivert()
{
var dllWinDivert = Path.Combine(ProjectUtils.ProjPath, "ref", "WinDivert.dll");
var sysWinDivert64 = Path.Combine(ProjectUtils.ProjPath, "ref", "WinDivert64.sys");
byte[][] data = [File.ReadAllBytes(dllWinDivert), File.ReadAllBytes(sysWinDivert64)];
var bytes = MemoryPackSerializer.Serialize(data);
bytes.AsSpan().Reverse();
File.WriteAllBytes(Path.Combine(ProjectUtils.ProjPath, "ref", "WinDivert.mpo"), bytes);
}
+3 -27
View File
@@ -3,14 +3,6 @@ namespace BD.WTTS;
/// <summary>
/// 提供用来获取应用程序信息(如版本号、说明、加载的程序集等)的属性。
/// </summary>
[Mobius3(
"""
Mobius.AssemblyInfo
AssemblyInfo.cs
AssemblyInfo.Version.cs
AssemblyInfo.Version.NativeHost.cs
AssemblyInfo.Version.Setup.Windows.cs
""")]
public static partial class AssemblyInfo
{
const string Version2 = "3.0";
@@ -24,14 +16,14 @@ public static partial class AssemblyInfo
/// <summary>
/// 预览版本号,范围 1~9,只增不减
/// </summary>
const string ver_for_preview = "8";
const string ver_for_preview = "9";
/// <summary>
/// RC 版本号,范围 0~9,只增不减
/// </summary>
const string ver_for_rc = "8";
const string ver_for_rc = "9";
public const string FileVersion = $"{Version2}.{ver_for_rc}0{ver_for_preview}.0";
public const string FileVersion = $"{Version2}.{ver_for_rc}1{ver_for_preview}.0";
//public const string InformationalVersion = Version;
//public const string InformationalVersion = $"{Version}-preview.{ver_for_preview}";
@@ -154,20 +146,4 @@ false
#endif
}
[AttributeUsage(AttributeTargets.All, Inherited = false)]
sealed class Mobius3Attribute : Attribute
{
public Mobius3Attribute()
{
}
public Mobius3Attribute(string str)
{
}
public bool Obsolete { get; set; }
}
-1
View File
@@ -1,4 +1,3 @@
// Mobius Properties\XmlnsDefinition.cs
#if (WINDOWS || MACCATALYST || MACOS || LINUX) && !(IOS || ANDROID)
// C# 10 定义全局 using
@@ -7,6 +7,7 @@
<DelaySign>false</DelaySign>
<AssemblyOriginatorKeyFile>$(MSBuildProjectDirectory)\..\..\avalonia.snk</AssemblyOriginatorKeyFile>
<!--https://github.com/AvaloniaUI/Avalonia/blob/0.10.10/build/SharedVersion.props#L18-->
<AvaloniaAccessUnstablePrivateApis>true</AvaloniaAccessUnstablePrivateApis>
</PropertyGroup>
<ItemGroup>
File diff suppressed because it is too large Load Diff
@@ -11,7 +11,7 @@
<Identity
Name="4651ED44255E.47979655102CE"
Publisher="CN=A90E406B-B2D3-4A23-B061-0FA1D65C4F66"
Version="3.0.999.0" />
Version="3.0.207.0" />
<Properties>
<DisplayName>Watt Toolkit</DisplayName>
@@ -66,6 +66,15 @@
</Application>
</Applications>
<Extensions>
<desktop2:Extension Category="windows.firewallRules">
<desktop2:FirewallRules Executable="Steam++\modules\Accelerator\Steam++.Accelerator.exe">
<desktop2:Rule Direction="in" IPProtocol="TCP" Profile="all"/>
<desktop2:Rule Direction="in" IPProtocol="UDP" Profile="all"/>
</desktop2:FirewallRules>
</desktop2:Extension>
</Extensions>
<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="runFullTrust" />
@@ -91,9 +91,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BD.Common.XmlnsDefinition.Avalonia">
<Aliases>BD_Common_XmlnsDefinition_Avalonia</Aliases>
</PackageReference>
<ProjectReference Include="..\BD.WTTS.Client.Avalonia\BD.WTTS.Client.Avalonia.csproj" />
<ProjectReference Include="..\BD.WTTS.Client\BD.WTTS.Client.csproj" />
</ItemGroup>
@@ -68,9 +68,6 @@
<ItemGroup>
<PackageReference Include="Moq" />
<PackageReference Include="BD.Common.XmlnsDefinition.Avalonia">
<Aliases>BD_Common_XmlnsDefinition_Avalonia</Aliases>
</PackageReference>
<ProjectReference Include="..\BD.WTTS.Client.Avalonia\BD.WTTS.Client.Avalonia.csproj" />
<ProjectReference Include="..\BD.WTTS.Client.Plugins.Accelerator\BD.WTTS.Client.Plugins.Accelerator.csproj" />
<ProjectReference Include="..\BD.WTTS.Client.Plugins.ArchiSteamFarmPlus\BD.WTTS.Client.Plugins.ArchiSteamFarmPlus.csproj" />
@@ -4,6 +4,7 @@
<RootNamespace>BD.WTTS</RootNamespace>
<DefineConstants>AVALONIA;$(DefineConstants)</DefineConstants>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
<AvaloniaAccessUnstablePrivateApis>true</AvaloniaAccessUnstablePrivateApis>
</PropertyGroup>
<ItemGroup>
@@ -72,9 +73,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BD.Common.XmlnsDefinition.Avalonia">
<Aliases>BD_Common_XmlnsDefinition_Avalonia</Aliases>
</PackageReference>
<PackageReference Include="BD.Common" />
<PackageReference Include="BD.Common.Primitives" />
<PackageReference Include="BD.Common.Essentials" />
@@ -1,9 +1,5 @@
namespace BD.WTTS.Converters;
[Mobius(
"""
Mobius.UI.Converters.WaveProgressGradientOffsetConverter
""")]
public sealed class BitmapAssetValueConverter : ImageValueConverter
{
public override object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
@@ -1,9 +1,5 @@
namespace BD.WTTS.Converters;
[Mobius(
"""
Mobius.UI.Converters.ColorStringToBrushConverter
""")]
public sealed class ColorStringToBrushConverter : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
@@ -1,9 +1,5 @@
namespace BD.WTTS.Converters;
[Mobius(
"""
Mobius.UI.Converters.EnumConverter
""")]
public sealed class EnumConverter : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
@@ -2,10 +2,6 @@ using IBinding = BD.WTTS.Converters.Abstractions.IBinding;
namespace BD.WTTS.Converters;
[Mobius(
"""
Mobius.UI.Converters.EnumEqualValueConverter
""")]
public sealed class EnumEqualValueConverter : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
@@ -1,9 +1,5 @@
namespace BD.WTTS.Converters;
[Mobius(
"""
Mobius.UI.Converters.EnumLocalizationNameConverter
""")]
public sealed class EnumLocalizationNameConverter : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
@@ -2,10 +2,6 @@ using SkiaSharp;
namespace BD.WTTS.Converters;
[Mobius(
"""
Mobius.UI.Converters.Abstractions.ImageValueConverter
""")]
public abstract class ImageValueConverter : IValueConverter
{
public abstract object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture);
@@ -50,7 +46,6 @@ public abstract class ImageValueConverter : IValueConverter
/// <param name="clipStream"></param>
/// <param name="bitmap"></param>
/// <returns></returns>
[Mobius("", Obsolete = true)]
static bool TryGetBitmap([NotNullWhen(true)] ImageSource.ClipStream? clipStream, [NotNullWhen(true)] out SKBitmap? bitmap)
{
if (clipStream?.Stream == null)
@@ -1,9 +1,5 @@
namespace BD.WTTS.Converters;
[Mobius(
"""
Mobius.UI.Converters.IsNullConverter
""")]
public sealed class IsNullConverter : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
@@ -1,9 +1,5 @@
namespace BD.WTTS.Converters;
[Mobius(
"""
Mobius.UI.Converters.NameToFontFamilyConverter
""")]
public sealed class NameToFontFamilyConverter : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
@@ -1,9 +1,5 @@
namespace BD.WTTS.Converters;
[Mobius(
"""
Mobius.UI.Converters.RangeToSweepConverter
""")]
public sealed class RangeToSweepConverter : IMultiValueConverter
{
public object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
@@ -1,9 +1,5 @@
namespace BD.WTTS.Converters;
[Mobius(
"""
Mobius.UI.Converters.ResourceKeyValueConverter
""")]
public sealed class ResourceKeyValueConverter : IValueConverter
{
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
@@ -1,9 +1,5 @@
namespace BD.WTTS.Converters;
[Mobius(
"""
Mobius.UI.Converters.StringEqualsConverter
""")]
public class StringEqualsConverter : IValueConverter
{
static string ToString(object? obj) => obj?.ToString() ?? string.Empty;
@@ -2,10 +2,6 @@ using SteamKit2;
namespace BD.WTTS.Converters;
[Mobius(
"""
Mobius.UI.Converters.StringFormatConverter
""")]
public sealed class StringFormatConverter : IValueConverter, IMultiValueConverter
{
const string Size = "size";
@@ -1,9 +1,5 @@
namespace BD.WTTS.Converters;
[Mobius(
"""
Mobius.UI.Converters.VisibleStringConverter
""")]
public sealed class VisibleStringConverter : IMultiValueConverter
{
public object? Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
@@ -1,9 +1,5 @@
namespace BD.WTTS.Converters;
[Mobius(
"""
Mobius.UI.Converters.WaveProgressValueConverter
""")]
public sealed class WaveProgressValueConverter : IValueConverter
{
public static readonly WaveProgressValueConverter Instance = new();
@@ -22,10 +18,6 @@ public sealed class WaveProgressValueConverter : IValueConverter
}
}
[Mobius(
"""
Mobius.UI.Converters.WaveProgressValueColorConverter
""")]
public class WaveProgressValueColorConverter : IValueConverter
{
public static readonly WaveProgressValueColorConverter Instance = new();
@@ -45,10 +37,6 @@ public class WaveProgressValueColorConverter : IValueConverter
}
}
[Mobius(
"""
Mobius.UI.Converters.WaveProgressValueTextConverter
""")]
public class WaveProgressValueTextConverter : IValueConverter
{
public static readonly WaveProgressValueTextConverter Instance = new();
@@ -66,10 +54,6 @@ public class WaveProgressValueTextConverter : IValueConverter
}
}
[Mobius(
"""
Mobius.UI.Converters.WaveProgressGradientOffsetConverter
""")]
public class WaveProgressGradientOffsetConverter : IValueConverter
{
public static readonly WaveProgressGradientOffsetConverter Instance = new();
@@ -2,10 +2,6 @@ namespace BD.WTTS.UI;
public static class ControlExtensions
{
[Mobius(
"""
Mobius.UI.ControlExtensions.SetViewModel
""")]
public static void SetViewModel<T>(this Control c, bool useCache = false) where T : ViewModelBase, new()
{
if (c.DataContext == null || c.DataContext.GetType() != typeof(T))
@@ -3,10 +3,6 @@ namespace BD.WTTS;
/// <summary>
/// <see cref="IEnumerable"/> extensions methods
/// </summary>
[Mobius(
"""
Mobius.IEnumerableExtensions
""")]
public static class IEnumerableExtensions
{
public static IEnumerable<IEnumerable> Batch(this IEnumerable source, int size)
@@ -1,10 +1,6 @@
// ReSharper disable once CheckNamespace
namespace Avalonia.Controls;
[BD.Mobius(
"""
Mobius.UI.WindowExtensions
""")]
public static partial class WindowExtensions
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -3,10 +3,6 @@ namespace BD.WTTS;
public static class WindowTransparencyLevelExtensions
{
[Mobius(
"""
Mobius.Enums.UI.WindowTransparencyLevelExtensions
""")]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static WindowTransparencyLevel ToWindowTransparencyLevel(
this WindowBackgroundMaterial value)
@@ -17,6 +13,7 @@ Mobius.Enums.UI.WindowTransparencyLevelExtensions
WindowBackgroundMaterial.Blur => WindowTransparencyLevel.Blur,
WindowBackgroundMaterial.AcrylicBlur => WindowTransparencyLevel.AcrylicBlur,
WindowBackgroundMaterial.Mica => WindowTransparencyLevel.Mica,
WindowBackgroundMaterial.Transparent => WindowTransparencyLevel.Transparent,
_ => WindowTransparencyLevel.None,
};
}
@@ -2,10 +2,6 @@ using BD.WTTS.Markup.Abstractions;
namespace BD.WTTS.Markup;
[Mobius(
"""
Mobius.UI.Markup.OnPlatformExtension
""")]
public sealed class OnPlatformExtension : MarkupExtension<bool>
{
public OnPlatformExtension(string member) : base(member)
@@ -1,9 +1,5 @@
namespace BD.WTTS.Services.Implementation;
[Mobius(
"""
BD.Common8.Essentials.Services.Implementation.AvaloniaMainThreadPlatformServiceImpl
""")]
sealed class MainThreadPlatformServiceImpl : IMainThreadPlatformService
{
public bool PlatformIsMainThread
@@ -4,18 +4,10 @@ using System.Collections.Immutable;
namespace BD.WTTS.Services.Implementation;
/// <inheritdoc cref="IWindowManager"/>
[Mobius(
"""
Mobius.Services.WindowManagerService
""")]
public sealed class AvaloniaWindowManagerImpl : IWindowManagerImpl
{
Type? IWindowManagerImpl.WindowType => typeof(Window);
[Mobius(
"""
Mobius.Services.WindowManagerService.GetWindowTopLevel
""")]
public static TopLevel? GetWindowTopLevel()
{
if (App.Instance.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
@@ -103,7 +95,7 @@ Mobius.Services.WindowManagerService.GetWindowTopLevel
Func<bool>? cancelCloseAction = null,
bool disableScroll = false)
where TPageViewModel : ViewModelBase
{
{
var td = new TaskDialogEx
{
Title = title,
@@ -119,6 +111,12 @@ Mobius.Services.WindowManagerService.GetWindowTopLevel
XamlRoot = GetWindowTopLevel(),
};
if (td.XamlRoot == null)
{
Toast.LogAndShowT(new Exception("在 AppWindow 为 Null 时,无法弹出 Taskdialog."));
return false;
}
if (viewModel != null)
{
if (viewModel is IWindowViewModel window)
@@ -3,10 +3,6 @@ using static System.Net.Mime.MediaTypeNames;
namespace BD.WTTS.Services.Implementation;
[Mobius(
"""
BD.Common8.Essentials.Services.Implementation.AvaloniaClipboardPlatformServiceImpl
""")]
public sealed class AvaloniaClipboardPlatformService : IClipboardPlatformService
{
public bool PlatformHasText => !string.IsNullOrEmpty(PlatformGetTextAsync().GetAwaiter().GetResult());
@@ -5,10 +5,6 @@ using AvaNotificationType = Avalonia.Controls.Notifications.NotificationType;
namespace BD.WTTS.Services.Implementation;
[Mobius(
"""
Mobius.Services.ToastService
""")]
[TemplatePart("PART_Items", typeof(Panel))]
[PseudoClasses(":topleft", ":topright", ":bottomleft", ":bottomright")]
sealed class AvaloniaToastServiceImpl : IToastService
@@ -8,10 +8,6 @@ using WinUI = Windows.UI.StartScreen;
namespace BD.WTTS.Services.Implementation;
/// <inheritdoc cref="IJumpListService"/>
[Mobius(
"""
Mobius.Services.Platform.Windows.Abstractions.IJumpListService
""")]
internal sealed class JumpListServiceImpl : IJumpListService
{
#if WINDOWS
@@ -6,10 +6,6 @@ using System.Xml.Linq;
namespace BD.WTTS.Services.Implementation;
[Mobius(
"""
Mobius.Services.NavigationService
""")]
public sealed class NavigationService : INavigationService
{
public static NavigationService Instance { get; } = (NavigationService)Ioc.Get<INavigationService>();
@@ -18,14 +14,6 @@ public sealed class NavigationService : INavigationService
public Type? CurrnetPage => _frame?.CurrentSourcePageType;
[Mobius(
"""
isCreateInstance = true
Mobius.Services.NavigationService.GetViewModelToPageContent
isCreateInstance = false
Mobius.Services.NavigationService.GetViewModelToPageContentType
""")]
public object? GetViewModelToPageContent(object viewModel, bool isCreateInstance = true)
{
string name;
@@ -7,28 +7,12 @@ namespace BD.WTTS.UI;
partial class App
{
[Mobius(
"""
App.DefaultActualTheme
""")]
const AppTheme _DefaultActualTheme = AppTheme.FollowingSystem;
[Mobius(
"""
App.DefaultActualTheme
""")]
AppTheme IApplication.DefaultActualTheme => _DefaultActualTheme;
[Mobius(
"""
App.mTheme
""")]
AppTheme mTheme = _DefaultActualTheme;
[Mobius(
"""
App.Theme
""")]
public AppTheme Theme
{
get => mTheme;
@@ -66,10 +50,6 @@ App.Theme
}
}
[Mobius(
"""
App.SetThemeNotChangeValue
""")]
public void SetThemeNotChangeValue(AppTheme value)
{
var mode = value switch
@@ -91,10 +71,6 @@ App.SetThemeNotChangeValue
}
}
[Mobius(
"""
App.SetThemeAccent
""")]
public static void SetThemeAccent(string? colorHex)
{
if (colorHex == null)
+41 -29
View File
@@ -9,34 +9,14 @@ namespace BD.WTTS.UI;
partial class App
{
[Mobius(
"""
App.TrayMenus
""")]
public Dictionary<string, TrayMenuItem> TrayMenus { get; } = new Dictionary<string, TrayMenuItem>();
[Mobius(
"""
App.TrayIcons
""")]
public TrayIcons TrayIcons { get; init; } = new TrayIcons();
[Mobius(
"""
App.trayIconMenus
""")]
readonly Dictionary<string, ICommand> trayIconMenus = new();
[Mobius(
"""
App.TrayIconMenus
""")]
public IReadOnlyDictionary<string, ICommand> TrayIconMenus => trayIconMenus;
[Mobius(
"""
App.InitTrayIcon
""")]
void InitTrayIcon()
{
if (ApplicationLifetime is not
@@ -83,14 +63,50 @@ App.InitTrayIcon
#else
s.HasTrayIcon ? ShutdownMode.OnExplicitShutdown : ShutdownMode.OnMainWindowClose;
#endif
#if MACOS
if (Current!.TryGetFeature<IActivatableLifetime>() is { } activatableLifetime)
{
activatableLifetime.Activated += ActivatableLifetimeOnActivated;
// macOS 中 右键隐藏 会触发目前不需要使用
//activatableLifetime.Deactivated += ActivatableLifetimeOnDeactivated;
}
#endif
}
}
[Mobius(
"""
App.UpdateMenuItems
""")]
#if MACOS
/// <summary>
/// 从 macOS Dock 栏恢复窗口显示
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ActivatableLifetimeOnActivated(object? sender, ActivatedEventArgs e)
{
switch (e.Kind)
{
case ActivationKind.Background:
case ActivationKind.Reopen:
RestoreMainWindow();
break;
}
}
///// <summary>
///// macOS 中 右键隐藏 会触发目前不需要使用
///// </summary>
///// <param name="sender"></param>
///// <param name="e"></param>
//private void ActivatableLifetimeOnDeactivated(object? sender, ActivatedEventArgs e)
//{
// switch (e.Kind)
// {
// case ActivationKind.Background:
// Console.WriteLine($"ActivatableLifetimeOnDeactivated {e.Kind}");
// break;
// }
//}
#endif
public void UpdateMenuItems()
{
MainThread2.BeginInvokeOnMainThread(() =>
@@ -190,10 +206,6 @@ App.UpdateMenuItems
});
}
[Mobius(
"""
App.UpdateMenuItems
""")]
public void UpdateMenuItems(string menuKey, TrayMenuItem trayMenuItem)
{
if (TrayMenus != null)
@@ -7,10 +7,6 @@ using System.Drawing.Drawing2D;
namespace BD.WTTS.UI;
[Mobius(
"""
Mobius.UI.App
""")]
public sealed partial class App : Application
{
const string TAG = "AvaApp";
@@ -237,12 +233,6 @@ public sealed partial class App : Application
public ICommand OpenBrowserCommand { get; }
[Mobius(
"""
Mobius.UI.App.OpenBrowserCommandCore
1. 不提示 打开链接失败
2. 使用统一的 OpenAuthUrl
""")]
public async void OpenBrowserCommandCore(object? url)
{
try
@@ -276,11 +266,6 @@ Mobius.UI.App.OpenBrowserCommandCore
public ICommand CopyToClipboardCommand { get; }
[Mobius(
"""
Mobius.UI.App.OpenBrowserCommandCore
1. 不提示 复制内容失败
""")]
public async void CopyToClipboardCommandCore(object? text)
{
try
@@ -5,10 +5,6 @@ using Visual = Avalonia.Visual;
namespace BD.WTTS.UI;
[Mobius(
"""
Mobius.UI.Animations.Animations
""")]
public static class Animations
{
private static readonly Easing DefaultEasing = new LinearEasing();
@@ -3,10 +3,6 @@ using System.Windows.Input;
namespace BD.WTTS.UI;
[Mobius(
"""
Mobius.UI.Views.Controls.Stepper.DelegateInputCommand
""")]
internal class Command : ICommand
{
private readonly Action<object?> _onExecute;
@@ -3,10 +3,6 @@ using FluentAvalonia.UI.Media.Animation;
namespace BD.WTTS.UI;
[Mobius(
"""
Mobius.UI.Animations.FrameEffect
""")]
public static class FrameEffect
{
public static SlideNavigationTransitionEffect GetEffect(int oldIndex, int index)
@@ -6,10 +6,6 @@ using System.Collections.Specialized;
namespace BD.WTTS.UI;
[Mobius(
"""
Mobius.UI.Behaviors.ItemDragBehavior
""")]
public class ItemDragBehavior : Behavior<Control>
{
private bool _enableDrag;
@@ -9,6 +9,11 @@
<StackPanel Spacing="10">
<HyperlinkButton Content="更新日志" />
<Button Content="更新日志" Theme="{StaticResource HyperlinkButton}" />
<Button Classes="TransparentAccent" Content="更新日志" />
<Button
Classes="TransparentAccent"
Content="更新日志"
IsEnabled="False" />
<Button
Content="更新日志"
IsEnabled="False"
@@ -221,6 +226,15 @@
<Setter Property="Background" Value="Transparent" />
</Style>
<Style Selector="Button.TransparentAccent /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource HyperlinkButtonForeground}" />
</Style>
<Style Selector="Button.TransparentAccent:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource HyperlinkButtonForegroundPointerOver}" />
</Style>
<Style Selector="Button.TransparentAccent:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource HyperlinkButtonForegroundPressed}" />
</Style>
</Styles>
@@ -3,10 +3,6 @@ namespace BD.WTTS.UI.Styling;
/// <summary>
/// Includes the fluent theme in an application.
/// </summary>
[Mobius(
"""
Mobius.UI.Styling.CustomTheme
""")]
public class CustomTheme : Styles, IResourceProvider
{
public const string LightModeString = "Light";
@@ -86,4 +86,10 @@
<StreamGeometry x:Key="Phone">
M15.75 2C16.9926 2 18 3.00736 18 4.25V19.75C18 20.9926 16.9926 22 15.75 22H8.25C7.00736 22 6 20.9926 6 19.75V4.25C6 3.00736 7.00736 2 8.25 2H15.75ZM13.25 18H10.75C10.3358 18 10 18.3358 10 18.75C10 19.1642 10.3358 19.5 10.75 19.5H13.25C13.6642 19.5 14 19.1642 14 18.75C14 18.3358 13.6642 18 13.25 18Z
</StreamGeometry>
<StreamGeometry x:Key="GOGGalaxy">
M304.99296 650.144H185.98496a17.12 17.12 0 0 0-16.992 17.184v85.344c0 8.992 7.68 16.992 16.992 16.992h119.52v56.32H156.16096a43.84 43.84 0 0 1-43.488-44v-144.512c0-23.968 19.68-43.488 44-43.488h148.32z m43.168-157.824c0 24.832-20 44.832-44.832 44.832H112.19296v-57.696h161.312a16.896 16.896 0 0 0 17.024-16.992V272.64a17.024 17.024 0 0 0-17.024-17.184H187.36096a17.152 17.152 0 0 0-17.536 17.184v86.144c0 9.856 7.68 17.024 17.024 17.024H256.00096v57.632H157.02496a44.544 44.544 0 0 1-44.832-44.32V242.304c0-24.352 20.192-44.32 44.832-44.32H303.04096c24.672 0 44.64 19.968 44.64 44.32v249.984z m563.168 333.664h-56.32v-175.84h-39.68a17.12 17.12 0 0 0-16.992 17.184v158.624h-56.832v-175.84h-39.68a17.12 17.12 0 0 0-16.992 17.184v158.624h-56.832v-188.512c0-23.968 19.68-43.488 44-43.488h239.328z m0.512-333.664c0 24.832-20.192 44.832-44.832 44.832h-191.136v-57.696h161.312a16.96 16.96 0 0 0 17.024-16.992V272.64a17.12 17.12 0 0 0-17.024-17.184h-86.656a17.024 17.024 0 0 0-17.024 17.184v86.144c0 9.856 7.68 17.024 17.024 17.024h69.152v57.632h-98.688a44.352 44.352 0 0 1-44.64-44.32V242.304c0-24.352 19.968-44.32 44.64-44.32h146.336c24.832 0 44.832 19.968 44.832 44.32v249.984zM585.34496 198.016h-146.688c-24.832 0-44.512 19.968-44.512 44.32v146.816a44.16 44.16 0 0 0 44.512 44.32h146.688a44.48 44.48 0 0 0 44.512-44.32V242.336c0-24.352-20.192-44.32-44.512-44.32z m-12.672 74.656v86.144c0 9.504-7.68 17.024-17.152 17.024h-86.688a16.96 16.96 0 0 1-16.992-17.024V272.96c0-9.312 7.328-16.992 16.992-16.992h85.856c9.824 0 16.992 7.68 16.992 16.992z m-33.824 321.344h-144.672c-24.16 0-43.808 19.488-43.808 43.488v144.512c0 24.32 19.68 44 43.808 44h144.672c24.32 0 44-19.68 44-44v-144.512c0-23.968-19.68-43.488-44-43.488z m-12.864 73.344v85.344a16.96 16.96 0 0 1-16.992 16.992v-0.352h-84.864a17.12 17.12 0 0 1-17.152-17.152v-84.832a17.28 17.28 0 0 1 17.152-17.184h85.344c9.344 0 17.024 7.84 17.024 17.184z m476.16-620.352A74.24 74.24 0 0 0 949.31296 24.64H74.65696A74.304 74.304 0 0 0 0.00096 99.296v825.344a74.304 74.304 0 0 0 74.656 74.656h874.656a74.304 74.304 0 0 0 74.656-74.656V99.296c0-20.32-8.48-39.168-21.856-52.832z m0 877.664a52.416 52.416 0 0 1-52.832 52.832H74.65696a52.576 52.576 0 0 1-53.344-52.832V99.328a52.672 52.672 0 0 1 52.832-52.832H948.80096c29.344 0 52.992 23.68 52.992 52.832v825.344z
</StreamGeometry>
<StreamGeometry x:Key="Discord">
M1049.062 139.672a3 3 0 0 0-1.528-1.4A970.13 970.13 0 0 0 808.162 64.06a3.632 3.632 0 0 0-3.846 1.82 674.922 674.922 0 0 0-29.8 61.2 895.696 895.696 0 0 0-268.852 0 619.082 619.082 0 0 0-30.27-61.2 3.78 3.78 0 0 0-3.848-1.82 967.378 967.378 0 0 0-239.376 74.214 3.424 3.424 0 0 0-1.576 1.352C78.136 367.302 36.372 589.38 56.86 808.708a4.032 4.032 0 0 0 1.53 2.75 975.332 975.332 0 0 0 293.65 148.378 3.8 3.8 0 0 0 4.126-1.352A696.4 696.4 0 0 0 416.24 860.8a3.72 3.72 0 0 0-2.038-5.176 642.346 642.346 0 0 1-91.736-43.706 3.77 3.77 0 0 1-0.37-6.252 502.094 502.094 0 0 0 18.218-14.274 3.638 3.638 0 0 1 3.8-0.512c192.458 87.834 400.82 87.834 591 0a3.624 3.624 0 0 1 3.848 0.466 469.066 469.066 0 0 0 18.264 14.32 3.768 3.768 0 0 1-0.324 6.252 602.814 602.814 0 0 1-91.78 43.66 3.75 3.75 0 0 0-2 5.222 782.11 782.11 0 0 0 60.028 97.63 3.728 3.728 0 0 0 4.126 1.4A972.096 972.096 0 0 0 1221.4 811.458a3.764 3.764 0 0 0 1.53-2.704c24.528-253.566-41.064-473.824-173.868-669.082zM444.982 675.16c-57.944 0-105.688-53.174-105.688-118.478s46.818-118.482 105.688-118.482c59.33 0 106.612 53.64 105.686 118.478 0 65.308-46.82 118.482-105.686 118.482z m390.76 0c-57.942 0-105.686-53.174-105.686-118.478s46.818-118.482 105.686-118.482c59.334 0 106.614 53.64 105.688 118.478 0 65.308-46.354 118.482-105.688 118.482z
</StreamGeometry>
</ResourceDictionary>
@@ -5,10 +5,6 @@ using FluentAvalonia.UI.Navigation;
namespace BD.WTTS.UI.Views.Pages;
[Mobius(
"""
Mobius.UI.Views.Pages.Abstractions.PageBase
""")]
public class PageBase : UserControl
{
public PageBase() : base()
@@ -325,10 +321,6 @@ public class PageBase : UserControl
private CompositeDisposable _disposables;
}
[Mobius(
"""
Mobius.UI.Views.Pages.Abstractions.PageBase<TViewModel>
""")]
public class PageBase<TViewModel> : PageBase, IViewFor<TViewModel> where TViewModel : class
{
public static readonly StyledProperty<TViewModel?> ViewModelProperty = AvaloniaProperty.Register<PageBase<TViewModel>, TViewModel?>(nameof(ViewModel));
@@ -7,10 +7,6 @@ namespace BD.WTTS.UI.Views.Windows;
/// and vice versa.
/// </summary>
/// <typeparam name="TViewModel">ViewModel type.</typeparam>
[Mobius(
"""
Mobius.UI.Views.Windows.Abstractions.ReactiveAppWindow<TViewModel>
""")]
public class ReactiveAppWindow<TViewModel> : AppWindow, IViewFor<TViewModel>, IViewFor, IActivatableView where TViewModel : class
{
public static readonly StyledProperty<TViewModel?> ViewModelProperty = ReactiveWindow<TViewModel>.ViewModelProperty.AddOwner<ReactiveAppWindow<TViewModel>>();
@@ -18,6 +14,8 @@ public class ReactiveAppWindow<TViewModel> : AppWindow, IViewFor<TViewModel>, IV
public static readonly StyledProperty<bool> IsSaveWindowSizeProperty = AvaloniaProperty
.Register<ReactiveAppWindow<TViewModel>, bool>(nameof(IsSaveWindowSize), true);
private bool _isInitialize;
/// <summary>
/// Initializes a new instance of the <see cref="ReactiveAppWindow{TViewModel}"/> class.
/// </summary>
@@ -131,27 +129,32 @@ public class ReactiveAppWindow<TViewModel> : AppWindow, IViewFor<TViewModel>, IV
{
var primaryScreenBounds = screen.Bounds;
if (CanResize && !IsVisible)
if (CanResize && !_isInitialize && !IsVisible)
{
WindowStartupLocation = WindowStartupLocation.Manual;
var scalingOffset = 31 - ((screen.Scaling - 1) / 0.5); // appwindow偏移量
if (SizePosition.Width > 0 &&
primaryScreenBounds.Width >= SizePosition.Width)
Width = SizePosition.Width;
if (SizePosition.Height > 0 &&
primaryScreenBounds.Height >= SizePosition.Height)
Height = SizePosition.Height;
Height = SizePosition.Height - scalingOffset;
if (SizePosition.X > 0 && SizePosition.Y > 0)
{
var leftTopPoint = new PixelPoint(SizePosition.X, SizePosition.Y);
var offsetY = (int)Math.Round(scalingOffset * screen.Scaling);
//var offsetY = scalingOffset;
var leftTopPoint = new PixelPoint(SizePosition.X, SizePosition.Y + offsetY);
var rightBottomPoint = new PixelPoint(SizePosition.X + (int)Width, SizePosition.Y + (int)Height);
if (primaryScreenBounds.Contains(leftTopPoint) &&
primaryScreenBounds.Contains(rightBottomPoint))
{
Position = leftTopPoint;
WindowStartupLocation = WindowStartupLocation.Manual;
}
}
_isInitialize = true;
}
}
}
@@ -4,10 +4,6 @@ using FluentAvalonia.Core;
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public partial class AdControl : UserControl
{
/// <summary>
@@ -4,10 +4,6 @@ using System.Numerics;
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public class AppItem : TemplatedControl
{
public static readonly StyledProperty<string> TitleProperty =
@@ -4,10 +4,6 @@ using FluentAvalonia.Core;
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public class ContentLoader : ContentControl
{
/// <summary>
@@ -2,10 +2,6 @@ using Avalonia.Input;
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public sealed class CustomFilePicker : ContentControl
{
public static readonly StyledProperty<string?> FileNameProperty = AvaloniaProperty.Register<CustomFilePicker, string?>(nameof(FileName), null);
@@ -1,9 +1,5 @@
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public enum AlignContent
{
FlexStart,
@@ -1,9 +1,6 @@
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
[SuppressMessage("Naming", "CA1717:Only FlagsAttribute enums should have plural names")]
public enum AlignItems
{
FlexStart,
@@ -1,9 +1,5 @@
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public static class Flex
{
/// <summary>
@@ -1,9 +1,5 @@
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public readonly struct FlexBasis : IEquatable<FlexBasis>
{
public double Value { get; }
@@ -1,9 +1,5 @@
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public enum FlexBasisKind
{
Auto,
@@ -1,9 +1,5 @@
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public enum FlexDirection
{
Row,
@@ -1,9 +1,5 @@
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public sealed class FlexPanel : Panel
{
private static readonly Func<Layoutable, int> s_getOrder = x => x is { } y ? Flex.GetOrder(y) : 0;
@@ -1,9 +1,5 @@
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public enum FlexWrap
{
NoWrap,
@@ -1,9 +1,5 @@
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public enum JustifyContent
{
FlexStart,
@@ -1,9 +1,5 @@
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
internal readonly struct Uv(double u, double v)
{
public double U { get; } = u;
@@ -2,10 +2,6 @@ using Avalonia.Controls;
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public class OptionsDisplayItem : TemplatedControl
{
public static readonly StyledProperty<object?> HeaderProperty =
@@ -1,9 +1,5 @@
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public class PureCircle : Control
{
public static readonly StyledProperty<double> DiameterProperty = AvaloniaProperty.Register<PureCircle, double>(
@@ -3,10 +3,6 @@ namespace BD.WTTS.UI.Views.Controls;
/// <summary>
/// Provide the most simplified shape implementation. This is a rectangle with a background, without border and corner radius.
/// </summary>
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public class PureRectangle : Control
{
public static readonly StyledProperty<IBrush?> BackgroundProperty =
@@ -1,9 +1,5 @@
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public class PureRing : PureCircle
{
public static readonly StyledProperty<double> InnerDiameterProperty = AvaloniaProperty.Register<PureRing, double>(
@@ -6,10 +6,6 @@ namespace BD.WTTS.UI.Views.Controls;
/// <summary>
/// An <see cref="INotificationManager"/> that displays notifications in a <see cref="Window"/>.
/// </summary>
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
[TemplatePart("PART_Items", typeof(Panel))]
[PseudoClasses(":topleft", ":topright", ":bottomleft", ":bottomright")]
public class SnackbarManager : TemplatedControl, IManagedNotificationManager
@@ -197,4 +193,39 @@ public class SnackbarManager : TemplatedControl, IManagedNotificationManager
PseudoClasses.Set(":bottomleft", position == NotificationPosition.BottomLeft);
PseudoClasses.Set(":bottomright", position == NotificationPosition.BottomRight);
}
/// <inheritdoc/>
public void Close(INotification notification)
{
Dispatcher.UIThread.VerifyAccess();
//if (_items.Remove(notification, out var notificationCard))
//{
// notificationCard.Close();
//}
}
/// <inheritdoc/>
public void Close(object content)
{
Dispatcher.UIThread.VerifyAccess();
//if (_items.Remove(content, out var notificationCard))
//{
// notificationCard.Close();
//}
}
/// <inheritdoc/>
public void CloseAll()
{
Dispatcher.UIThread.VerifyAccess();
//foreach (var kvp in _items)
//{
// kvp.Close();
//}
_items?.Clear();
}
}
@@ -2,10 +2,6 @@ using Avalonia.Controls;
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public partial class SplashScreen : UserControl
{
public SplashScreen()
@@ -3,10 +3,6 @@ using BD.Common.Models.Abstractions;
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public partial class TitleBar : UserControl
{
public Image WindowIcon => BarIcon;
@@ -3,10 +3,6 @@ using FluentAvalonia.Core;
namespace BD.WTTS.UI.Views.Controls
{
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public partial class CarouselBanner : UserControl
{
/// <summary>
@@ -5,10 +5,6 @@ using System.Reactive;
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public class CarouselItems : ItemsControl
{
/// <summary>
@@ -5,10 +5,6 @@ namespace BD.WTTS.UI.Views.Controls;
/// <summary>
/// 固定的 WrapPanel
/// </summary>
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public class FixedWrapPanel : Panel, INavigableContainer
{
/// <summary>
@@ -89,44 +85,36 @@ public class FixedWrapPanel : Panel, INavigableContainer
/// <inheritdoc/>
protected override Size MeasureOverride(Size constraint)
{
var panelSize = default(MutableSize);
var lineSize = default(MutableSize);
int itemsInCurrentLine = 0;
double itemWidth = (constraint.Width - (Spacing * (ItemsPerLine - 1))) / ItemsPerLine;
MutableSize currentLineSize = default;
MutableSize panelSize = default;
Size lineConstraint = new(constraint.Width, constraint.Height);
Size childConstraint = new(itemWidth - Spacing, constraint.Height);
for (int i = 0, count = Children.Count; i < count; i++)
foreach (var child in Children.OfType<Control>())
{
Control child = Children[i];
if (child is null)
{
continue;
}
child.Measure(new Size(itemWidth, constraint.Height));
var childSize = child.DesiredSize;
child.Measure(childConstraint);
Size childSize = new(itemWidth, child.DesiredSize.Height);
if (MathUtilities.GreaterThan(currentLineSize.Width + childSize.Width + Spacing, lineConstraint.Width))
if (itemsInCurrentLine == ItemsPerLine)
{
// Need to switch to another line
panelSize.Width = Max(currentLineSize.Width, panelSize.Width);
panelSize.Height += currentLineSize.Height;
currentLineSize = new(childSize);
// Start a new line
panelSize.Width = Math.Max(panelSize.Width, lineSize.Width);
panelSize.Height += lineSize.Height + Spacing;
lineSize = new MutableSize(childSize.Width, childSize.Height);
itemsInCurrentLine = 1;
}
else
{
// Continue to accumulate a line
currentLineSize.Width += childSize.Width + Spacing;
currentLineSize.Height = Max(childSize.Height, currentLineSize.Height);
// Add to the current line
lineSize.Width += childSize.Width + (itemsInCurrentLine > 0 ? Spacing : 0);
lineSize.Height = Math.Max(lineSize.Height, childSize.Height);
itemsInCurrentLine++;
}
}
// The last line size, if any should be added
panelSize.Width = Max(currentLineSize.Width, panelSize.Width);
panelSize.Height = currentLineSize.Height;
if (double.IsInfinity(panelSize.Width))
panelSize.Width = 0;
// Add the last line size
panelSize.Width = Math.Max(panelSize.Width, lineSize.Width);
panelSize.Height += lineSize.Height;
return panelSize.ToSize();
}
@@ -134,41 +122,33 @@ public class FixedWrapPanel : Panel, INavigableContainer
/// <inheritdoc/>
protected override Size ArrangeOverride(Size finalSize)
{
double itemWidth = (finalSize.Width - (Spacing * (ItemsPerLine - 1))) / ItemsPerLine;
int firstInLine = 0;
double accumulatedHeight = 0;
var currentLineSize = default(MutableSize);
for (int i = 0; i < Children.Count; i++)
var itemWidth = (finalSize.Width - (Spacing * (ItemsPerLine - 1))) / ItemsPerLine;
var position = default(MutablePoint);
var lineHeight = 0.0;
int itemsInCurrentLine = 0;
try
{
Control child = Children[i];
if (child == null)
foreach (var child in Children.OfType<Control>())
{
continue;
}
if (itemsInCurrentLine == ItemsPerLine)
{
// Move to the next line
position.X = 0;
position.Y += lineHeight + Spacing;
lineHeight = 0;
itemsInCurrentLine = 0;
}
MutableSize itemSize = new(itemWidth, child.DesiredSize.Height);
if (MathUtilities.GreaterThan(currentLineSize.Width + itemSize.Width, finalSize.Width))
{
// Need to switch to another line
ArrangeLine(accumulatedHeight, currentLineSize.Height, firstInLine, i, itemWidth);
accumulatedHeight += currentLineSize.Height;
currentLineSize = itemSize;
firstInLine = i;
}
else
{
// Continue to accumulate a line
currentLineSize.Width += itemSize.Width;
currentLineSize.Height = Max(itemSize.Height, currentLineSize.Height);
var childSize = new Size(itemWidth, child.DesiredSize.Height);
child.Arrange(new Rect(position.ToPoint(), childSize));
position.X += itemWidth + Spacing;
lineHeight = Math.Max(lineHeight, childSize.Height);
itemsInCurrentLine++;
}
}
if (firstInLine < Children.Count)
{
// Arrange the last line, if any
ArrangeLine(accumulatedHeight, currentLineSize.Height, firstInLine, Children.Count, itemWidth);
}
catch
{ }
return finalSize;
}
@@ -184,19 +164,32 @@ public class FixedWrapPanel : Panel, INavigableContainer
continue;
}
if (i < end - 1)
try
{
child.Arrange(new Rect(x, y, width - Spacing, height));
x += width + Spacing;
}
else
{
child.Arrange(new Rect(x, y, width, height));
x += width;
if (i < end - 1 || i % ItemsPerLine == 0)
{
child.Arrange(new Rect(x, y, width - Spacing, height));
x += width + Spacing;
}
else
{
child.Arrange(new Rect(x, y, width, height));
x += width;
}
}
catch { }
}
}
record struct MutablePoint
{
internal double X;
internal double Y;
internal readonly Point ToPoint() => new Point(X, Y);
}
record struct MutableSize
{
internal MutableSize(double width, double height)
@@ -3,10 +3,6 @@ using Avalonia.Controls.Shapes;
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public class Ripple : Ellipse
{
private static Easing _easing = new CircularEaseOut();
@@ -2,10 +2,6 @@ using Avalonia.Controls.Shapes;
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public class RippleEffect : ContentControl
{
// ReSharper disable once InconsistentNaming
@@ -1,9 +1,5 @@
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public class Skeleton : ContentControl
{
public static readonly StyledProperty<bool> IsActiveProperty =
@@ -3,10 +3,6 @@ using Avalonia.Controls.Notifications;
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public class Snackbar : InfoBar
{
private bool _isClosing;
@@ -1,9 +1,5 @@
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
[TemplatePart("PART_ItemsPresenter", typeof(ItemsPresenter))]
[TemplatePart("PART_ProgressBar", typeof(ProgressBar))]
public class Stepper : SelectingItemsControl
@@ -4,10 +4,6 @@ using Avalonia.Controls.Mixins;
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
[PseudoClasses(":pressed", ":selected")]
public class StepperItem : ContentControl, ISelectable
{
@@ -1,9 +1,5 @@
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public sealed class TaskDialogEx : TaskDialog
{
private Button? _closeButton;
@@ -1,9 +1,5 @@
namespace BD.WTTS.UI.Views.Controls;
[Mobius(
"""
Mobius.UI.Views.Controls
""")]
public sealed partial class WaveProgress : UserControl
{
public static readonly DirectProperty<WaveProgress, double> ValueProperty =
@@ -3,10 +3,6 @@ using BD.WTTS.Services;
namespace BD.WTTS.UI.Views.Pages;
[Mobius(
"""
Mobius.UI.Views.Pages
""")]
public partial class AboutPage : ReactiveUserControl<AboutPageViewModel>
{
public AboutPage()
@@ -1,9 +1,5 @@
namespace BD.WTTS.UI.Views.Pages;
[Mobius(
"""
Mobius.UI.Views.Pages
""")]
public partial class MessageBoxPage : ReactiveUserControl<MessageBoxWindowViewModel>
{
public MessageBoxPage()
@@ -2,10 +2,6 @@ using Avalonia.Markup.Xaml.MarkupExtensions;
namespace BD.WTTS.UI.Views.Pages;
[Mobius(
"""
Mobius.UI.Views.Pages
""")]
public partial class TextInputDialogPage : ReactiveUserControl<TextBoxWindowViewModel>
{
public TextInputDialogPage()
@@ -135,11 +135,15 @@
<ItemsControl>
<ItemsControl.Items>
<Border Height="30" Background="Red" />
<Border Background="Blue" />
<Border Background="Yellow" />
<Border Height="30" Background="Blue" />
<Border Height="30" Background="Yellow" />
<Border Background="Red" />
<Border Background="Blue" />
<Border Height="30" Background="Yellow" />
<Border Height="30" Background="Red" />
<Border Height="30" Background="Blue" />
<Border Height="30" Background="Blue" />
<Border Height="30" Background="Blue" />
<Border Height="30" Background="Blue" />
<Border Height="30" Background="Red" />
</ItemsControl.Items>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
@@ -2,10 +2,6 @@ using Avalonia.Controls;
namespace BD.WTTS.UI.Views.Pages;
[Mobius(
"""
Mobius.UI.Views.Pages
""")]
public partial class DebugPage : PageBase<DebugPageViewModel>
{
public DebugPage()
@@ -2,10 +2,6 @@ using Avalonia.Controls;
namespace BD.WTTS.UI.Views.Pages;
[Mobius(
"""
Mobius.UI.Views.Pages
""")]
public partial class ErrorPage : UserControl
{
public ErrorPage()
@@ -74,13 +74,18 @@
MaxWidth="1080"
Spacing="20">
<spp:Snackbar
Title="{Binding Path=Res.Notice_Tray_Title, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
VerticalAlignment="Top"
IsClosable="False"
IsOpen="True"
IsVisible="{spp:OnPlatform !GA}"
Message="当前使用的程序版本为测试版本,可能会有各种各样不可言明的 Bug,遇到问题请理性反馈,谢谢。"
Severity="Warning" />
<spp:Snackbar
VerticalAlignment="Top"
IsClosable="False"
IsOpen="True"
IsVisible="{spp:OnPlatform !GA}"
Message="如果您不喜欢当前主页为默认启动页面可以在【设置-界面设置-启动时默认打开页面】处更改" />
<spp:Snackbar
Title="{Binding Path=Res.Notice_Tray_Title, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
VerticalAlignment="Top"
@@ -282,6 +287,7 @@
<!--<Border spp:Animations.EnableAnimations="True">-->
<spp:AppItem
Title="{Binding Name}"
MinHeight="250"
MaxWidth="260"
Classes="Vertical Scale"
ClickCommand="{Binding OpenBrowserCommand, Source={x:Static spp:App.Instance}}"
@@ -2,10 +2,6 @@ using BD.WTTS.Client.Resources;
namespace BD.WTTS.UI.Views.Pages;
[Mobius(
"""
Mobius.UI.Views.Pages
""")]
public partial class HomePage : ReactiveUserControl<HomePageViewModel>
{
public HomePage()
@@ -218,6 +218,7 @@
<TextBlock Text="{Binding Path=User.NickName, Mode=OneWay, Source={x:Static s:UserService.Current}}" />
<Border
Padding="5,1"
HorizontalAlignment="Left"
VerticalAlignment="Center"
CornerRadius="2"
IsVisible="{Binding Path=User.UserType, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource EnumEqualValueConverter}, ConverterParameter={x:Static enum:UserType.Sponsor}}">
@@ -6,10 +6,6 @@ using FluentAvalonia.UI.Navigation;
namespace BD.WTTS.UI.Views.Pages;
[Mobius(
"""
Mobius.UI.Views.Pages
""")]
public sealed partial class MainView : ReactiveUserControl<MainWindowViewModel>
{
public MainView()
@@ -3,10 +3,6 @@ using FluentAvalonia.UI.Navigation;
namespace BD.WTTS.UI.Views.Pages;
[Mobius(
"""
Mobius.UI.Views.Pages
""")]
public partial class PluginStorePage : UserControl
{
public PluginStorePage()

Some files were not shown because too many files have changed in this diff Show More