/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App/Actions/Git/GitCloneAction.cs
51 строка
2 KB
yair100
Code Quality: Updated headers
01 июл 2026, 06:18
01 июл 2026, 06:18
c27305a
Код
Авторство
О чём код?
// Copyright (c) Files Community // SPDX-License-Identifier: MPL-2.0 namespace Files.App.Actions { [GeneratedRichCommand] internal sealed partial class GitCloneAction : ObservableObject, IAction { private readonly IContentPageContext pageContext = Ioc.Default.GetRequiredService<IContentPageContext>(); private readonly IDialogService dialogService = Ioc.Default.GetRequiredService<IDialogService>(); public string Label { get; } = Strings.Clone.GetLocalizedResource(); public string Description { get; } = Strings.GitCloneDescription.GetLocalizedResource(); public ActionCategory Category => ActionCategory.Git; public bool IsExecutable => pageContext.CanCreateItem && !pageContext.IsGitRepository; public RichGlyph Glyph => new(themedIconStyle: "App.ThemedIcons.Git"); public GitCloneAction() { pageContext.PropertyChanged += Context_PropertyChanged; } public Task ExecuteAsync(object? parameter = null) { if (pageContext.ShellPage is null) return Task.CompletedTask; var repoUrl = parameter?.ToString() ?? string.Empty; var viewModel = new CloneRepoDialogViewModel(repoUrl, pageContext.ShellPage.ShellViewModel.WorkingDirectory); return dialogService.ShowDialogAsync(viewModel); } private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e) { switch (e.PropertyName) { case nameof(IContentPageContext.CanCreateItem): case nameof(IContentPageContext.IsGitRepository): OnPropertyChanged(nameof(IsExecutable)); break; } } } }