Batch Update
This commit is contained in:
parent
693d12b61c
commit
4c2b5cca93
32 changed files with 483 additions and 332 deletions
90
app/InkForge.Desktop/InkForgeFactory.cs
Normal file
90
app/InkForge.Desktop/InkForgeFactory.cs
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
using Dock.Model.ReactiveUI;
|
||||
using Dock.Model.Controls;
|
||||
using Dock.Model.Core;
|
||||
using Dock.Model.ReactiveUI.Controls;
|
||||
using Dock.Avalonia.Controls;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Avalonia;
|
||||
using InkForge.Desktop.ViewModels;
|
||||
|
||||
namespace InkForge.Desktop;
|
||||
|
||||
public class InkForgeFactory : Factory
|
||||
{
|
||||
private readonly IDocumentDock _documentDock;
|
||||
private readonly IRootDock _rootDock;
|
||||
private readonly ViewModels.Tools.WorkspaceTool _workspaceTool;
|
||||
|
||||
public InkForgeFactory()
|
||||
{
|
||||
_rootDock = new RootDock
|
||||
{
|
||||
IsCollapsable = false,
|
||||
};
|
||||
|
||||
_documentDock = new InkForgeDocumentDock
|
||||
{
|
||||
Id = "Documents",
|
||||
Title = "Documents",
|
||||
CanCreateDocument = false,
|
||||
IsCollapsable = false,
|
||||
Proportion = double.NaN,
|
||||
};
|
||||
|
||||
_workspaceTool = CreateWorkspaceTool();
|
||||
}
|
||||
|
||||
public override IRootDock CreateLayout()
|
||||
{
|
||||
ProportionalDock workspaceLayout = new()
|
||||
{
|
||||
Proportion = 0.3,
|
||||
VisibleDockables = [_workspaceTool],
|
||||
};
|
||||
|
||||
ProportionalDock windowLayoutContent = new()
|
||||
{
|
||||
Orientation = Orientation.Horizontal,
|
||||
IsCollapsable = false,
|
||||
VisibleDockables = [workspaceLayout, new ProportionalDockSplitter(), _documentDock]
|
||||
};
|
||||
|
||||
RootDock windowLayout = new()
|
||||
{
|
||||
Title = "Default",
|
||||
IsCollapsable = false,
|
||||
VisibleDockables = [windowLayoutContent],
|
||||
ActiveDockable = windowLayoutContent,
|
||||
};
|
||||
|
||||
_rootDock.VisibleDockables = [windowLayout];
|
||||
_rootDock.ActiveDockable = windowLayout;
|
||||
_rootDock.DefaultDockable = windowLayout;
|
||||
|
||||
return _rootDock;
|
||||
}
|
||||
|
||||
public override void InitLayout(IDockable layout)
|
||||
{
|
||||
DockableLocator = new Dictionary<string, Func<IDockable?>>
|
||||
{
|
||||
["Root"] = () => _rootDock,
|
||||
["Documents"] = () => _documentDock,
|
||||
["Workspace"] = () => _workspaceTool,
|
||||
};
|
||||
|
||||
HostWindowLocator = new Dictionary<string, Func<IHostWindow?>>
|
||||
{
|
||||
[nameof(IDockWindow)] = () => new HostWindow()
|
||||
};
|
||||
|
||||
base.InitLayout(layout);
|
||||
}
|
||||
|
||||
private static ViewModels.Tools.WorkspaceTool CreateWorkspaceTool()
|
||||
{
|
||||
return ActivatorUtilities.CreateInstance<ViewModels.Tools.WorkspaceTool>(
|
||||
Application.Current!.GetValue(App.ServiceProviderProperty)
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue