forked from Misaki/GhostEngine
Added a new static class `AssetsPath` for asset management. Added a new icon file (`icon-256.ico`) for UI representation. Added new package references to enhance functionality. Added internals visibility attributes for better testing. Added a new `EngineEditorViewModel` class for MVVM support. Added a new `GameObject` class for component management. Added a new `BitSet` class for efficient bit manipulation. Added various utility classes to support the new entity system. Changed the `ID` property in `ProjectInfo` to internal. Changed the `AddProjectAsync` method to return the created `ProjectInfo`. Changed the connection string retrieval method to use the new `Command` constant. Changed the `DataPath` class to use `readonly` fields for folder paths. Changed the `ActivationHandler` class to use new `DataPath` constants. Changed the `OpenProjectPage` layout and interaction for better UI. Updated the target framework to a newer version for compatibility. Updated the `ProjectService` to use new constants from `DataPath`. Updated the `World` class to improve entity management. Refactored the `ProjectRepository` class to encapsulate SQL commands. Refactored the `Transform` class to use properties for better encapsulation.
56 lines
1.5 KiB
C#
56 lines
1.5 KiB
C#
using Ghost.Data.Models;
|
|
using Ghost.Data.Services;
|
|
using Ghost.Editor.View.Windows;
|
|
using Microsoft.UI.Xaml;
|
|
using Microsoft.UI.Xaml.Controls;
|
|
using Microsoft.UI.Xaml.Navigation;
|
|
using System.Collections.ObjectModel;
|
|
|
|
// 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.View.Pages.Landing;
|
|
|
|
internal sealed partial class OpenProjectPage : Page
|
|
{
|
|
private readonly ProjectService _projectService;
|
|
|
|
public readonly ObservableCollection<ProjectInfo> projects = new();
|
|
|
|
public OpenProjectPage()
|
|
{
|
|
_projectService = App.GetService<ProjectService>();
|
|
|
|
InitializeComponent();
|
|
}
|
|
|
|
protected override async void OnNavigatedTo(NavigationEventArgs e)
|
|
{
|
|
await foreach (var project in _projectService.LoadAllProjectAsync())
|
|
{
|
|
projects.Add(project);
|
|
}
|
|
|
|
if (projects.Count == 0)
|
|
{
|
|
PlaceHolderText.Visibility = Visibility.Visible;
|
|
ProjectListView.Visibility = Visibility.Collapsed;
|
|
}
|
|
}
|
|
|
|
private async void ListView_ItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
if (e.ClickedItem is not ProjectInfo project)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (EngineEditorWindow.TryLoadProject(project))
|
|
{
|
|
App.GetService<LandingWindow>().Close();
|
|
|
|
project.LastOpened = System.DateTime.Now;
|
|
await _projectService.UpdateProjectAsync(project);
|
|
}
|
|
}
|
|
} |