/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App/Actions/Open/OpenStorageSenseAction.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 partial class OpenStorageSenseAction : ObservableObject, IAction { private readonly IContentPageContext context = Ioc.Default.GetRequiredService<IContentPageContext>(); private readonly DrivesViewModel drivesViewModel = Ioc.Default.GetRequiredService<DrivesViewModel>(); public virtual string Label => Strings.Cleanup.GetLocalizedResource(); public virtual string Description => Strings.OpenStorageSenseDescription.GetLocalizedResource(); public virtual ActionCategory Category => ActionCategory.Open; public virtual bool IsExecutable => context.HasItem && !context.HasSelection && drivesViewModel.Drives .Cast<DriveItem>() .FirstOrDefault(x => string.Equals(x.Path, context.Folder?.ItemPath)) is DriveItem driveItem && driveItem.Type != DriveType.Network; public virtual bool IsAccessibleGlobally => true; public OpenStorageSenseAction() { context.PropertyChanged += Context_PropertyChanged; } public virtual Task ExecuteAsync(object? parameter = null) { return StorageSenseHelper.OpenStorageSenseAsync(context.Folder?.ItemPath ?? string.Empty); } public void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e) { if (e.PropertyName is nameof(IContentPageContext.HasItem)) OnPropertyChanged(nameof(IsExecutable)); } } }