/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App/Actions/Git/GitInitAction.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] sealed partial class GitInitAction : ObservableObject, IAction { private readonly IContentPageContext _context; public string Label => Strings.InitRepo.GetLocalizedResource(); public string Description => Strings.InitRepoDescription.GetLocalizedResource(); public ActionCategory Category => ActionCategory.Git; public bool IsExecutable => _context.Folder is not null && _context.Folder.ItemPath != SystemIO.Path.GetPathRoot(_context.Folder.ItemPath) && !_context.IsGitRepository; public GitInitAction() { _context = Ioc.Default.GetRequiredService<IContentPageContext>(); _context.PropertyChanged += Context_PropertyChanged; } public Task ExecuteAsync(object? parameter = null) { return GitHelpers.InitializeRepositoryAsync(_context.Folder?.ItemPath); } private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e) { switch (e.PropertyName) { case nameof(IContentPageContext.Folder): case nameof(IContentPageContext.IsGitRepository): OnPropertyChanged(nameof(IsExecutable)); break; } } } }