diff --git a/src/modules/cmdpal/WindowsCommandPalette/ListItemViewModel.cs b/src/modules/cmdpal/WindowsCommandPalette/ListItemViewModel.cs index b2daba4800..91cc77074d 100644 --- a/src/modules/cmdpal/WindowsCommandPalette/ListItemViewModel.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/ListItemViewModel.cs @@ -24,9 +24,9 @@ public sealed class ListItemViewModel : INotifyPropertyChanged, IDisposable internal string Icon { get; private set; } - internal Lazy _Details; + private readonly Lazy _details; - internal DetailsViewModel? Details => _Details.Value; + internal DetailsViewModel? Details => _details.Value; public event PropertyChangedEventHandler? PropertyChanged; @@ -70,7 +70,7 @@ public sealed class ListItemViewModel : INotifyPropertyChanged, IDisposable internal bool HasMoreCommands => AllCommands.Any(); - internal TagViewModel[] Tags = []; + public TagViewModel[] Tags { get; set; } = []; internal bool HasTags => Tags.Length > 0; @@ -111,7 +111,7 @@ public sealed class ListItemViewModel : INotifyPropertyChanged, IDisposable this.Tags = model.Tags.Select(t => new TagViewModel(t)).ToArray(); } - this._Details = new(() => + this._details = new(() => { try { diff --git a/src/modules/cmdpal/WindowsCommandPalette/Microsoft.CmdPal.UI.Poc.csproj b/src/modules/cmdpal/WindowsCommandPalette/Microsoft.CmdPal.UI.Poc.csproj index ca34349b39..c54f812f98 100644 --- a/src/modules/cmdpal/WindowsCommandPalette/Microsoft.CmdPal.UI.Poc.csproj +++ b/src/modules/cmdpal/WindowsCommandPalette/Microsoft.CmdPal.UI.Poc.csproj @@ -9,7 +9,6 @@ true enable enable - False diff --git a/src/modules/cmdpal/WindowsCommandPalette/Services/ExtensionService.cs b/src/modules/cmdpal/WindowsCommandPalette/Services/ExtensionService.cs index fdd5db25bb..038b6216c7 100644 --- a/src/modules/cmdpal/WindowsCommandPalette/Services/ExtensionService.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Services/ExtensionService.cs @@ -125,7 +125,7 @@ public class ExtensionService : IExtensionService, IDisposable return false; } - private static async Task<(IPropertySet?, List)> GetCmdPalExtensionPropertiesAsync(AppExtension extension) + private static async Task<(IPropertySet? CmdPalProvider, List ClassIds)> GetCmdPalExtensionPropertiesAsync(AppExtension extension) { var classIds = new List(); var properties = await extension.GetExtensionPropertiesAsync(); diff --git a/src/modules/cmdpal/WindowsCommandPalette/TagViewModel.cs b/src/modules/cmdpal/WindowsCommandPalette/TagViewModel.cs index 4baa219a20..5b1678069e 100644 --- a/src/modules/cmdpal/WindowsCommandPalette/TagViewModel.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/TagViewModel.cs @@ -12,11 +12,11 @@ namespace DeveloperCommandPalette; public sealed class TagViewModel : INotifyPropertyChanged { - internal ITag Tag; + private readonly ITag _tag; - internal IconDataType Icon => Tag.Icon; + internal IconDataType Icon => _tag.Icon; - internal string Text => Tag.Text; + internal string Text => _tag.Text; public event PropertyChangedEventHandler? PropertyChanged; @@ -25,15 +25,15 @@ public sealed class TagViewModel : INotifyPropertyChanged internal IconElement IcoElement => Microsoft.Terminal.UI.IconPathConverter.IconMUX(Icon?.Icon ?? string.Empty, 10); // TODO! VV These guys should have proper theme-aware lookups for default values - internal Brush BorderBrush => new SolidColorBrush(Tag.Color); + internal Brush BorderBrush => new SolidColorBrush(_tag.Color); - internal Brush TextBrush => new SolidColorBrush(Tag.Color.A == 0 ? Color.FromArgb(255, 255, 255, 255) : Tag.Color); + internal Brush TextBrush => new SolidColorBrush(_tag.Color.A == 0 ? Color.FromArgb(255, 255, 255, 255) : _tag.Color); - internal Brush BackgroundBrush => new SolidColorBrush(Tag.Color.A == 0 ? Tag.Color : Color.FromArgb((byte)(Tag.Color.A / 4), Tag.Color.R, Tag.Color.G, Tag.Color.B)); + internal Brush BackgroundBrush => new SolidColorBrush(_tag.Color.A == 0 ? _tag.Color : Color.FromArgb((byte)(_tag.Color.A / 4), _tag.Color.R, _tag.Color.G, _tag.Color.B)); public TagViewModel(ITag tag) { - this.Tag = tag; + this._tag = tag; // this.Tag.PropChanged += Tag_PropertyChanged; } diff --git a/src/modules/cmdpal/WindowsCommandPalette/Views/FormPageViewModel.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/Views/FormPageViewModel.xaml.cs index 78a952b514..6be6722daa 100644 --- a/src/modules/cmdpal/WindowsCommandPalette/Views/FormPageViewModel.xaml.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Views/FormPageViewModel.xaml.cs @@ -12,7 +12,7 @@ public sealed class FormPageViewModel : PageViewModel { internal IFormPage Page => (IFormPage)this.PageAction; - internal ObservableCollection Forms = new(); + public ObservableCollection Forms { get; set; } = new(); public FormPageViewModel(IFormPage page) : base(page) diff --git a/src/modules/cmdpal/WindowsCommandPalette/Views/ListPageViewModel.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/Views/ListPageViewModel.xaml.cs index 9ac4ec07d7..34fe9d25f5 100644 --- a/src/modules/cmdpal/WindowsCommandPalette/Views/ListPageViewModel.xaml.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Views/ListPageViewModel.xaml.cs @@ -13,8 +13,9 @@ namespace WindowsCommandPalette.Views; public sealed class ListPageViewModel : PageViewModel { - internal readonly ObservableCollection Items = []; - internal readonly ObservableCollection FilteredItems = []; + private readonly ObservableCollection _items = []; + + public ObservableCollection FilteredItems { get; set; } = []; internal IListPage Page => (IListPage)this.PageAction; @@ -92,7 +93,7 @@ public sealed class ListPageViewModel : PageViewModel // FilteredItems.Add(sectionItems); } - ListHelpers.InPlaceUpdateList(Items, newItems); + ListHelpers.InPlaceUpdateList(_items, newItems); ListHelpers.InPlaceUpdateList(FilteredItems, newItems); } @@ -114,7 +115,7 @@ public sealed class ListPageViewModel : PageViewModel // Static lists don't need to re-fetch the items if (string.IsNullOrEmpty(query)) { - return Items; + return _items; } //// TODO! Probably bad that this turns list view models into listitems back to NEW view models @@ -122,7 +123,7 @@ public sealed class ListPageViewModel : PageViewModel try { var allFilteredItems = ListHelpers.FilterList( - Items + _items .SelectMany(section => section) .Select(vm => vm.ListItem.Unsafe), _query).Select(li => new ListItemViewModel(li)); diff --git a/src/modules/cmdpal/WindowsCommandPalette/Views/MainPage.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/Views/MainPage.xaml.cs index 2034382439..eaa6553428 100644 --- a/src/modules/cmdpal/WindowsCommandPalette/Views/MainPage.xaml.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Views/MainPage.xaml.cs @@ -281,11 +281,11 @@ public sealed partial class MainPage : Page } } - private async Task LoadTopLevelCommandsFromProvider(CommandProviderWrapper CommandProvider) + private async Task LoadTopLevelCommandsFromProvider(CommandProviderWrapper commandProvider) { // TODO! do this better async - await CommandProvider.LoadTopLevelCommands().ConfigureAwait(false); - foreach (var i in CommandProvider.TopLevelItems) + await commandProvider.LoadTopLevelCommands().ConfigureAwait(false); + foreach (var i in commandProvider.TopLevelItems) { ViewModel.TopLevelCommands.Add(new(i)); }