U:调整结构性目录
This commit is contained in:
1 parent
693b390df0
commit
c255419412
172 files changed
+839
-18898
No files matched your search
@@ -0,0 +1,7 @@
|
||||
<Application x:Class="UI.Shared.Wpf.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace UI.Shared.Wpf;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : System.Windows.Application
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System.Windows;
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
@@ -0,0 +1,38 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace UI.Shared.Wpf;
|
||||
|
||||
public static class GlobalExceptionHandler
|
||||
{
|
||||
public static void RegisterGlobalExceptionHandlers(System.Windows.Application app)
|
||||
{
|
||||
// UI线程异常处理
|
||||
app.DispatcherUnhandledException += (sender, e) =>
|
||||
{
|
||||
HandleException(e.Exception, "UI线程异常");
|
||||
e.Handled = true;
|
||||
};
|
||||
|
||||
// 非UI线程异常处理
|
||||
AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
|
||||
{
|
||||
if (e.ExceptionObject is Exception ex)
|
||||
HandleException(ex, "非UI线程异常");
|
||||
};
|
||||
|
||||
// 任务未观察到的异常处理
|
||||
TaskScheduler.UnobservedTaskException += (sender, e) =>
|
||||
{
|
||||
HandleException(e.Exception, "任务未观察异常");
|
||||
e.SetObserved();
|
||||
};
|
||||
}
|
||||
|
||||
private static void HandleException(Exception ex, string context)
|
||||
{
|
||||
// TODO: 替换为你自己的日志系统或上报服务
|
||||
string message = $"【{context}】{ex.Message}\n{ex.StackTrace}";
|
||||
MessageBox.Show(message, "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
// 例如 LogHelper.LogError(ex);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
| 模块 | 说明 |
|
||||
| ---------- | ------------------------------------------------------------------------------------- |
|
||||
| 🔥 全局异常处理 | `App.xaml.cs` 注册的 `DispatcherUnhandledException`、`AppDomain.UnhandledException` 等逻辑封装 |
|
||||
| 🔧 异常日志捕捉器 | 异常信息收集、弹窗提示、自动日志写入 |
|
||||
| 🧠 通用行为类 | 拖拽移动窗口、全屏控制、窗口热键等 |
|
||||
| 🎨 通用控件 | Loading 动画、消息弹窗、状态提示组件 |
|
||||
| 💡 通用转换器 | `BoolToVisibilityConverter`, `EnumToDescriptionConverter` |
|
||||
| 🌈 样式资源 | `Generic.xaml`, Theme, 通用 `DataTemplate` |
|
||||
| 🛠 辅助类 | `UIHelper`, `WindowHelper`, `DialogManager` |
|
||||
@@ -0,0 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Common\Common.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<XamlRuntime>Wpf</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in new issue
Block a user