/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App/Actions/Show/TogglePreviewPaneAction.cs
48 строк
1 KB
yair100
Code Quality: Add Category, ExtendedLabel, AutomationId and AccessKey to actions (#18308)
27 мар 2026, 00:40
Не верифицирован
27 мар 2026, 00:40
6ef1f17
Код
Авторство
О чём код?
// Copyright (c) Files Community // Licensed under the MIT License. namespace Files.App.Actions { [GeneratedRichCommand] internal sealed partial class TogglePreviewPaneAction : ObservableObject, IAction { private readonly InfoPaneViewModel infoPaneViewModel = Ioc.Default.GetRequiredService<InfoPaneViewModel>(); private readonly IInfoPaneSettingsService infoPaneSettingsService = Ioc.Default.GetRequiredService<IInfoPaneSettingsService>(); public string Label => Strings.TogglePreviewPane.GetLocalizedResource(); public string Description => Strings.TogglePreviewPaneDescription.GetLocalizedResource(); public ActionCategory Category => ActionCategory.Show; public RichGlyph Glyph => new(themedIconStyle: "App.ThemedIcons.PanelRight"); public bool IsAccessibleGlobally => false; public bool IsExecutable => infoPaneViewModel.IsEnabled; public TogglePreviewPaneAction() { infoPaneViewModel.PropertyChanged += ViewModel_PropertyChanged; } public Task ExecuteAsync(object? parameter = null) { infoPaneSettingsService.SelectedTab = InfoPaneTabs.Preview; return Task.CompletedTask; } private void ViewModel_PropertyChanged(object? sender, PropertyChangedEventArgs e) { if (e.PropertyName is nameof(InfoPaneViewModel.IsEnabled)) OnPropertyChanged(nameof(IsExecutable)); } } }