/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App/Actions/Content/PlayAllAction.cs
56 строк
1 KB
yair100
Fix: Enabled Play action for single media file selection (#18520)
27 май 2026, 19:26
Не верифицирован
27 май 2026, 19:26
48e97f2
Код
Авторство
О чём код?
// Copyright (c) Files Community // Licensed under the MIT License. using Files.Shared.Helpers; namespace Files.App.Actions { [GeneratedRichCommand] internal sealed partial class PlayAllAction : ObservableObject, IAction { private readonly IContentPageContext context; public string Label => context.SelectedItems.Count > 1 ? Strings.PlayAll.GetLocalizedResource() : Strings.Play.GetLocalizedResource(); public string Description => Strings.PlayAllDescription.GetLocalizedResource(); public ActionCategory Category => ActionCategory.Media; public RichGlyph Glyph => new("\uE768"); public bool IsExecutable => context.PageType != ContentPageTypes.RecycleBin && context.SelectedItems.Count > 0 && context.SelectedItems.All(item => FileExtensionHelpers.IsMediaFile(item.FileExtension)); public PlayAllAction() { context = Ioc.Default.GetRequiredService<IContentPageContext>(); context.PropertyChanged += Context_PropertyChanged; } public Task ExecuteAsync(object? parameter = null) { return NavigationHelpers.OpenSelectedItemsAsync(context.ShellPage!); } private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e) { switch (e.PropertyName) { case nameof(IContentPageContext.PageType): case nameof(IContentPageContext.SelectedItems): OnPropertyChanged(nameof(IsExecutable)); OnPropertyChanged(nameof(Label)); break; } } } }