mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-01-15 00:36:35 +01:00
remove this unneeded nonsense
This commit is contained in:
@@ -7,7 +7,7 @@ using Microsoft.CmdPal.UI.ViewModels.Models;
|
||||
|
||||
namespace Microsoft.CmdPal.UI.ViewModels;
|
||||
|
||||
public partial class CommandContextItemViewModel(ICommandContextItem contextItem, TaskScheduler scheduler, IPageContext context) : CommandItemViewModel(new(contextItem), scheduler, context)
|
||||
public partial class CommandContextItemViewModel(ICommandContextItem contextItem, IPageContext context) : CommandItemViewModel(new(contextItem), context)
|
||||
{
|
||||
private readonly ExtensionObject<ICommandContextItem> _contextItemModel = new(contextItem);
|
||||
|
||||
|
||||
@@ -12,8 +12,6 @@ public partial class CommandItemViewModel : ExtensionObjectViewModel
|
||||
{
|
||||
private readonly ExtensionObject<ICommandItem> _commandItemModel = new(null);
|
||||
|
||||
protected TaskScheduler Scheduler { get; private set; }
|
||||
|
||||
// These are properties that are "observable" from the extension object
|
||||
// itself, in the sense that they get raised by PropChanged events from the
|
||||
// extension. However, we don't want to actually make them
|
||||
@@ -44,7 +42,7 @@ public partial class CommandItemViewModel : ExtensionObjectViewModel
|
||||
var model = new CommandContextItem(command!)
|
||||
{
|
||||
};
|
||||
CommandContextItemViewModel defaultCommand = new(model, Scheduler, PageContext)
|
||||
CommandContextItemViewModel defaultCommand = new(model, PageContext)
|
||||
{
|
||||
Name = Name,
|
||||
Title = Name,
|
||||
@@ -60,11 +58,10 @@ public partial class CommandItemViewModel : ExtensionObjectViewModel
|
||||
}
|
||||
}
|
||||
|
||||
public CommandItemViewModel(ExtensionObject<ICommandItem> item, TaskScheduler scheduler, IPageContext errorContext)
|
||||
public CommandItemViewModel(ExtensionObject<ICommandItem> item, IPageContext errorContext)
|
||||
: base(errorContext)
|
||||
{
|
||||
_commandItemModel = item;
|
||||
Scheduler = scheduler;
|
||||
}
|
||||
|
||||
//// Called from ListViewModel on background thread started in ListPage.xaml.cs
|
||||
@@ -84,7 +81,7 @@ public partial class CommandItemViewModel : ExtensionObjectViewModel
|
||||
MoreCommands = model.MoreCommands
|
||||
.Where(contextItem => contextItem is ICommandContextItem)
|
||||
.Select(contextItem => (contextItem as ICommandContextItem)!)
|
||||
.Select(contextItem => new CommandContextItemViewModel(contextItem, Scheduler, PageContext))
|
||||
.Select(contextItem => new CommandContextItemViewModel(contextItem, PageContext))
|
||||
.ToList();
|
||||
|
||||
// Here, we're already theoretically in the async context, so we can
|
||||
|
||||
@@ -9,8 +9,8 @@ using Microsoft.CmdPal.UI.ViewModels.Models;
|
||||
|
||||
namespace Microsoft.CmdPal.UI.ViewModels;
|
||||
|
||||
public partial class ListItemViewModel(IListItem model, TaskScheduler scheduler, IPageContext context)
|
||||
: CommandItemViewModel(new(model), scheduler, context)
|
||||
public partial class ListItemViewModel(IListItem model, IPageContext context)
|
||||
: CommandItemViewModel(new(model), context)
|
||||
{
|
||||
private readonly ExtensionObject<IListItem> _listItemModel = new(model);
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ public partial class ListViewModel : PageViewModel
|
||||
foreach (var item in newItems)
|
||||
{
|
||||
// TODO: When we fetch next page of items or refreshed items, we may need to check if we have an existing ViewModel in the cache?
|
||||
ListItemViewModel viewModel = new(item, Scheduler, this);
|
||||
ListItemViewModel viewModel = new(item, this);
|
||||
viewModel.InitializeProperties();
|
||||
_itemCache.Add(viewModel); // TODO: Figure out when we clear/remove things from cache...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user