/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App/Actions/Navigation/ReopenClosedTabAction.cs
54 строки
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 ReopenClosedTabAction : ObservableObject, IAction { private readonly IMultitaskingContext context; public string Label => Strings.ReopenClosedTab.GetLocalizedResource(); public string Description => Strings.ReopenClosedTabDescription.GetLocalizedResource(); public ActionCategory Category => ActionCategory.Navigation; public HotKey HotKey => new(Keys.T, KeyModifiers.CtrlShift); public bool IsExecutable => context.Control is not null && !BaseTabBar.IsRestoringClosedTab && BaseTabBar.RecentlyClosedTabs.Count > 0; public ReopenClosedTabAction() { context = Ioc.Default.GetRequiredService<IMultitaskingContext>(); context.PropertyChanged += Context_PropertyChanged; BaseTabBar.StaticPropertyChanged += BaseMultitaskingControl_StaticPropertyChanged; } public Task ExecuteAsync(object? parameter = null) { context.Control!.ReopenClosedTabAsync(); return Task.CompletedTask; } private void Context_PropertyChanged(object? _, PropertyChangedEventArgs e) { if (e.PropertyName is nameof(IMultitaskingContext.Control)) OnPropertyChanged(nameof(IsExecutable)); } private void BaseMultitaskingControl_StaticPropertyChanged(object? sender, PropertyChangedEventArgs e) { OnPropertyChanged(nameof(IsExecutable)); } } }