/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App/Actions/Git/GitSyncAction.cs
46 строк
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 sealed partial class GitSyncAction : ObservableObject, IAction { private readonly IContentPageContext _context; public string Label { get; } = Strings.GitSync.GetLocalizedResource(); public string Description { get; } = Strings.GitSyncDescription.GetLocalizedResource(); public ActionCategory Category => ActionCategory.Git; public RichGlyph Glyph { get; } = new("\uEDAB"); public bool IsExecutable => _context.CanExecuteGitAction; public GitSyncAction() { _context = Ioc.Default.GetRequiredService<IContentPageContext>(); _context.PropertyChanged += Context_PropertyChanged; } public Task ExecuteAsync(object? parameter = null) { var instance = _context.ShellPage?.InstanceViewModel; return GitHelpers.PullOriginAsync(instance?.GitRepositoryPath) .ContinueWith(t => GitHelpers.PushToOriginAsync( instance?.GitRepositoryPath, instance?.GitBranchName)); } private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e) { if (e.PropertyName is nameof(IContentPageContext.CanExecuteGitAction)) OnPropertyChanged(nameof(IsExecutable)); } } }