Forge
csharpdeeb25a2
1namespace CascadeIDE.Cockpit.Composition.HostSurface;
2
3/// <summary>
4/// Дефолт главного окна: <see cref="CockpitStandardInstrumentIds.WorkspaceNavigationMap"/> в Pfd при видимой колонке;
5/// <see cref="CockpitStandardInstrumentIds.SolutionExplorerTree"/> в Mfd при видимой колонке Mfd в main grid.
6/// </summary>
7public sealed class DefaultSurfaceSlotInstrumentBindingProvider : ISurfaceSlotInstrumentBindingProvider
8{
9 public static DefaultSurfaceSlotInstrumentBindingProvider Instance { get; } = new();
10
11 private DefaultSurfaceSlotInstrumentBindingProvider()
12 {
13 }
14
15 public IReadOnlyList<CockpitInstrumentDescriptor> GetBindings(in SurfaceSlotInstrumentBindingContext context)
16 {
17 var shell = context.Shell;
18 var list = new List<CockpitInstrumentDescriptor>();
19
20 if (shell.PfdSurfaceVisible)
21 {
22 var ctx = new InstrumentPlacementContext(
23 SurfaceId: context.SurfaceId,
24 SlotId: CockpitSlotIds.Pfd,
25 InstrumentId: CockpitStandardInstrumentIds.WorkspaceNavigationMap,
26 SafetyLevel: context.SafetyLevel);
27 if (CockpitInstrumentPlacementRules.IsAllowed(in ctx))
28 list.Add(new CockpitInstrumentDescriptor(CockpitStandardInstrumentIds.WorkspaceNavigationMap, CockpitSlotIds.Pfd));
29 }
30
31 if (shell.MfdColumnVisibleInMainGrid)
32 {
33 var ctx = new InstrumentPlacementContext(
34 SurfaceId: context.SurfaceId,
35 SlotId: CockpitSlotIds.Mfd,
36 InstrumentId: CockpitStandardInstrumentIds.SolutionExplorerTree,
37 SafetyLevel: context.SafetyLevel);
38 if (CockpitInstrumentPlacementRules.IsAllowed(in ctx))
39 list.Add(new CockpitInstrumentDescriptor(CockpitStandardInstrumentIds.SolutionExplorerTree, CockpitSlotIds.Mfd));
40 }
41
42 return list;
43 }
44}
45
View only · write via MCP/CIDE