Add project files.
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
namespace Builder.LifeCycles;
|
||||
|
||||
public record AddPage(string Name);
|
||||
@@ -0,0 +1,18 @@
|
||||
using TheXamlGuy.Framework.Core;
|
||||
|
||||
namespace Builder.LifeCycles;
|
||||
|
||||
public class AddPageHandler : IMediatorHandler<AddPage>
|
||||
{
|
||||
private readonly IProjectContext context;
|
||||
|
||||
public AddPageHandler(IProjectContext context)
|
||||
{
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void Handle(AddPage request)
|
||||
{
|
||||
context.Pages.Add(new Page(request.Name));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Builder.LifeCycles
|
||||
{
|
||||
public interface IProjectContext
|
||||
{
|
||||
ICollection<Page> Pages { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
namespace Builder.LifeCycles
|
||||
{
|
||||
public record Page(string Name);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Builder.LifeCycles
|
||||
{
|
||||
public class ProjectConfiguration
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Builder.LifeCycles
|
||||
{
|
||||
public class ProjectContext : IProjectContext
|
||||
{
|
||||
public ICollection<Page> Pages => new List<Page>();
|
||||
}
|
||||
|
||||
public interface IProjectScope
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using TheXamlGuy.Framework.Core;
|
||||
|
||||
namespace Builder;
|
||||
|
||||
public class StartedHandler : IMediatorHandler<Started>
|
||||
{
|
||||
private readonly MainWindow window;
|
||||
private readonly MainWindowViewModel viewModel;
|
||||
|
||||
public StartedHandler(MainWindow window,
|
||||
MainWindowViewModel viewModel)
|
||||
{
|
||||
this.window = window;
|
||||
this.viewModel = viewModel;
|
||||
}
|
||||
|
||||
public void Handle(Started request)
|
||||
{
|
||||
window.DataContext = viewModel;
|
||||
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
desktop.MainWindow = window;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user