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`.
66 lines
2.1 KiB
C#
66 lines
2.1 KiB
C#
using Ghost.App.Services;
|
|
using Ghost.App.View.Pages.Landing;
|
|
using Ghost.Data.Resources;
|
|
using Ghost.Editor.Services.Contracts;
|
|
using Ghost.Engine.Resources;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.UI.Xaml.Controls;
|
|
using Microsoft.UI.Xaml.Media.Animation;
|
|
using WinUIEx;
|
|
|
|
namespace Ghost.App.View.Windows;
|
|
|
|
internal sealed partial class LandingWindow : WindowEx
|
|
{
|
|
private IServiceScope? _landingScope;
|
|
|
|
private readonly NotificationService _notificationService;
|
|
|
|
private int _previousSelectedIndex;
|
|
|
|
public LandingWindow()
|
|
{
|
|
_notificationService = (NotificationService)GhostApplication.GetService<INotificationService>();
|
|
|
|
AppWindow.SetIcon(AssetsPath.s_appIconPath);
|
|
Title = EngineData.ENGINE_NAME;
|
|
|
|
InitializeComponent();
|
|
|
|
this.SetWindowSize(1000, 750);
|
|
this.CenterOnScreen();
|
|
|
|
ExtendsContentIntoTitleBar = true;
|
|
}
|
|
|
|
private void WindowEx_Activated(object sender, Microsoft.UI.Xaml.WindowActivatedEventArgs args)
|
|
{
|
|
_landingScope?.Dispose();
|
|
_landingScope = GhostApplication.CreateScope();
|
|
_notificationService.SetReference(InfoBar, NotificationQueue);
|
|
}
|
|
|
|
private void WindowEx_Closed(object sender, Microsoft.UI.Xaml.WindowEventArgs args)
|
|
{
|
|
_landingScope?.Dispose();
|
|
_notificationService.ClearReference();
|
|
}
|
|
|
|
private void SelectorBar_SelectionChanged(SelectorBar sender, SelectorBarSelectionChangedEventArgs e)
|
|
{
|
|
var selectedItem = sender.SelectedItem;
|
|
var currentSelectedIndex = sender.Items.IndexOf(selectedItem);
|
|
var pageType = currentSelectedIndex switch
|
|
{
|
|
1 => typeof(CreateProjectPage),
|
|
_ => typeof(OpenProjectPage),
|
|
};
|
|
|
|
var slideNavigationTransitionEffect = currentSelectedIndex - _previousSelectedIndex > 0 ?
|
|
SlideNavigationTransitionEffect.FromRight : SlideNavigationTransitionEffect.FromLeft;
|
|
|
|
ContentFrame.Navigate(pageType, _landingScope, new SlideNavigationTransitionInfo() { Effect = slideNavigationTransitionEffect });
|
|
|
|
_previousSelectedIndex = currentSelectedIndex;
|
|
}
|
|
} |