Files
GhostEngine/Ghost.Editor/App.xaml.cs
Misaki 02b3edcd7a Refactor project structure and enhance UI components
Changed connection string format in ProjectRepository.cs and updated application data path retrieval.

Added project reference to Ghost.Engine in Ghost.Database.csproj.

Added new property Packages in TemplateInfo.cs.

Changed XamlControlsResources source in App.xaml for clarity.

Changed App.xaml.cs to include new Host property and updated OnLaunched method.

Removed unused image files related to branding.

Updated Ghost.Editor.csproj to change target framework and organize content files.

Changed display name in Package.appxmanifest from "Ghost.Editor" to "GhostEngine".

Enhanced UI layout and data binding in CreateProjectPage.xaml and its code-behind.

Changed LandingWindow to use WindowEx for improved functionality.

Updated CreateProjectViewModel to implement INavigationAware for better navigation handling.

Updated AssemblyInfo.cs for internal visibility to Ghost.Database.

Added new files for activation handling and game object management in Ghost.Core and Ghost.Engine.

Introduced SystemUtilities for folder picker dialog functionality.

Created PropertyField control with corresponding XAML for UI consistency.

Added TemplateInfoWarper for managing template information.

Introduced HostHelper class to set up application services.

Overall, these changes reflect a significant restructuring of the project, enhancing architecture, improving UI components, and establishing clearer separation of concerns.
2025-03-26 01:18:16 +09:00

78 lines
2.2 KiB
C#

using Ghost.Editor.View.Pages;
using Ghost.Editor.View.Windows;
using Microsoft.Extensions.Hosting;
using Microsoft.UI.Xaml;
using System;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace Ghost.Editor
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public partial class App : Application
{
private Window? _window;
public Window? CurrentWindow
{
get => _window;
set => _window = value;
}
public IHost Host
{
get;
}
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
InitializeComponent();
Host = Microsoft.Extensions.Hosting.Host.
CreateDefaultBuilder().
UseContentRoot(AppContext.BaseDirectory).
ConfigureServices((context, services) =>
{
HostHelper.SetupPageService(context, services);
})
.Build();
}
public static Window? GetWindow()
{
return (Current as App)?.CurrentWindow;
}
public static T GetService<T>() where T : class
{
if ((Current as App)!.Host.Services.GetService(typeof(T)) is not T service)
{
throw new ArgumentException($"{typeof(T)} needs to be registered in ConfigureServices within App.xaml.cs.");
}
return service;
}
/// <summary>
/// Invoked when the application is launched.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
base.OnLaunched(args);
EditorActivationHandler.Handle(args);
Host.Start();
_window = GetService<LandingWindow>();
_window.Activate();
}
}
}