mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-24 04:00:02 +01:00
28 lines
1.0 KiB
C#
28 lines
1.0 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 Microsoft.CommandPalette.Extensions;
|
|
|
|
namespace Microsoft.CmdPal.UI.ViewModels;
|
|
|
|
public partial class CommandPaletteContentPageViewModel : ContentPageViewModel
|
|
{
|
|
public CommandPaletteContentPageViewModel(IContentPage model, TaskScheduler scheduler, AppExtensionHost host, CommandProviderContext providerContext)
|
|
: base(model, scheduler, host, providerContext)
|
|
{
|
|
}
|
|
|
|
public override ContentViewModel? ViewModelFromContent(IContent content, WeakReference<IPageContext> context)
|
|
{
|
|
ContentViewModel? viewModel = content switch
|
|
{
|
|
IFormContent form => new ContentFormViewModel(form, context),
|
|
IMarkdownContent markdown => new ContentMarkdownViewModel(markdown, context),
|
|
ITreeContent tree => new ContentTreeViewModel(tree, context),
|
|
_ => null,
|
|
};
|
|
return viewModel;
|
|
}
|
|
}
|