csharpdeeb25a2 | 1 | #nullable enable |
| 2 | |
| 3 | using System.Diagnostics.CodeAnalysis; |
| 4 | |
| 5 | namespace CascadeIDE.Cockpit.Composition.HostSurface; |
| 6 | |
| 7 | /// <summary>Значения <c>pfd_status_strip</c> / <c>forward_status_strip</c> в <c>[display.instruments]</c>.</summary> |
| 8 | public static class InstrumentStatusStripRouting |
| 9 | { |
| 10 | public const string None = "none"; |
| 11 | |
| 12 | public static bool TryParse(string? token, out bool showStrip, [NotNullWhen(true)] out string? instrumentId) |
| 13 | { |
| 14 | showStrip = false; |
| 15 | instrumentId = null; |
| 16 | var t = token?.Trim() ?? ""; |
| 17 | if (t.Length == 0) |
| 18 | return false; |
| 19 | |
| 20 | if (t.Equals(None, StringComparison.OrdinalIgnoreCase)) |
| 21 | { |
| 22 | instrumentId = CockpitStandardInstrumentIds.WorkspaceBackgroundStatusV1; |
| 23 | return true; |
| 24 | } |
| 25 | |
| 26 | if (t.Equals("background_status", StringComparison.OrdinalIgnoreCase) |
| 27 | || t.Equals(CockpitStandardInstrumentIds.WorkspaceBackgroundStatusV1, StringComparison.OrdinalIgnoreCase)) |
| 28 | { |
| 29 | showStrip = true; |
| 30 | instrumentId = CockpitStandardInstrumentIds.WorkspaceBackgroundStatusV1; |
| 31 | return true; |
| 32 | } |
| 33 | |
| 34 | return false; |
| 35 | } |
| 36 | } |
| 37 | |
View only · write via MCP/CIDE