mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 11:16:51 +02:00
36 lines
1.5 KiB
C#
36 lines
1.5 KiB
C#
|
|
// 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 System.Globalization;
|
|||
|
|
using System.Text;
|
|||
|
|
using Microsoft.CmdPal.Ext.WebSearch.Helpers;
|
|||
|
|
using Microsoft.CmdPal.Ext.WebSearch.Properties;
|
|||
|
|
using Microsoft.CommandPalette.Extensions.Toolkit;
|
|||
|
|
using BrowserInfo = Microsoft.CmdPal.Ext.WebSearch.Helpers.DefaultBrowserInfo;
|
|||
|
|
|
|||
|
|
namespace Microsoft.CmdPal.Ext.WebSearch.Commands;
|
|||
|
|
|
|||
|
|
internal sealed partial class FallbackExecuteSearchItem : FallbackCommandItem
|
|||
|
|
{
|
|||
|
|
private readonly SearchWebCommand _executeItem;
|
|||
|
|
private static readonly CompositeFormat PluginOpen = System.Text.CompositeFormat.Parse(Properties.Resources.plugin_open);
|
|||
|
|
|
|||
|
|
public FallbackExecuteSearchItem(SettingsManager settings)
|
|||
|
|
: base(new SearchWebCommand(string.Empty, settings), Resources.command_item_title)
|
|||
|
|
{
|
|||
|
|
_executeItem = (SearchWebCommand)this.Command!;
|
|||
|
|
Title = string.Empty;
|
|||
|
|
_executeItem.Name = string.Empty;
|
|||
|
|
Subtitle = string.Format(CultureInfo.CurrentCulture, PluginOpen, BrowserInfo.Name ?? BrowserInfo.MSEdgeName);
|
|||
|
|
Icon = IconHelpers.FromRelativePath("Assets\\WebSearch.png");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public override void UpdateQuery(string query)
|
|||
|
|
{
|
|||
|
|
_executeItem.Arguments = query;
|
|||
|
|
_executeItem.Name = string.IsNullOrEmpty(query) ? string.Empty : Properties.Resources.open_in_default_browser;
|
|||
|
|
Title = query;
|
|||
|
|
}
|
|||
|
|
}
|