Files
ShrlAlgoToolkit/NeoUI/NeoUITest/App.xaml.cs

68 lines
2.6 KiB
C#
Raw Normal View History

2025-07-31 20:12:24 +08:00
using System;
using System.Collections;
using System.Diagnostics;
using System.Linq;
2025-08-12 23:08:54 +08:00
using System.Threading;
using System.Threading.Tasks;
2025-07-31 20:12:24 +08:00
using System.Windows;
2025-08-12 23:08:54 +08:00
2025-08-20 12:10:13 +08:00
using NeoUI;
2025-07-31 20:12:24 +08:00
2025-08-20 12:10:35 +08:00
namespace NeoUITest
2025-07-31 20:12:24 +08:00
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
2025-08-12 23:08:54 +08:00
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
2025-08-20 12:10:35 +08:00
//Splash.ShowAsync("pack://application:,,,/NeoUITest;component/Resources/Images/ImageTest.png");
2025-08-12 23:08:54 +08:00
//MainWindow = new MainWindow();
//Splash.CloseOnLoaded(MainWindow);
//MainWindow.Show();
}
2025-07-31 20:12:24 +08:00
//protected override void OnStartup(StartupEventArgs e)
//{
// base.OnStartup(e);
// // 在应用启动时,调用方法打印所有已加载的资源字典
// Debug.WriteLine("==========================================================");
// Debug.WriteLine(" Dumping All Loaded Application Resource Dictionaries... ");
// Debug.WriteLine("==========================================================");
// // 从最顶层的 Application.Resources 开始遍历
// DumpResourceDictionaries(Application.Current.Resources, 0);
// Debug.WriteLine("====================== End of Dump =======================");
//}
/// <summary>
/// 递归打印资源字典及其合并的子字典。
/// </summary>
/// <param name="dictionary">要检查的资源字典。</param>
/// <param name="indentationLevel">缩进级别,用于格式化输出。</param>
private void DumpResourceDictionaries(ResourceDictionary dictionary, int indentationLevel)
{
// 创建缩进字符串,使输出更具可读性
var indent = new string(' ', indentationLevel * 4);
// 打印当前字典的来源Source URI
// App.xaml 中直接定义的根 ResourceDictionary 没有 Source所以需要判断
if (dictionary.Source != null)
{
Debug.WriteLine($"{indent}-> Source: {dictionary.Source}");
}
else
{
// 这是根字典或一个内联定义的字典
Debug.WriteLine($"{indent}[Root or Inline Dictionary]");
}
// 递归遍历所有合并的字典
foreach (var mergedDict in dictionary.MergedDictionaries)
{
DumpResourceDictionaries(mergedDict, indentationLevel + 1);
}
}
}
}