diff --git a/src/modules/cmdpal/Microsoft.CmdPal.Core.ViewModels/ContentPageViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.Core.ViewModels/ContentPageViewModel.cs index 16611a31ac..a6bd2bb302 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.Core.ViewModels/ContentPageViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.Core.ViewModels/ContentPageViewModel.cs @@ -14,7 +14,7 @@ using Microsoft.CommandPalette.Extensions.Toolkit; namespace Microsoft.CmdPal.Core.ViewModels; -public partial class ContentPageViewModel : PageViewModel, ICommandBarContext +public abstract partial class ContentPageViewModel : PageViewModel, ICommandBarContext { private readonly ExtensionObject _model; diff --git a/src/modules/cmdpal/Microsoft.CmdPal.Core.ViewModels/PageViewModelFactory.cs b/src/modules/cmdpal/Microsoft.CmdPal.Core.ViewModels/PageViewModelFactory.cs deleted file mode 100644 index a30a2bd76b..0000000000 --- a/src/modules/cmdpal/Microsoft.CmdPal.Core.ViewModels/PageViewModelFactory.cs +++ /dev/null @@ -1,27 +0,0 @@ -// 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.Core.ViewModels; - -public class PageViewModelFactory : IPageViewModelFactoryService -{ - private readonly TaskScheduler _scheduler; - - public PageViewModelFactory(TaskScheduler scheduler) - { - _scheduler = scheduler; - } - - public PageViewModel? TryCreatePageViewModel(IPage page, bool nested, AppExtensionHost host) - { - return page switch - { - IListPage listPage => new ListViewModel(listPage, _scheduler, host) { IsNested = nested }, - IContentPage contentPage => new ContentPageViewModel(contentPage, _scheduler, host), - _ => null, - }; - } -} diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/CommandSettingsViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/CommandSettingsViewModel.cs index a23cb4621e..5709a643cb 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/CommandSettingsViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/CommandSettingsViewModel.cs @@ -3,11 +3,11 @@ // See the LICENSE file in the project root for more information. using ManagedCommon; +using Microsoft.CmdPal.Core.ViewModels; using Microsoft.CmdPal.Core.ViewModels.Models; -using Microsoft.CmdPal.UI.ViewModels; using Microsoft.CommandPalette.Extensions; -namespace Microsoft.CmdPal.Core.ViewModels; +namespace Microsoft.CmdPal.UI.ViewModels; public partial class CommandSettingsViewModel(ICommandSettings? _unsafeSettings, CommandProviderWrapper provider, TaskScheduler mainThread) { @@ -29,9 +29,9 @@ public partial class CommandSettingsViewModel(ICommandSettings? _unsafeSettings, return; } - if (model.SettingsPage is IContentPage page) + if (model.SettingsPage != null) { - SettingsPage = new(page, mainThread, provider.ExtensionHost); + SettingsPage = new CommandPaletteContentPageViewModel(model.SettingsPage, mainThread, provider.ExtensionHost); SettingsPage.InitializeProperties(); } }