Files
Lattice/Lattice.IDE/MainWindow.xaml.cs
2026-01-18 16:33:35 +03:00

65 lines
1.7 KiB
C#

using Lattice.Core.Docking.Engine;
using Lattice.Core.Docking.Models;
using Lattice.IDE.Controls;
using Lattice.Themes;
using Microsoft.UI.Xaml;
// Ïðåäïîëîæèì, ÷òî VS2026Theme òîæå ðåàëèçîâàí àíàëîãè÷íî Fluent
// using Lattice.Themes.VisualStudio2026;
namespace Lattice.IDE;
public sealed partial class MainWindow : Window
{
private LayoutManager _manager;
public MainWindow()
{
this.InitializeComponent();
WindowTracker.Register(this);
SystemBackdrop = new Microsoft.UI.Xaml.Media.MicaBackdrop();
InitLattice();
}
private void InitLattice()
{
_manager = new LayoutManager();
// Ñîçäàåì êîíòåíò íà îñíîâå XAML UserControls
var solutionExplorer = new DemoContent(
"sln",
"Solution Explorer",
new SolutionExplorerView()
);
var editor = new DemoContent(
"code_01",
"Program.cs",
new EditorView()
);
// Ñîáèðàåì äåðåâî (êàê ðàíüøå)
var leftLeaf = new DockLeaf();
leftLeaf.AddContent(solutionExplorer);
var centerLeaf = new DockLeaf()
{
TabPlacement = TabPlacement.Top,
};
centerLeaf.AddContent(editor);
var rootGroup = new DockGroup(leftLeaf, centerLeaf, SplitDirection.Horizontal)
{
SplitRatio = 0.25
};
_manager.SetRoot(rootGroup);
DockHost.Manager = _manager;
}
private void SetFluentTheme(object sender, RoutedEventArgs e) =>
ThemeManager.Current.ApplyTheme(new FluentThemePack());
private void SetVSTheme(object sender, RoutedEventArgs e) =>
ThemeManager.Current.ApplyTheme(new VS2026ThemePack());
}