/
githubmirror
/
PowerToys
Обзор
Документация
Войти
/
githubmirror
/
PowerToys
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Shell/Commands/OpenUrlWithHistoryCommand.cs
43 строки
1 KB
Michael Jolley
CmdPal: Removing Core projects (#45693)
23 фев 2026, 15:05
Не верифицирован
23 фев 2026, 15:05
138c66c
Код
Авторство
О чём код?
// Copyright (c) Microsoft Corporation // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using Microsoft.CmdPal.Common.Services; using Microsoft.CommandPalette.Extensions.Toolkit; namespace Microsoft.CmdPal.Ext.Shell; internal sealed partial class OpenUrlWithHistoryCommand : OpenUrlCommand { private readonly Action<string>? _addToHistory; private readonly string _url; private readonly ITelemetryService? _telemetryService; public OpenUrlWithHistoryCommand(string url, Action<string>? addToHistory = null, ITelemetryService? telemetryService = null) : base(url) { _addToHistory = addToHistory; _url = url; _telemetryService = telemetryService; } public override CommandResult Invoke() { _addToHistory?.Invoke(_url); var success = ShellHelpers.OpenInShell(_url); var isWebUrl = false; if (Uri.TryCreate(_url, UriKind.Absolute, out var uri)) { if (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps) { isWebUrl = true; } } _telemetryService?.LogOpenUri(_url, isWebUrl, success); return CommandResult.Dismiss(); } }