remove this unneeded nonsense

This commit is contained in:
Mike Griese
2024-12-10 17:14:51 -06:00
parent 3aebd83847
commit 78e7134b93
4 changed files with 7 additions and 10 deletions

View File

@@ -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);

View File

@@ -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

View File

@@ -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);

View File

@@ -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...