mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +02:00
CmdPal: fix content on extension settings (#40794)
Regressed in one of the #40113 prs. The Core.VM.PageViewModelFactory didn't actually know how to make a ContentPage, because Core can't handle a FormContent. But really, the CommandSettingsViewModel shouldn't have ever been in the .Core namespace, nor should it have used the ContentPageViewModel. To prevent future mistakes like this, * I got rid of `Core.ViewModels/PageViewModelFactory`, cause we didn't need it. * I made `ContentPageViewModel` abstract, to prevent you from trying to instantiate it Closes #40778
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user