/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App/Actions/Content/RefreshItemsAction.cs
57 строк
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 RefreshItemsAction : ObservableObject, IAction { private readonly IContentPageContext context; public string Label => Strings.Refresh.GetLocalizedResource(); public string Description => Strings.RefreshItemsDescription.GetLocalizedResource(); public ActionCategory Category => ActionCategory.FileSystem; public RichGlyph Glyph => new("\uE72C"); public HotKey HotKey => new(Keys.R, KeyModifiers.Ctrl); public HotKey SecondHotKey => new(Keys.F5); public bool IsExecutable => context.CanRefresh; public RefreshItemsAction() { context = Ioc.Default.GetRequiredService<IContentPageContext>(); context.PropertyChanged += Context_PropertyChanged; } public async Task ExecuteAsync(object? parameter = null) { if (context.ShellPage is null) return; await context.ShellPage.Refresh_Click(); } private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e) { switch (e.PropertyName) { case nameof(IContentPageContext.CanRefresh): OnPropertyChanged(nameof(IsExecutable)); break; } } } }