forked from Misaki/GhostEngine
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,17 +1,70 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Ghost.Database.Models.Projects;
|
||||
using Ghost.Editor.Constants;
|
||||
using Ghost.Editor.Contracts;
|
||||
using Ghost.Editor.Helpers;
|
||||
using Ghost.Editor.Models.Warpers;
|
||||
using Microsoft.UI.Dispatching;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ghost.Editor.ViewModel.Pages.Landing;
|
||||
|
||||
internal partial class CreateProjectViewModel : ObservableRecipient
|
||||
internal partial class CreateProjectViewModel : ObservableRecipient, INavigationAware
|
||||
{
|
||||
public ObservableCollection<TemplateInfo> templates = new();
|
||||
public ObservableCollection<TemplateInfoWarper> templates = new();
|
||||
|
||||
[ObservableProperty]
|
||||
public partial TemplateInfo SelectedTemplate
|
||||
public partial TemplateInfoWarper? SelectedTemplate
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[ObservableProperty]
|
||||
public partial string ProjectName
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[ObservableProperty]
|
||||
public partial string ProjectLocation
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public void OnNavigatedTo(object? parameter)
|
||||
{
|
||||
DispatcherQueue.GetForCurrentThread().TryEnqueue(DispatcherQueuePriority.High, () =>
|
||||
{
|
||||
foreach (var templatePath in Directory.GetFiles(EditorDataPath.ProjectTemplatesFolder, "template.json", SearchOption.AllDirectories))
|
||||
{
|
||||
var templateInfo = JsonSerializer.Deserialize<TemplateInfo>(File.ReadAllText(templatePath));
|
||||
if (templateInfo == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
templates.Add(new(templatePath, templateInfo));
|
||||
}
|
||||
|
||||
SelectedTemplate = templates.FirstOrDefault();
|
||||
});
|
||||
}
|
||||
|
||||
public void OnNavigatedFrom()
|
||||
{
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private async Task SelectionProjectLocation()
|
||||
{
|
||||
ProjectLocation = (await SystemUtilities.OpenFolderPickerAsync())?.Path ?? string.Empty;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user