/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App/Actions/Navigation/DuplicateSelectedTabAction.cs
52 строки
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 DuplicateSelectedTabAction : ObservableObject, IAction { private readonly IMultitaskingContext context; public string Label => Strings.DuplicateTab.GetLocalizedResource(); public string Description => Strings.DuplicateSelectedTabDescription.GetLocalizedResource(); public ActionCategory Category => ActionCategory.Navigation; public HotKey HotKey => new(Keys.K, KeyModifiers.CtrlShift); public bool IsExecutable => context.SelectedTabItem is not null; public DuplicateSelectedTabAction() { context = Ioc.Default.GetRequiredService<IMultitaskingContext>(); context.PropertyChanged += MultitaskingContext_PropertyChanged; } public async Task ExecuteAsync(object? parameter = null) { var arguments = context.SelectedTabItem.NavigationParameter; if (arguments is null) { await NavigationHelpers.AddNewTabByPathAsync(typeof(ShellPanesPage), "Home", true); } else { await NavigationHelpers.AddNewTabByParamAsync(arguments.InitialPageType, arguments.NavigationParameter, context.SelectedTabIndex + 1); } } private void MultitaskingContext_PropertyChanged(object? sender, PropertyChangedEventArgs e) { if (e.PropertyName == nameof(IMultitaskingContext.SelectedTabItem)) OnPropertyChanged(nameof(IsExecutable)); } } }