forked from microsoft/PowerToys
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial draft of the winget extension (#356)
_targets #355_, which I need for improvements to messages * [x] The initial package load takes a long time. This is pretty much unavoidable, but we do it on cmdpal startup, so anything after about 12s should be snappy * [x] I cannot for the life of me get `FindPackagesAsync`, to be async. The call always ends up running synchronously, so I can't hook up the `operation.Completed` event, nor the cancellation. The action is already complete! - this is probably blocking, because we still end up doing a search on most keystrokes, so we only get the final results after all the intermediate ones are done. - Just pasting a search though? Just as snappy as you'd hope. - Ahahahaha it wasn't me: [microsoft/winget-cli#5151](microsoft/winget-cli#5151) - ✅ manually wrapping this in a BG thread made it better * [ ] We probably shouldn't make the default action for an installed package "Uninstall". - Probably want to shunt over to the Settings app for the package - We probably want to do the thing where the second command doesn't show up if it's a separator - Punt? punt * [x] We need to add more metadata in the details for packages. We have it, if only we could show it: #95 - This will be a follow-up * [ ] This needs localization too * I'm using the `1.10-preview` of the winget com interfaces. On my framework laptop at least, the `RefreshPackageCatalogAsync` API isn't yet implemented, so I need to test that * [x] I don't think we implemented `MoreCommands` being observable in the host yet. We should. - Punted, #360 * [ ] I probably also need to check if other APIs we're using exist or not * [x] I haven't tested situations that like, need you to accept a license? Installing `nano` and the NanoLeaf app both _just work_. - Punted?
- Loading branch information
1 parent
4d464bc
commit 8f95341
Showing
37 changed files
with
1,669 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/DetailsDataViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// The Microsoft Corporation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Microsoft.CmdPal.Extensions; | ||
using Microsoft.CmdPal.UI.ViewModels.Models; | ||
|
||
namespace Microsoft.CmdPal.UI.ViewModels; | ||
|
||
public abstract partial class DetailsDataViewModel(IPageContext context) : ExtensionObjectViewModel(context) | ||
{ | ||
} |
27 changes: 27 additions & 0 deletions
27
src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/DetailsElementViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// The Microsoft Corporation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Microsoft.CmdPal.Extensions; | ||
using Microsoft.CmdPal.UI.ViewModels.Models; | ||
|
||
namespace Microsoft.CmdPal.UI.ViewModels; | ||
|
||
public abstract partial class DetailsElementViewModel(IDetailsElement _detailsElement, IPageContext context) : ExtensionObjectViewModel(context) | ||
{ | ||
private readonly ExtensionObject<IDetailsElement> _model = new(_detailsElement); | ||
|
||
public string Key { get; private set; } = string.Empty; | ||
|
||
public override void InitializeProperties() | ||
{ | ||
var model = _model.Unsafe; | ||
if (model == null) | ||
{ | ||
return; | ||
} | ||
|
||
Key = model.Key ?? string.Empty; | ||
UpdateProperty(nameof(Key)); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/DetailsLinkViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// The Microsoft Corporation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Microsoft.CmdPal.Extensions; | ||
using Microsoft.CmdPal.UI.ViewModels.Models; | ||
|
||
namespace Microsoft.CmdPal.UI.ViewModels; | ||
|
||
public partial class DetailsLinkViewModel( | ||
IDetailsElement _detailsElement, | ||
IPageContext context) : DetailsElementViewModel(_detailsElement, context) | ||
{ | ||
private readonly ExtensionObject<IDetailsLink> _dataModel = | ||
new(_detailsElement.Data as IDetailsLink); | ||
|
||
public string Text { get; private set; } = string.Empty; | ||
|
||
public Uri? Link { get; private set; } | ||
|
||
public bool IsLink => Link != null; | ||
|
||
public bool IsText => !IsLink; | ||
|
||
public override void InitializeProperties() | ||
{ | ||
base.InitializeProperties(); | ||
var model = _dataModel.Unsafe; | ||
if (model == null) | ||
{ | ||
return; | ||
} | ||
|
||
Text = model.Text ?? string.Empty; | ||
Link = model.Link; | ||
UpdateProperty(nameof(Text)); | ||
UpdateProperty(nameof(Link)); | ||
UpdateProperty(nameof(IsLink)); | ||
UpdateProperty(nameof(IsText)); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/DetailsSeparatorViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// The Microsoft Corporation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Microsoft.CmdPal.Extensions; | ||
using Microsoft.CmdPal.UI.ViewModels.Models; | ||
|
||
namespace Microsoft.CmdPal.UI.ViewModels; | ||
|
||
public partial class DetailsSeparatorViewModel( | ||
IDetailsElement _detailsElement, | ||
IPageContext context) : DetailsElementViewModel(_detailsElement, context) | ||
{ | ||
private readonly ExtensionObject<IDetailsSeparator> _dataModel = | ||
new(_detailsElement.Data as IDetailsSeparator); | ||
|
||
public override void InitializeProperties() | ||
{ | ||
base.InitializeProperties(); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/DetailsTagsViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// The Microsoft Corporation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Microsoft.CmdPal.Extensions; | ||
using Microsoft.CmdPal.UI.ViewModels.Models; | ||
|
||
namespace Microsoft.CmdPal.UI.ViewModels; | ||
|
||
public partial class DetailsTagsViewModel( | ||
IDetailsElement _detailsElement, | ||
IPageContext context) : DetailsElementViewModel(_detailsElement, context) | ||
{ | ||
private readonly ExtensionObject<IDetailsTags> _dataModel = | ||
new(_detailsElement.Data as IDetailsTags); | ||
|
||
public override void InitializeProperties() | ||
{ | ||
base.InitializeProperties(); | ||
var model = _dataModel.Unsafe; | ||
if (model == null) | ||
{ | ||
return; | ||
} | ||
|
||
// TODO! | ||
} | ||
} |
Oops, something went wrong.
8f95341
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@check-spelling-bot Report
🔴 Please review
See the 📜action log or 📝 job summary for details.
Unrecognized words (1)
TOOD
To accept these unrecognized words as correct, you could run the following commands
... in a clone of the [email protected]:zadjii-msft/PowerToys.git repository
on the
main
branch (ℹ️ how do I use this?):Errors (1)
See the 📜action log or 📝 job summary for details.
See ❌ Event descriptions for more information.
If the flagged items are 🤯 false positives
If items relate to a ...
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txt
file matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^
refers to the file's path from the root of the repository, so^README\.md$
would exclude README.md (on whichever branch you're using).well-formed pattern.
If you can write a pattern that would match it,
try adding it to the
patterns.txt
file.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.