Files
ShrlAlgoToolkit/MelskinTest/App.xaml.cs
2026-02-17 22:17:23 +08:00

68 lines
2.6 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using Melskin;
namespace MelskinTest
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
//Splash.ShowAsync("pack://application:,,,/MelskinTest;component/Resources/Images/ImageTest.png");
//MainWindow = new MainWindow();
//Splash.CloseOnLoaded(MainWindow);
//MainWindow.Show();
}
//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);
}
}
}
}