Refactor application structure and add unit tests

Added:
- New `ProgressService` class for managing progress indicators.
- New `AssetDatabase`, `AssetOpenHandlerAttribute`, and `AsyncAssetOpenHandlerAttribute` classes for asset handling.
- `Ghost.UnitTest` project for unit testing with associated files and configurations.

Changed:
- `ActivationHandler` class to ensure correct handling of `LaunchActivatedEventArgs`.
- `App.xaml.cs` to register `INotificationService` and `IProgressService`, replacing `StackedNotificationService`.
- `OnLaunched` method in `App.xaml.cs` to correctly call `ActivationHandler.Handle(args)` and start the host.
- `INavigationAware` interface from internal to public for broader access.
- `EditorState.cs` to activate `EditorApplication` with the current service provider.
- Property names in `AssetItem` and `ExplorerItem` structs to `Name` and `FullName`.
- `NotificationService` class to implement `INotificationService` and refactor notification handling.
- `AssetPathToGlyphConverter` to handle file extensions consistently.
- Bindings in `ProjectPage.xaml` and `ProjectPage.xaml.cs` to use `FullName` instead of `Path`.
- `EngineEditorWindow` and `LandingWindow` classes to utilize new notification and progress services.
- `Logger` class to include a new method for logging errors with exceptions.

Updated:
- Manifest files and project files to reflect new structure and dependencies.
- Solution file `GhostEngine.sln` to include the new unit test project.
- Added several new test classes and methods in `UnitTests.cs`.
This commit is contained in:
2025-06-10 16:32:32 +09:00
parent 40d333b004
commit ff14c0f49a
149 changed files with 1470 additions and 1901 deletions

View File

@@ -0,0 +1,62 @@
using Ghost.App.Services;
using Ghost.Data.Resources;
using Ghost.Editor.Services.Contracts;
using Ghost.Editor.ViewModels.Windows;
using Ghost.Engine.Resources;
using Microsoft.Extensions.DependencyInjection;
using WinUIEx;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace Ghost.App.View.Windows;
/// <summary>
/// An empty window that can be used on its own or navigated to within a Frame.
/// </summary>
internal sealed partial class EngineEditorWindow : WindowEx
{
private IServiceScope? _editorScope;
private readonly NotificationService _notificationService;
private readonly ProgressService _progressService;
public EngineEditorViewModel ViewModel
{
get;
}
public EngineEditorWindow()
{
ViewModel = GhostApplication.GetService<EngineEditorViewModel>();
_notificationService = (NotificationService)GhostApplication.GetService<INotificationService>();
_progressService = (ProgressService)GhostApplication.GetService<IProgressService>();
AppWindow.SetIcon(AssetsPath.s_appIconPath);
Title = EngineData.ENGINE_NAME;
ExtendsContentIntoTitleBar = true;
InitializeComponent();
this.CenterOnScreen();
}
private void WindowEx_Activated(object sender, Microsoft.UI.Xaml.WindowActivatedEventArgs args)
{
Bindings.Update();
_editorScope?.Dispose();
_editorScope = GhostApplication.CreateScope();
_notificationService.SetReference(InfoBar, NotificationQueue);
_progressService.SetReference(ProgressBarContainer);
}
private void WindowEx_Closed(object sender, Microsoft.UI.Xaml.WindowEventArgs args)
{
_editorScope?.Dispose();
_notificationService.ClearReference();
_progressService.ClearReference();
}
}