mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-01-12 07:16:44 +01:00
Merge pull request #49 from zadjii-msft/dev/crutkas/remainingErrors
resolving last errors
This commit is contained in:
@@ -24,9 +24,9 @@ public sealed class ListItemViewModel : INotifyPropertyChanged, IDisposable
|
||||
|
||||
internal string Icon { get; private set; }
|
||||
|
||||
internal Lazy<DetailsViewModel?> _Details;
|
||||
private readonly Lazy<DetailsViewModel?> _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
|
||||
{
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
<EnableMsixTooling>true</EnableMsixTooling>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -125,7 +125,7 @@ public class ExtensionService : IExtensionService, IDisposable
|
||||
return false;
|
||||
}
|
||||
|
||||
private static async Task<(IPropertySet?, List<string>)> GetCmdPalExtensionPropertiesAsync(AppExtension extension)
|
||||
private static async Task<(IPropertySet? CmdPalProvider, List<string> ClassIds)> GetCmdPalExtensionPropertiesAsync(AppExtension extension)
|
||||
{
|
||||
var classIds = new List<string>();
|
||||
var properties = await extension.GetExtensionPropertiesAsync();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public sealed class FormPageViewModel : PageViewModel
|
||||
{
|
||||
internal IFormPage Page => (IFormPage)this.PageAction;
|
||||
|
||||
internal ObservableCollection<FormViewModel> Forms = new();
|
||||
public ObservableCollection<FormViewModel> Forms { get; set; } = new();
|
||||
|
||||
public FormPageViewModel(IFormPage page)
|
||||
: base(page)
|
||||
|
||||
@@ -13,8 +13,9 @@ namespace WindowsCommandPalette.Views;
|
||||
|
||||
public sealed class ListPageViewModel : PageViewModel
|
||||
{
|
||||
internal readonly ObservableCollection<SectionInfoList> Items = [];
|
||||
internal readonly ObservableCollection<SectionInfoList> FilteredItems = [];
|
||||
private readonly ObservableCollection<SectionInfoList> _items = [];
|
||||
|
||||
public ObservableCollection<SectionInfoList> 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));
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user