/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App/Actions/Content/Install/InstallInfDriverAction.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. using Files.Shared.Helpers; namespace Files.App.Actions { [GeneratedRichCommand] internal sealed partial class InstallInfDriverAction : ObservableObject, IAction { private readonly IContentPageContext context; public string Label => Strings.InstallDriver.GetLocalizedResource(); public string Description => Strings.InstallInfDriverDescription.GetLocalizedFormatResource(context.SelectedItems.Count); public RichGlyph Glyph => new("\uE9F5"); public ActionCategory Category => ActionCategory.Install; public bool IsExecutable => context.SelectedItems.Count == 1 && FileExtensionHelpers.IsInfFile(context.SelectedItems[0].FileExtension) && context.PageType != ContentPageTypes.RecycleBin && context.PageType != ContentPageTypes.ZipFolder; public InstallInfDriverAction() { context = Ioc.Default.GetRequiredService<IContentPageContext>(); context.PropertyChanged += Context_PropertyChanged; } public async Task ExecuteAsync(object? parameter = null) { await Task.WhenAll(context.SelectedItems.Select(selectedItem => Win32Helper.InstallInf(selectedItem.ItemPath))); } public void Context_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e) { switch (e.PropertyName) { case nameof(IContentPageContext.SelectedItems): case nameof(IContentPageContext.PageType): OnPropertyChanged(nameof(IsExecutable)); break; } } } }