Forge
csharpdeeb25a2
1using CascadeIDE.Features.Shell.Application;
2using CascadeIDE.Features.UiChrome;
3using CommunityToolkit.Mvvm.Input;
4
5namespace CascadeIDE.Features.Shell;
6
7/// <summary>Relay: режим UI (shell chrome).</summary>
8public sealed partial class ShellChromeViewModel
9{
10 /// <summary>Переключение режима по id из каталога (<see cref="UiModeCatalog.OrderedModeIds"/>).</summary>
11 [RelayCommand]
12 private void SetUiModeById(string? modeId)
13 {
14 if (string.IsNullOrWhiteSpace(modeId))
15 return;
16 UiMode = UiChromeViewModel.NormalizeUiMode(modeId);
17 }
18
19 /// <summary>Alt+1…9: N-й режим в <see cref="UiModeCatalog.OrderedModeIds"/> (0-based).</summary>
20 [RelayCommand]
21 private void SetUiModeByIndex(object? parameter)
22 {
23 var idx = UiModeSelectionParameter.ParseIndex(parameter);
24 if (idx < 0)
25 return;
26 var ids = UiModeCatalog.OrderedModeIds;
27 if (idx >= ids.Count)
28 return;
29 UiMode = ids[idx];
30 }
31
32 [RelayCommand]
33 private void CycleUiMode()
34 {
35 var norm = UiChromeViewModel.NormalizeUiMode(UiMode);
36 var ids = UiModeCatalog.OrderedModeIds;
37 var idx = -1;
38 for (var i = 0; i < ids.Count; i++)
39 {
40 if (string.Equals(ids[i], norm, StringComparison.OrdinalIgnoreCase))
41 {
42 idx = i;
43 break;
44 }
45 }
46
47 if (idx < 0 || ids.Count == 0)
48 {
49 UiMode = "Flight";
50 return;
51 }
52
53 UiMode = ids[(idx + 1) % ids.Count];
54 }
55}
56
View only · write via MCP/CIDE