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.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using Ghost.Editor.View.Windows;
|
||||
using Ghost.Editor.ViewModel.Windows;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Ghost.Editor.View.Pages;
|
||||
using Ghost.Editor.View.Windows;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.UI.Xaml;
|
||||
using System;
|
||||
@@ -16,22 +15,17 @@ namespace Ghost.Editor
|
||||
public partial class App : Application
|
||||
{
|
||||
private Window? _window;
|
||||
public Window? CurrentWindow
|
||||
{
|
||||
get => _window;
|
||||
set => _window = value;
|
||||
}
|
||||
|
||||
public IHost Host
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
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>
|
||||
/// 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().
|
||||
@@ -45,12 +39,26 @@ namespace Ghost.Editor
|
||||
UseContentRoot(AppContext.BaseDirectory).
|
||||
ConfigureServices((context, services) =>
|
||||
{
|
||||
services.AddTransient<LandingWindow>();
|
||||
services.AddTransient<LandingViewModel>();
|
||||
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>
|
||||
@@ -58,6 +66,9 @@ namespace Ghost.Editor
|
||||
protected override void OnLaunched(LaunchActivatedEventArgs args)
|
||||
{
|
||||
base.OnLaunched(args);
|
||||
|
||||
EditorActivationHandler.Handle(args);
|
||||
|
||||
Host.Start();
|
||||
|
||||
_window = GetService<LandingWindow>();
|
||||
|
||||
Reference in New Issue
Block a user