/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App/Actions/Navigation/NavigateBackAction.cs
62 строки
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 NavigateBackAction : ObservableObject, IAction { private readonly IContentPageContext context; public string Label => Strings.Back.GetLocalizedResource(); public string Description => Strings.NavigateBackDescription.GetLocalizedResource(); public ActionCategory Category => ActionCategory.Navigation; public HotKey HotKey => new(Keys.Left, KeyModifiers.Alt); public HotKey SecondHotKey => new(Keys.Back); public HotKey ThirdHotKey => new(Keys.Mouse4); public HotKey MediaHotKey => new(Keys.GoBack, KeyModifiers.None, false); public RichGlyph Glyph => new("\uE72B"); public bool IsExecutable => context.CanGoBack; public NavigateBackAction() { context = Ioc.Default.GetRequiredService<IContentPageContext>(); context.PropertyChanged += Context_PropertyChanged; } public Task ExecuteAsync(object? parameter = null) { context.ShellPage!.Back_Click(); return Task.CompletedTask; } private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e) { switch (e.PropertyName) { case nameof(IContentPageContext.CanGoBack): OnPropertyChanged(nameof(IsExecutable)); break; } } } }