mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 11:16:51 +02:00
30 lines
973 B
C#
30 lines
973 B
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 Microsoft.CmdPal.Core.ViewModels;
|
||
|
|
using Microsoft.CmdPal.UI.ViewModels;
|
||
|
|
|
||
|
|
// To learn more about WinUI, the WinUI project structure,
|
||
|
|
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||
|
|
namespace Microsoft.CmdPal.UI;
|
||
|
|
|
||
|
|
internal sealed class PowerToysAppHostService : IAppHostService
|
||
|
|
{
|
||
|
|
public AppExtensionHost GetDefaultHost()
|
||
|
|
{
|
||
|
|
return CommandPaletteHost.Instance;
|
||
|
|
}
|
||
|
|
|
||
|
|
public AppExtensionHost GetHostForCommand(object? context, AppExtensionHost? currentHost)
|
||
|
|
{
|
||
|
|
AppExtensionHost? topLevelHost = null;
|
||
|
|
if (context is TopLevelViewModel topLevelViewModel)
|
||
|
|
{
|
||
|
|
topLevelHost = topLevelViewModel.ExtensionHost;
|
||
|
|
}
|
||
|
|
|
||
|
|
return topLevelHost ?? currentHost ?? CommandPaletteHost.Instance;
|
||
|
|
}
|
||
|
|
}
|