/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App/Actions/Open/OpenPropertiesAction.cs
90 строк
3 KB
yair100
Feature: Replaced Settings Dialog with page (#18410)
23 апр 2026, 23:59
Не верифицирован
23 апр 2026, 23:59
65e4bf8
Код
Авторство
О чём код?
// Copyright (c) Files Community // Licensed under the MIT License. namespace Files.App.Actions { [GeneratedRichCommand] internal sealed partial class OpenPropertiesAction : ObservableObject, IAction { private readonly IContentPageContext context; public string Label => Strings.OpenProperties.GetLocalizedResource(); public string Description => Strings.OpenPropertiesDescription.GetLocalizedResource(); public ActionCategory Category => ActionCategory.Open; public RichGlyph Glyph => new(themedIconStyle: "App.ThemedIcons.Properties"); public string AutomationId => "InnerNavigationToolbarPropertiesButton"; public string AccessKey => "O"; public HotKey HotKey => new(Keys.Enter, KeyModifiers.Alt); public bool IsExecutable => context.PageType is not ContentPageTypes.Home && context.PageType is not ContentPageTypes.ReleaseNotes && context.PageType is not ContentPageTypes.Settings && !(context.PageType is ContentPageTypes.SearchResults && !context.HasSelection); public OpenPropertiesAction() { context = Ioc.Default.GetRequiredService<IContentPageContext>(); context.PropertyChanged += Context_PropertyChanged; } public Task ExecuteAsync(object? parameter = null) { var page = context.ShellPage?.SlimContentPage; if (page?.ItemContextMenuFlyout.IsOpen ?? false) page.ItemContextMenuFlyout.Closed += OpenPropertiesFromItemContextMenuFlyout; else if (page?.BaseContextMenuFlyout.IsOpen ?? false) page.BaseContextMenuFlyout.Closed += OpenPropertiesFromBaseContextMenuFlyout; else FilePropertiesHelpers.OpenPropertiesWindow(context.ShellPage!); return Task.CompletedTask; } private void OpenPropertiesFromItemContextMenuFlyout(object? _, object e) { var page = context.ShellPage?.SlimContentPage; if (page is not null) page.ItemContextMenuFlyout.Closed -= OpenPropertiesFromItemContextMenuFlyout; FilePropertiesHelpers.OpenPropertiesWindow(context.ShellPage!); } private void OpenPropertiesFromBaseContextMenuFlyout(object? _, object e) { var page = context.ShellPage?.SlimContentPage; if (page is not null) page.BaseContextMenuFlyout.Closed -= OpenPropertiesFromBaseContextMenuFlyout; FilePropertiesHelpers.OpenPropertiesWindow(context.ShellPage!); } private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e) { switch (e.PropertyName) { case nameof(IContentPageContext.PageType): case nameof(IContentPageContext.HasSelection): case nameof(IContentPageContext.Folder): OnPropertyChanged(nameof(IsExecutable)); break; } } } }