using System;
using System.Collections;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using Melskin;
namespace VibeWPFTest
{
///
/// Interaction logic for App.xaml
///
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
//Splash.ShowAsync("pack://application:,,,/VibeWPFTest;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 =======================");
//}
///
/// 递归打印资源字典及其合并的子字典。
///
/// 要检查的资源字典。
/// 缩进级别,用于格式化输出。
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);
}
}
}
}