/
githubmirror
/
PowerToys
Обзор
Документация
Войти
/
githubmirror
/
PowerToys
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/CommandPaletteContentPageViewModel.cs
29 строк
1 KB
Jiří Polášek
CmdPal: Plain text viewer and image viewer IContent (#43964)
28 мар 2026, 02:45
Не верифицирован
28 мар 2026, 02:45
4cb3359
Код
Авторство
О чём код?
// 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, ICommandProviderContext 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), IPlainTextContent plainText => new ContentPlainTextViewModel(plainText, context), IImageContent image => new ContentImageViewModel(image, context), _ => null, }; return viewModel; } }