You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
using System ;
using AI ;
using AI.AgentIntegration ;
using AI.Interface ;
using AI.Service ;
using Avalonia ;
using Microsoft.Extensions.DependencyInjection ;
namespace PcgDrawR
{
/// <summary>
/// AvaloniaLoader 框架初始化类
/// </summary>
public static class AvaloniaBootstrapper
{
private static bool isInitialized = false ;
/// <summary>
/// 初始化
/// </summary>
public static void EnsureInitialized ( )
{
if ( isInitialized )
{
return ;
}
// 供 AI 模块 DI 使用(列头匹配等动态表单需调用 GetColumns)
AppControllerHolder . Instance = AppController . Instance ;
InitializeAvalonia ( ) ;
InitializeAIModule ( ) ;
isInitialized = true ;
}
private static void InitializeAvalonia ( )
{
AppBuilder . Configure < App > ( )
. UsePlatformDetect ( )
. SetupWithoutStarting ( ) ;
}
private static void InitializeAIModule ( )
{
var app = ( App ) Avalonia . Application . Current ;
var kernelService = app . ServiceProvider . GetRequiredService < IChatBackend > ( ) as KernelService ;
var formNotifier = app . ServiceProvider . GetService < IFormRequestNotifier > ( ) ;
kernelService ? . Initialize ( AppController . Instance , formNotifier ) ;
}
}
}