| 1 | using CascadeIDE.Models; |
| 2 | |
| 3 | namespace CascadeIDE.Cockpit.Composition.HostSurface; |
| 4 | |
| 5 | /// <summary> |
| 6 | /// Разрешение инструментов в слотах PFD/MFD главного окна (surface <see cref="MainWindowHostSurfaceIds.DockedGrid"/>): |
| 7 | /// одна точка для <see cref="ViewModels.MainWindowViewModel"/> и тестов (карта + <see cref="DisplaySettings"/>). |
| 8 | /// </summary> |
| 9 | public static class MainWindowDockedGridInstrumentSlots |
| 10 | { |
| 11 | public static string ResolvePfdInstrumentId(DisplaySettings? display) |
| 12 | { |
| 13 | if (InstrumentPlacementRuntime.TryResolveInstrument( |
| 14 | MainWindowHostSurfaceIds.DockedGrid, |
| 15 | CockpitSlotIds.Pfd, |
| 16 | display, |
| 17 | out var id) |
| 18 | && !string.IsNullOrWhiteSpace(id)) |
| 19 | return id; |
| 20 | |
| 21 | return CockpitStandardInstrumentIds.SolutionExplorerTree; |
| 22 | } |
| 23 | |
| 24 | public static string ResolveMfdInstrumentId(DisplaySettings? display) |
| 25 | { |
| 26 | if (InstrumentPlacementRuntime.TryResolveInstrument( |
| 27 | MainWindowHostSurfaceIds.DockedGrid, |
| 28 | CockpitSlotIds.Mfd, |
| 29 | display, |
| 30 | out var id) |
| 31 | && !string.IsNullOrWhiteSpace(id)) |
| 32 | return id; |
| 33 | |
| 34 | return ""; |
| 35 | } |
| 36 | |
| 37 | public static bool IsDockedPfdSolutionExplorerTree(DisplaySettings? display) => |
| 38 | string.Equals( |
| 39 | ResolvePfdInstrumentId(display), |
| 40 | CockpitStandardInstrumentIds.SolutionExplorerTree, |
| 41 | StringComparison.OrdinalIgnoreCase); |
| 42 | |
| 43 | public static bool IsDockedPfdWorkspaceNavigationMap(DisplaySettings? display) => |
| 44 | string.Equals( |
| 45 | ResolvePfdInstrumentId(display), |
| 46 | CockpitStandardInstrumentIds.WorkspaceNavigationMap, |
| 47 | StringComparison.OrdinalIgnoreCase); |
| 48 | |
| 49 | public static bool IsDockedMfdSolutionExplorerTree(DisplaySettings? display) => |
| 50 | string.Equals( |
| 51 | ResolveMfdInstrumentId(display), |
| 52 | CockpitStandardInstrumentIds.SolutionExplorerTree, |
| 53 | StringComparison.OrdinalIgnoreCase) |
| 54 | && !IsDockedPfdSolutionExplorerTree(display); |
| 55 | } |
| 56 | |