diff --git a/.gitignore b/.gitignore index 89541c3a2e..66532cc074 100644 --- a/.gitignore +++ b/.gitignore @@ -224,7 +224,7 @@ ClientBin/ *.publishsettings orleans.codegen.cs -# Including strong name files can present a security risk +# Including strong name files can present a security risk # (https://github.com/github/gitignore/pull/2483#issue-259490424) #*.snk @@ -322,7 +322,7 @@ ImageResizer/tools/** # OpenCover UI analysis results OpenCover/ -# Azure Stream Analytics local run output +# Azure Stream Analytics local run output ASALocalRun/ # MSBuild Binary and Structured Log @@ -331,7 +331,7 @@ ASALocalRun/ # NVidia Nsight GPU debugger configuration file *.nvuser -# MFractors (Xamarin productivity tool) working folder +# MFractors (Xamarin productivity tool) working folder .mfractor/ # Temp build files diff --git a/src/modules/cmdpal/.gitignore b/src/modules/cmdpal/.gitignore index 5bb04dd16c..062f40d6fd 100644 --- a/src/modules/cmdpal/.gitignore +++ b/src/modules/cmdpal/.gitignore @@ -1,398 +1,5 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore -# User-specific files -*.rsuser -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Mono auto generated files -mono_crash.* - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -[Ww][Ii][Nn]32/ -[Aa][Rr][Mm]/ -[Aa][Rr][Mm]64/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ -[Ll]ogs/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUnit -*.VisualState.xml -TestResult.xml -nunit-*.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ - -# ASP.NET Scaffolding -ScaffoldingReadMe.txt - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_h.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*_wpftmp.csproj -*.log -*.tlog -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Coverlet is a free, cross platform Code Coverage Tool -coverage*.json -coverage*.xml -coverage*.info - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# NuGet Symbol Packages -*.snupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx -*.appxbundle -*.appxupload - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!?*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser -*- [Bb]ackup.rdl -*- [Bb]ackup ([0-9]).rdl -*- [Bb]ackup ([0-9][0-9]).rdl - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio 6 auto-generated project file (contains which files were open etc.) -*.vbp - -# Visual Studio 6 workspace and project file (working project files containing files to include in project) -*.dsw -*.dsp - -# Visual Studio 6 technical files -*.ncb -*.aps - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# CodeRush personal settings -.cr/personal - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - -# Local History for Visual Studio -.localhistory/ - -# Visual Studio History (VSHistory) files -.vshistory/ - -# BeatPulse healthcheck temp database -healthchecksdb - -# Backup folder for Package Reference Convert tool in Visual Studio 2017 -MigrationBackup/ - -# Ionide (cross platform F# VS Code tools) working folder -.ionide/ - -# Fody - auto-generated XML schema -FodyWeavers.xsd - -# VS Code files for those working on multiple tools -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -*.code-workspace - -# Local History for Visual Studio Code -.history/ - -# Windows Installer files from build outputs -*.cab -*.msi -*.msix -*.msixbundle -*.msm -*.msp - -# JetBrains Rider -*.sln.iml \ No newline at end of file +# Allow launchSettings.json in the Properties folder to be committed to source +# control. This overrides the one in the root .gitignore, because all the cmdpal +# projects will explode without this file +!**/Properties/launchSettings.json diff --git a/src/modules/cmdpal/extensions/HackerNewsExtension/Assets/LockScreenLogo.scale-200.png b/src/modules/cmdpal/Exts/HackerNewsExtension/Assets/LockScreenLogo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/HackerNewsExtension/Assets/LockScreenLogo.scale-200.png rename to src/modules/cmdpal/Exts/HackerNewsExtension/Assets/LockScreenLogo.scale-200.png diff --git a/src/modules/cmdpal/extensions/HackerNewsExtension/Assets/SplashScreen.scale-200.png b/src/modules/cmdpal/Exts/HackerNewsExtension/Assets/SplashScreen.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/HackerNewsExtension/Assets/SplashScreen.scale-200.png rename to src/modules/cmdpal/Exts/HackerNewsExtension/Assets/SplashScreen.scale-200.png diff --git a/src/modules/cmdpal/extensions/HackerNewsExtension/Assets/Square150x150Logo.scale-200.png b/src/modules/cmdpal/Exts/HackerNewsExtension/Assets/Square150x150Logo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/HackerNewsExtension/Assets/Square150x150Logo.scale-200.png rename to src/modules/cmdpal/Exts/HackerNewsExtension/Assets/Square150x150Logo.scale-200.png diff --git a/src/modules/cmdpal/extensions/HackerNewsExtension/Assets/Square44x44Logo.scale-200.png b/src/modules/cmdpal/Exts/HackerNewsExtension/Assets/Square44x44Logo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/HackerNewsExtension/Assets/Square44x44Logo.scale-200.png rename to src/modules/cmdpal/Exts/HackerNewsExtension/Assets/Square44x44Logo.scale-200.png diff --git a/src/modules/cmdpal/extensions/HackerNewsExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/src/modules/cmdpal/Exts/HackerNewsExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png similarity index 100% rename from src/modules/cmdpal/extensions/HackerNewsExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png rename to src/modules/cmdpal/Exts/HackerNewsExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png diff --git a/src/modules/cmdpal/extensions/HackerNewsExtension/Assets/StoreLogo.png b/src/modules/cmdpal/Exts/HackerNewsExtension/Assets/StoreLogo.png similarity index 100% rename from src/modules/cmdpal/extensions/HackerNewsExtension/Assets/StoreLogo.png rename to src/modules/cmdpal/Exts/HackerNewsExtension/Assets/StoreLogo.png diff --git a/src/modules/cmdpal/extensions/HackerNewsExtension/Assets/Wide310x150Logo.scale-200.png b/src/modules/cmdpal/Exts/HackerNewsExtension/Assets/Wide310x150Logo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/HackerNewsExtension/Assets/Wide310x150Logo.scale-200.png rename to src/modules/cmdpal/Exts/HackerNewsExtension/Assets/Wide310x150Logo.scale-200.png diff --git a/src/modules/cmdpal/extensions/HackerNewsExtension/CommentAction.cs b/src/modules/cmdpal/Exts/HackerNewsExtension/CommentAction.cs similarity index 88% rename from src/modules/cmdpal/extensions/HackerNewsExtension/CommentAction.cs rename to src/modules/cmdpal/Exts/HackerNewsExtension/CommentAction.cs index 6f0b19267d..77a0d89f1c 100644 --- a/src/modules/cmdpal/extensions/HackerNewsExtension/CommentAction.cs +++ b/src/modules/cmdpal/Exts/HackerNewsExtension/CommentAction.cs @@ -18,9 +18,9 @@ internal sealed class CommentAction : InvokableCommand Icon = new("\ue8f2"); // chat bubbles } - public override ActionResult Invoke() + public override CommandResult Invoke() { Process.Start(new ProcessStartInfo(_post.CommentsLink) { UseShellExecute = true }); - return ActionResult.KeepOpen(); + return CommandResult.KeepOpen(); } } diff --git a/src/modules/cmdpal/extensions/HackerNewsExtension/HackerNewsActionsProvider.cs b/src/modules/cmdpal/Exts/HackerNewsExtension/HackerNewsActionsProvider.cs similarity index 100% rename from src/modules/cmdpal/extensions/HackerNewsExtension/HackerNewsActionsProvider.cs rename to src/modules/cmdpal/Exts/HackerNewsExtension/HackerNewsActionsProvider.cs diff --git a/src/modules/cmdpal/extensions/HackerNewsExtension/HackerNewsExtension.csproj b/src/modules/cmdpal/Exts/HackerNewsExtension/HackerNewsExtension.csproj similarity index 100% rename from src/modules/cmdpal/extensions/HackerNewsExtension/HackerNewsExtension.csproj rename to src/modules/cmdpal/Exts/HackerNewsExtension/HackerNewsExtension.csproj diff --git a/src/modules/cmdpal/extensions/HackerNewsExtension/HackerNewsPage.cs b/src/modules/cmdpal/Exts/HackerNewsExtension/HackerNewsPage.cs similarity index 100% rename from src/modules/cmdpal/extensions/HackerNewsExtension/HackerNewsPage.cs rename to src/modules/cmdpal/Exts/HackerNewsExtension/HackerNewsPage.cs diff --git a/src/modules/cmdpal/extensions/HackerNewsExtension/LinkAction.cs b/src/modules/cmdpal/Exts/HackerNewsExtension/LinkAction.cs similarity index 88% rename from src/modules/cmdpal/extensions/HackerNewsExtension/LinkAction.cs rename to src/modules/cmdpal/Exts/HackerNewsExtension/LinkAction.cs index 6d3c1a9a35..bb64321122 100644 --- a/src/modules/cmdpal/extensions/HackerNewsExtension/LinkAction.cs +++ b/src/modules/cmdpal/Exts/HackerNewsExtension/LinkAction.cs @@ -18,9 +18,9 @@ internal sealed class LinkAction : InvokableCommand this.Icon = new("\uE8A7"); } - public override ActionResult Invoke() + public override CommandResult Invoke() { Process.Start(new ProcessStartInfo(_post.Link) { UseShellExecute = true }); - return ActionResult.KeepOpen(); + return CommandResult.KeepOpen(); } } diff --git a/src/modules/cmdpal/extensions/HackerNewsExtension/NewsPost.cs b/src/modules/cmdpal/Exts/HackerNewsExtension/NewsPost.cs similarity index 100% rename from src/modules/cmdpal/extensions/HackerNewsExtension/NewsPost.cs rename to src/modules/cmdpal/Exts/HackerNewsExtension/NewsPost.cs diff --git a/src/modules/cmdpal/extensions/HackerNewsExtension/Package.appxmanifest b/src/modules/cmdpal/Exts/HackerNewsExtension/Package.appxmanifest similarity index 100% rename from src/modules/cmdpal/extensions/HackerNewsExtension/Package.appxmanifest rename to src/modules/cmdpal/Exts/HackerNewsExtension/Package.appxmanifest diff --git a/src/modules/cmdpal/extensions/HackerNewsExtension/Program.cs b/src/modules/cmdpal/Exts/HackerNewsExtension/Program.cs similarity index 100% rename from src/modules/cmdpal/extensions/HackerNewsExtension/Program.cs rename to src/modules/cmdpal/Exts/HackerNewsExtension/Program.cs diff --git a/src/modules/cmdpal/extensions/HackerNewsExtension/Properties/PublishProfiles/win-arm64.pubxml b/src/modules/cmdpal/Exts/HackerNewsExtension/Properties/PublishProfiles/win-arm64.pubxml similarity index 100% rename from src/modules/cmdpal/extensions/HackerNewsExtension/Properties/PublishProfiles/win-arm64.pubxml rename to src/modules/cmdpal/Exts/HackerNewsExtension/Properties/PublishProfiles/win-arm64.pubxml diff --git a/src/modules/cmdpal/extensions/HackerNewsExtension/Properties/PublishProfiles/win-x64.pubxml b/src/modules/cmdpal/Exts/HackerNewsExtension/Properties/PublishProfiles/win-x64.pubxml similarity index 89% rename from src/modules/cmdpal/extensions/HackerNewsExtension/Properties/PublishProfiles/win-x64.pubxml rename to src/modules/cmdpal/Exts/HackerNewsExtension/Properties/PublishProfiles/win-x64.pubxml index d7548ab0a8..2c790532c6 100644 --- a/src/modules/cmdpal/extensions/HackerNewsExtension/Properties/PublishProfiles/win-x64.pubxml +++ b/src/modules/cmdpal/Exts/HackerNewsExtension/Properties/PublishProfiles/win-x64.pubxml @@ -13,6 +13,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121. False True False - True + False - \ No newline at end of file + diff --git a/src/modules/cmdpal/extensions/HackerNewsExtension/Properties/launchSettings.json b/src/modules/cmdpal/Exts/HackerNewsExtension/Properties/launchSettings.json similarity index 98% rename from src/modules/cmdpal/extensions/HackerNewsExtension/Properties/launchSettings.json rename to src/modules/cmdpal/Exts/HackerNewsExtension/Properties/launchSettings.json index 2df74d9a89..200e182015 100644 --- a/src/modules/cmdpal/extensions/HackerNewsExtension/Properties/launchSettings.json +++ b/src/modules/cmdpal/Exts/HackerNewsExtension/Properties/launchSettings.json @@ -7,4 +7,4 @@ "commandName": "Project" } } -} \ No newline at end of file +} diff --git a/src/modules/cmdpal/extensions/HackerNewsExtension/SampleExtension.cs b/src/modules/cmdpal/Exts/HackerNewsExtension/SampleExtension.cs similarity index 100% rename from src/modules/cmdpal/extensions/HackerNewsExtension/SampleExtension.cs rename to src/modules/cmdpal/Exts/HackerNewsExtension/SampleExtension.cs diff --git a/src/modules/cmdpal/extensions/HackerNewsExtension/app.manifest b/src/modules/cmdpal/Exts/HackerNewsExtension/app.manifest similarity index 100% rename from src/modules/cmdpal/extensions/HackerNewsExtension/app.manifest rename to src/modules/cmdpal/Exts/HackerNewsExtension/app.manifest diff --git a/src/modules/cmdpal/extensions/MastodonExtension/Assets/LockScreenLogo.scale-200.png b/src/modules/cmdpal/Exts/MastodonExtension/Assets/LockScreenLogo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/MastodonExtension/Assets/LockScreenLogo.scale-200.png rename to src/modules/cmdpal/Exts/MastodonExtension/Assets/LockScreenLogo.scale-200.png diff --git a/src/modules/cmdpal/extensions/MastodonExtension/Assets/SplashScreen.scale-200.png b/src/modules/cmdpal/Exts/MastodonExtension/Assets/SplashScreen.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/MastodonExtension/Assets/SplashScreen.scale-200.png rename to src/modules/cmdpal/Exts/MastodonExtension/Assets/SplashScreen.scale-200.png diff --git a/src/modules/cmdpal/extensions/MastodonExtension/Assets/Square150x150Logo.scale-200.png b/src/modules/cmdpal/Exts/MastodonExtension/Assets/Square150x150Logo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/MastodonExtension/Assets/Square150x150Logo.scale-200.png rename to src/modules/cmdpal/Exts/MastodonExtension/Assets/Square150x150Logo.scale-200.png diff --git a/src/modules/cmdpal/extensions/MastodonExtension/Assets/Square44x44Logo.scale-200.png b/src/modules/cmdpal/Exts/MastodonExtension/Assets/Square44x44Logo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/MastodonExtension/Assets/Square44x44Logo.scale-200.png rename to src/modules/cmdpal/Exts/MastodonExtension/Assets/Square44x44Logo.scale-200.png diff --git a/src/modules/cmdpal/extensions/MastodonExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/src/modules/cmdpal/Exts/MastodonExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png similarity index 100% rename from src/modules/cmdpal/extensions/MastodonExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png rename to src/modules/cmdpal/Exts/MastodonExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png diff --git a/src/modules/cmdpal/extensions/MastodonExtension/Assets/StoreLogo.png b/src/modules/cmdpal/Exts/MastodonExtension/Assets/StoreLogo.png similarity index 100% rename from src/modules/cmdpal/extensions/MastodonExtension/Assets/StoreLogo.png rename to src/modules/cmdpal/Exts/MastodonExtension/Assets/StoreLogo.png diff --git a/src/modules/cmdpal/extensions/MastodonExtension/Assets/Wide310x150Logo.scale-200.png b/src/modules/cmdpal/Exts/MastodonExtension/Assets/Wide310x150Logo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/MastodonExtension/Assets/Wide310x150Logo.scale-200.png rename to src/modules/cmdpal/Exts/MastodonExtension/Assets/Wide310x150Logo.scale-200.png diff --git a/src/modules/cmdpal/extensions/MastodonExtension/MastodonExtension.csproj b/src/modules/cmdpal/Exts/MastodonExtension/MastodonExtension.csproj similarity index 100% rename from src/modules/cmdpal/extensions/MastodonExtension/MastodonExtension.csproj rename to src/modules/cmdpal/Exts/MastodonExtension/MastodonExtension.csproj diff --git a/src/modules/cmdpal/extensions/MastodonExtension/MastodonExtensionPage.cs b/src/modules/cmdpal/Exts/MastodonExtension/MastodonExtensionPage.cs similarity index 94% rename from src/modules/cmdpal/extensions/MastodonExtension/MastodonExtensionPage.cs rename to src/modules/cmdpal/Exts/MastodonExtension/MastodonExtensionPage.cs index 226683206a..5589cfb221 100644 --- a/src/modules/cmdpal/extensions/MastodonExtension/MastodonExtensionPage.cs +++ b/src/modules/cmdpal/Exts/MastodonExtension/MastodonExtensionPage.cs @@ -23,7 +23,7 @@ internal sealed class MastodonExtensionPage : ListPage new ListSection() { Items = [ - new ListItem(new NoOpAction()) { Title = "TODO: Implement your extension here" } + new ListItem(new NoOpCommand()) { Title = "TODO: Implement your extension here" } ], } ]; diff --git a/src/modules/cmdpal/extensions/MastodonExtension/Package.appxmanifest b/src/modules/cmdpal/Exts/MastodonExtension/Package.appxmanifest similarity index 100% rename from src/modules/cmdpal/extensions/MastodonExtension/Package.appxmanifest rename to src/modules/cmdpal/Exts/MastodonExtension/Package.appxmanifest diff --git a/src/modules/cmdpal/extensions/MastodonExtension/Program.cs b/src/modules/cmdpal/Exts/MastodonExtension/Program.cs similarity index 100% rename from src/modules/cmdpal/extensions/MastodonExtension/Program.cs rename to src/modules/cmdpal/Exts/MastodonExtension/Program.cs diff --git a/src/modules/cmdpal/Exts/MastodonExtension/Properties/PublishProfiles/win-arm64.pubxml b/src/modules/cmdpal/Exts/MastodonExtension/Properties/PublishProfiles/win-arm64.pubxml new file mode 100644 index 0000000000..e7a6a3728c --- /dev/null +++ b/src/modules/cmdpal/Exts/MastodonExtension/Properties/PublishProfiles/win-arm64.pubxml @@ -0,0 +1,18 @@ + + + + + FileSystem + ARM64 + win-arm64 + bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ + true + False + False + True + False + False + + diff --git a/src/modules/cmdpal/extensions/ProcessMonitorExtension/Properties/PublishProfiles/win-x64.pubxml b/src/modules/cmdpal/Exts/MastodonExtension/Properties/PublishProfiles/win-x64.pubxml similarity index 89% rename from src/modules/cmdpal/extensions/ProcessMonitorExtension/Properties/PublishProfiles/win-x64.pubxml rename to src/modules/cmdpal/Exts/MastodonExtension/Properties/PublishProfiles/win-x64.pubxml index d7548ab0a8..2c790532c6 100644 --- a/src/modules/cmdpal/extensions/ProcessMonitorExtension/Properties/PublishProfiles/win-x64.pubxml +++ b/src/modules/cmdpal/Exts/MastodonExtension/Properties/PublishProfiles/win-x64.pubxml @@ -13,6 +13,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121. False True False - True + False - \ No newline at end of file + diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Properties/launchSettings.json b/src/modules/cmdpal/Exts/MastodonExtension/Properties/launchSettings.json similarity index 56% rename from src/modules/cmdpal/src/WindowsCommandPalette/Properties/launchSettings.json rename to src/modules/cmdpal/Exts/MastodonExtension/Properties/launchSettings.json index 937307cebe..9520129ecb 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Properties/launchSettings.json +++ b/src/modules/cmdpal/Exts/MastodonExtension/Properties/launchSettings.json @@ -1,10 +1,10 @@ { "profiles": { - "PT Run v2 (Package)": { + "MastodonExtension (Package)": { "commandName": "MsixPackage" }, - "PT Run v2 (Unpackaged)": { + "MastodonExtension (Unpackaged)": { "commandName": "Project" } } -} \ No newline at end of file +} diff --git a/src/modules/cmdpal/extensions/MastodonExtension/SampleExtension.cs b/src/modules/cmdpal/Exts/MastodonExtension/SampleExtension.cs similarity index 100% rename from src/modules/cmdpal/extensions/MastodonExtension/SampleExtension.cs rename to src/modules/cmdpal/Exts/MastodonExtension/SampleExtension.cs diff --git a/src/modules/cmdpal/extensions/MastodonExtension/app.manifest b/src/modules/cmdpal/Exts/MastodonExtension/app.manifest similarity index 100% rename from src/modules/cmdpal/extensions/MastodonExtension/app.manifest rename to src/modules/cmdpal/Exts/MastodonExtension/app.manifest diff --git a/src/modules/cmdpal/extensions/MediaControlsExtension/Assets/LockScreenLogo.scale-200.png b/src/modules/cmdpal/Exts/MediaControlsExtension/Assets/LockScreenLogo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/MediaControlsExtension/Assets/LockScreenLogo.scale-200.png rename to src/modules/cmdpal/Exts/MediaControlsExtension/Assets/LockScreenLogo.scale-200.png diff --git a/src/modules/cmdpal/extensions/MediaControlsExtension/Assets/SplashScreen.scale-200.png b/src/modules/cmdpal/Exts/MediaControlsExtension/Assets/SplashScreen.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/MediaControlsExtension/Assets/SplashScreen.scale-200.png rename to src/modules/cmdpal/Exts/MediaControlsExtension/Assets/SplashScreen.scale-200.png diff --git a/src/modules/cmdpal/extensions/MediaControlsExtension/Assets/Square150x150Logo.scale-200.png b/src/modules/cmdpal/Exts/MediaControlsExtension/Assets/Square150x150Logo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/MediaControlsExtension/Assets/Square150x150Logo.scale-200.png rename to src/modules/cmdpal/Exts/MediaControlsExtension/Assets/Square150x150Logo.scale-200.png diff --git a/src/modules/cmdpal/extensions/MediaControlsExtension/Assets/Square44x44Logo.scale-200.png b/src/modules/cmdpal/Exts/MediaControlsExtension/Assets/Square44x44Logo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/MediaControlsExtension/Assets/Square44x44Logo.scale-200.png rename to src/modules/cmdpal/Exts/MediaControlsExtension/Assets/Square44x44Logo.scale-200.png diff --git a/src/modules/cmdpal/extensions/MediaControlsExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/src/modules/cmdpal/Exts/MediaControlsExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png similarity index 100% rename from src/modules/cmdpal/extensions/MediaControlsExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png rename to src/modules/cmdpal/Exts/MediaControlsExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png diff --git a/src/modules/cmdpal/extensions/MediaControlsExtension/Assets/StoreLogo.png b/src/modules/cmdpal/Exts/MediaControlsExtension/Assets/StoreLogo.png similarity index 100% rename from src/modules/cmdpal/extensions/MediaControlsExtension/Assets/StoreLogo.png rename to src/modules/cmdpal/Exts/MediaControlsExtension/Assets/StoreLogo.png diff --git a/src/modules/cmdpal/extensions/MediaControlsExtension/Assets/Wide310x150Logo.scale-200.png b/src/modules/cmdpal/Exts/MediaControlsExtension/Assets/Wide310x150Logo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/MediaControlsExtension/Assets/Wide310x150Logo.scale-200.png rename to src/modules/cmdpal/Exts/MediaControlsExtension/Assets/Wide310x150Logo.scale-200.png diff --git a/src/modules/cmdpal/extensions/MediaControlsExtension/MediaActionsProvider.cs b/src/modules/cmdpal/Exts/MediaControlsExtension/MediaActionsProvider.cs similarity index 100% rename from src/modules/cmdpal/extensions/MediaControlsExtension/MediaActionsProvider.cs rename to src/modules/cmdpal/Exts/MediaControlsExtension/MediaActionsProvider.cs diff --git a/src/modules/cmdpal/extensions/MediaControlsExtension/MediaControlsExtension.csproj b/src/modules/cmdpal/Exts/MediaControlsExtension/MediaControlsExtension.csproj similarity index 100% rename from src/modules/cmdpal/extensions/MediaControlsExtension/MediaControlsExtension.csproj rename to src/modules/cmdpal/Exts/MediaControlsExtension/MediaControlsExtension.csproj diff --git a/src/modules/cmdpal/extensions/MediaControlsExtension/MediaListItem.cs b/src/modules/cmdpal/Exts/MediaControlsExtension/MediaListItem.cs similarity index 100% rename from src/modules/cmdpal/extensions/MediaControlsExtension/MediaListItem.cs rename to src/modules/cmdpal/Exts/MediaControlsExtension/MediaListItem.cs diff --git a/src/modules/cmdpal/extensions/MediaControlsExtension/Package.appxmanifest b/src/modules/cmdpal/Exts/MediaControlsExtension/Package.appxmanifest similarity index 100% rename from src/modules/cmdpal/extensions/MediaControlsExtension/Package.appxmanifest rename to src/modules/cmdpal/Exts/MediaControlsExtension/Package.appxmanifest diff --git a/src/modules/cmdpal/extensions/MediaControlsExtension/PrevNextTrackAction.cs b/src/modules/cmdpal/Exts/MediaControlsExtension/PrevNextTrackAction.cs similarity index 96% rename from src/modules/cmdpal/extensions/MediaControlsExtension/PrevNextTrackAction.cs rename to src/modules/cmdpal/Exts/MediaControlsExtension/PrevNextTrackAction.cs index 1f259f2b35..51c0f94c7f 100644 --- a/src/modules/cmdpal/extensions/MediaControlsExtension/PrevNextTrackAction.cs +++ b/src/modules/cmdpal/Exts/MediaControlsExtension/PrevNextTrackAction.cs @@ -41,6 +41,6 @@ internal sealed class PrevNextTrackAction : InvokableCommand _ = _mediaSession.TrySkipNextAsync(); } - return ActionResult.KeepOpen(); + return CommandResult.KeepOpen(); } } diff --git a/src/modules/cmdpal/extensions/MediaControlsExtension/Program.cs b/src/modules/cmdpal/Exts/MediaControlsExtension/Program.cs similarity index 100% rename from src/modules/cmdpal/extensions/MediaControlsExtension/Program.cs rename to src/modules/cmdpal/Exts/MediaControlsExtension/Program.cs diff --git a/src/modules/cmdpal/extensions/SpongebotExtension/Properties/PublishProfiles/win-arm64.pubxml b/src/modules/cmdpal/Exts/MediaControlsExtension/Properties/PublishProfiles/win-arm64.pubxml similarity index 89% rename from src/modules/cmdpal/extensions/SpongebotExtension/Properties/PublishProfiles/win-arm64.pubxml rename to src/modules/cmdpal/Exts/MediaControlsExtension/Properties/PublishProfiles/win-arm64.pubxml index ccd091e1b4..cea430ad55 100644 --- a/src/modules/cmdpal/extensions/SpongebotExtension/Properties/PublishProfiles/win-arm64.pubxml +++ b/src/modules/cmdpal/Exts/MediaControlsExtension/Properties/PublishProfiles/win-arm64.pubxml @@ -13,6 +13,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121. False True False - True + False - \ No newline at end of file + diff --git a/src/modules/cmdpal/extensions/SpongebotExtension/Properties/PublishProfiles/win-x64.pubxml b/src/modules/cmdpal/Exts/MediaControlsExtension/Properties/PublishProfiles/win-x64.pubxml similarity index 89% rename from src/modules/cmdpal/extensions/SpongebotExtension/Properties/PublishProfiles/win-x64.pubxml rename to src/modules/cmdpal/Exts/MediaControlsExtension/Properties/PublishProfiles/win-x64.pubxml index d7548ab0a8..2c790532c6 100644 --- a/src/modules/cmdpal/extensions/SpongebotExtension/Properties/PublishProfiles/win-x64.pubxml +++ b/src/modules/cmdpal/Exts/MediaControlsExtension/Properties/PublishProfiles/win-x64.pubxml @@ -13,6 +13,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121. False True False - True + False - \ No newline at end of file + diff --git a/src/modules/cmdpal/extensions/MediaControlsExtension/Properties/launchSettings.json b/src/modules/cmdpal/Exts/MediaControlsExtension/Properties/launchSettings.json similarity index 98% rename from src/modules/cmdpal/extensions/MediaControlsExtension/Properties/launchSettings.json rename to src/modules/cmdpal/Exts/MediaControlsExtension/Properties/launchSettings.json index d397a4b5e7..0f70c2867f 100644 --- a/src/modules/cmdpal/extensions/MediaControlsExtension/Properties/launchSettings.json +++ b/src/modules/cmdpal/Exts/MediaControlsExtension/Properties/launchSettings.json @@ -7,4 +7,4 @@ "commandName": "Project" } } -} \ No newline at end of file +} diff --git a/src/modules/cmdpal/extensions/MediaControlsExtension/SampleExtension.cs b/src/modules/cmdpal/Exts/MediaControlsExtension/SampleExtension.cs similarity index 100% rename from src/modules/cmdpal/extensions/MediaControlsExtension/SampleExtension.cs rename to src/modules/cmdpal/Exts/MediaControlsExtension/SampleExtension.cs diff --git a/src/modules/cmdpal/extensions/MediaControlsExtension/TogglePlayMediaAction.cs b/src/modules/cmdpal/Exts/MediaControlsExtension/TogglePlayMediaAction.cs similarity index 89% rename from src/modules/cmdpal/extensions/MediaControlsExtension/TogglePlayMediaAction.cs rename to src/modules/cmdpal/Exts/MediaControlsExtension/TogglePlayMediaAction.cs index 151c7c8666..21d297e99d 100644 --- a/src/modules/cmdpal/extensions/MediaControlsExtension/TogglePlayMediaAction.cs +++ b/src/modules/cmdpal/Exts/MediaControlsExtension/TogglePlayMediaAction.cs @@ -17,13 +17,13 @@ public sealed class TogglePlayMediaAction : InvokableCommand Icon = new(string.Empty); } - public override ActionResult Invoke() + public override CommandResult Invoke() { if (MediaSession != null) { _ = MediaSession.TryTogglePlayPauseAsync(); } - return ActionResult.KeepOpen(); + return CommandResult.KeepOpen(); } } diff --git a/src/modules/cmdpal/extensions/MediaControlsExtension/app.manifest b/src/modules/cmdpal/Exts/MediaControlsExtension/app.manifest similarity index 100% rename from src/modules/cmdpal/extensions/MediaControlsExtension/app.manifest rename to src/modules/cmdpal/Exts/MediaControlsExtension/app.manifest diff --git a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/AddBookmarkForm.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/AddBookmarkForm.cs similarity index 93% rename from src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/AddBookmarkForm.cs rename to src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/AddBookmarkForm.cs index 9afe223761..268b0cd3ba 100644 --- a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/AddBookmarkForm.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/AddBookmarkForm.cs @@ -58,12 +58,12 @@ internal sealed class AddBookmarkForm : Form public override string StateJson() => throw new NotImplementedException(); - public override ActionResult SubmitForm(string payload) + public override CommandResult SubmitForm(string payload) { var formInput = JsonNode.Parse(payload); if (formInput == null) { - return ActionResult.GoHome(); + return CommandResult.GoHome(); } // get the name and url out of the values @@ -100,7 +100,7 @@ internal sealed class AddBookmarkForm : Form }; // Construct a new json blob with the name and url - var jsonPath = BookmarksActionProvider.StateJsonPath(); + var jsonPath = BookmarksCommandProvider.StateJsonPath(); var data = Bookmarks.ReadFromFile(jsonPath); data.Data.Add(formData); @@ -108,6 +108,6 @@ internal sealed class AddBookmarkForm : Form Bookmarks.WriteToFile(jsonPath, data); AddedAction?.Invoke(this, null); - return ActionResult.GoHome(); + return CommandResult.GoHome(); } } diff --git a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/AddBookmarkPage.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/AddBookmarkPage.cs similarity index 100% rename from src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/AddBookmarkPage.cs rename to src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/AddBookmarkPage.cs diff --git a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkData.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkData.cs similarity index 100% rename from src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkData.cs rename to src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkData.cs diff --git a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkDataContext.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkDataContext.cs similarity index 100% rename from src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkDataContext.cs rename to src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkDataContext.cs diff --git a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkPlaceholderForm.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkPlaceholderForm.cs similarity index 95% rename from src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkPlaceholderForm.cs rename to src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkPlaceholderForm.cs index 95aeec01b8..7b493ba8d8 100644 --- a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkPlaceholderForm.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkPlaceholderForm.cs @@ -71,7 +71,7 @@ internal sealed class BookmarkPlaceholderForm : Form public override string StateJson() => throw new NotImplementedException(); - public override ActionResult SubmitForm(string payload) + public override CommandResult SubmitForm(string payload) { var target = _bookmark; @@ -80,7 +80,7 @@ internal sealed class BookmarkPlaceholderForm : Form var formObject = formInput?.AsObject(); if (formObject == null) { - return ActionResult.GoHome(); + return CommandResult.GoHome(); } foreach (var (key, value) in formObject) @@ -107,6 +107,6 @@ internal sealed class BookmarkPlaceholderForm : Form System.Diagnostics.Debug.WriteLine($"Error launching URL: {ex.Message}"); } - return ActionResult.GoHome(); + return CommandResult.GoHome(); } } diff --git a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkPlaceholderPage.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkPlaceholderPage.cs similarity index 100% rename from src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkPlaceholderPage.cs rename to src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarkPlaceholderPage.cs diff --git a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/Bookmarks.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/Bookmarks.cs similarity index 93% rename from src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/Bookmarks.cs rename to src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/Bookmarks.cs index 8cf57b244e..7c3a1dd1e0 100644 --- a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/Bookmarks.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/Bookmarks.cs @@ -39,6 +39,6 @@ public sealed class Bookmarks { var jsonString = JsonSerializer.Serialize(data, _jsonOptions); - File.WriteAllText(BookmarksActionProvider.StateJsonPath(), jsonString); + File.WriteAllText(BookmarksCommandProvider.StateJsonPath(), jsonString); } } diff --git a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarksActionProvider.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarksCommandProvider.cs similarity index 97% rename from src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarksActionProvider.cs rename to src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarksCommandProvider.cs index 6d7ea7870d..58a73973ac 100644 --- a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarksActionProvider.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/BookmarksCommandProvider.cs @@ -11,7 +11,7 @@ using Microsoft.CmdPal.Extensions.Helpers; namespace Microsoft.CmdPal.Ext.Bookmarks; -public class BookmarksActionProvider : ICommandProvider +public class BookmarksCommandProvider : ICommandProvider { public string DisplayName => $"Bookmarks"; @@ -20,7 +20,7 @@ public class BookmarksActionProvider : ICommandProvider private readonly List _commands = []; private readonly AddBookmarkPage _addNewCommand = new(); - public BookmarksActionProvider() + public BookmarksCommandProvider() { _addNewCommand.AddedAction += AddNewCommand_AddedAction; } diff --git a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/Microsoft.CmdPal.Ext.Bookmarks.csproj b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/Microsoft.CmdPal.Ext.Bookmarks.csproj similarity index 51% rename from src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/Microsoft.CmdPal.Ext.Bookmarks.csproj rename to src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/Microsoft.CmdPal.Ext.Bookmarks.csproj index 4ed0f6179e..c044209825 100644 --- a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/Microsoft.CmdPal.Ext.Bookmarks.csproj +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/Microsoft.CmdPal.Ext.Bookmarks.csproj @@ -1,10 +1,10 @@  - + Microsoft.CmdPal.Ext.Bookmarks enable - + diff --git a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/OpenInTerminalAction.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/OpenInTerminalAction.cs similarity index 96% rename from src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/OpenInTerminalAction.cs rename to src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/OpenInTerminalAction.cs index 4bc8d4ef71..7c95ae99c0 100644 --- a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/OpenInTerminalAction.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/OpenInTerminalAction.cs @@ -36,6 +36,6 @@ internal sealed class OpenInTerminalAction : InvokableCommand System.Diagnostics.Debug.WriteLine($"Error launching Windows Terminal: {ex.Message}"); } - return ActionResult.Dismiss(); + return CommandResult.Dismiss(); } } diff --git a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/SourceGenerationContext.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/SourceGenerationContext.cs similarity index 100% rename from src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/SourceGenerationContext.cs rename to src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/SourceGenerationContext.cs diff --git a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/UrlAction.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/UrlAction.cs similarity index 96% rename from src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/UrlAction.cs rename to src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/UrlAction.cs index 1c08e739f6..1e051f8957 100644 --- a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Bookmark/UrlAction.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Bookmark/UrlAction.cs @@ -27,7 +27,7 @@ public class UrlAction : InvokableCommand Url = url; } - public override ActionResult Invoke() + public override CommandResult Invoke() { var target = _url; try @@ -47,7 +47,7 @@ public class UrlAction : InvokableCommand System.Diagnostics.Debug.WriteLine($"Error launching URL: {ex.Message}"); } - return ActionResult.Dismiss(); + return CommandResult.Dismiss(); } internal static Uri? GetUri(string url) diff --git a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Calc/CalculatorAction.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Calc/CalculatorAction.cs similarity index 78% rename from src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Calc/CalculatorAction.cs rename to src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Calc/CalculatorAction.cs index 89e3389cf1..3fa5014073 100644 --- a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Calc/CalculatorAction.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Calc/CalculatorAction.cs @@ -4,6 +4,7 @@ using Microsoft.CmdPal.Extensions; using Microsoft.CmdPal.Extensions.Helpers; +using Windows.ApplicationModel.DataTransfer; // To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. @@ -23,10 +24,14 @@ public class CalculatorAction : InvokableCommand { if (_success) { - ClipboardHelper.SetText(_result); + var dataPackage = new DataPackage(); + dataPackage.SetText(_result); + Clipboard.SetContent(dataPackage); + + // ClipboardHelper.SetText(_result); } - return ActionResult.KeepOpen(); + return CommandResult.KeepOpen(); } internal void SetResult(string result, bool success) diff --git a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Calc/CalculatorActionProvider.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Calc/CalculatorCommandProvider.cs similarity index 90% rename from src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Calc/CalculatorActionProvider.cs rename to src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Calc/CalculatorCommandProvider.cs index d44bace9ea..e08ec34a18 100644 --- a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Calc/CalculatorActionProvider.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Calc/CalculatorCommandProvider.cs @@ -9,13 +9,13 @@ using Microsoft.CmdPal.Extensions; // and more about our project templates, see: http://aka.ms/winui-project-info. namespace Microsoft.CmdPal.Ext.Calc; -public class CalculatorActionProvider : ICommandProvider +public class CalculatorCommandProvider : ICommandProvider { public string DisplayName => $"Calculator"; private readonly CalculatorTopLevelListItem calculatorCommand = new(); - public CalculatorActionProvider() + public CalculatorCommandProvider() { } diff --git a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Calc/CalculatorTopLevelListItem.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Calc/CalculatorTopLevelListItem.cs similarity index 100% rename from src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Calc/CalculatorTopLevelListItem.cs rename to src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Calc/CalculatorTopLevelListItem.cs diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Calc/Microsoft.CmdPal.Ext.Calc.csproj b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Calc/Microsoft.CmdPal.Ext.Calc.csproj new file mode 100644 index 0000000000..2d3cba680e --- /dev/null +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.Calc/Microsoft.CmdPal.Ext.Calc.csproj @@ -0,0 +1,9 @@ + + + + Microsoft.CmdPal.Ext.Calc + + + + + diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/Microsoft.CmdPal.Ext.Settings.csproj b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/Microsoft.CmdPal.Ext.Settings.csproj new file mode 100644 index 0000000000..8784bd413d --- /dev/null +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/Microsoft.CmdPal.Ext.Settings.csproj @@ -0,0 +1,9 @@ + + + + Microsoft.CmdPal.Ext.Settings + + + + + diff --git a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/SettingsActionProvider.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/SettingsCommandProvider.cs similarity index 90% rename from src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/SettingsActionProvider.cs rename to src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/SettingsCommandProvider.cs index 18e8127cc3..ff63928b92 100644 --- a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/SettingsActionProvider.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/SettingsCommandProvider.cs @@ -8,13 +8,13 @@ using Microsoft.CmdPal.Extensions.Helpers; namespace Microsoft.CmdPal.Ext.Settings; -public class SettingsActionProvider : ICommandProvider +public class SettingsCommandProvider : ICommandProvider { public string DisplayName => $"Settings"; private readonly SettingsPage settingsPage = new(); - public SettingsActionProvider() + public SettingsCommandProvider() { } diff --git a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/SettingsForm.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/SettingsForm.cs similarity index 93% rename from src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/SettingsForm.cs rename to src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/SettingsForm.cs index 72ea6096df..724ef89004 100644 --- a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/SettingsForm.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/SettingsForm.cs @@ -77,15 +77,15 @@ internal sealed class SettingsForm : Form public override string StateJson() => throw new NotImplementedException(); - public override ActionResult SubmitForm(string payload) + public override CommandResult SubmitForm(string payload) { var formInput = JsonNode.Parse(payload)?.AsObject(); if (formInput == null) { - return ActionResult.GoHome(); + return CommandResult.GoHome(); } // Application.Current.GetService().SaveSettingAsync("GlobalHotkey", formInput["hotkey"]?.ToString() ?? string.Empty); - return ActionResult.GoHome(); + return CommandResult.GoHome(); } } diff --git a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/SettingsPage.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/SettingsPage.cs similarity index 100% rename from src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/SettingsPage.cs rename to src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/SettingsPage.cs diff --git a/src/modules/cmdpal/extensions/NewExtension.ps1 b/src/modules/cmdpal/Exts/NewExtension.ps1 similarity index 100% rename from src/modules/cmdpal/extensions/NewExtension.ps1 rename to src/modules/cmdpal/Exts/NewExtension.ps1 diff --git a/src/modules/cmdpal/extensions/ProcessMonitorExtension/Assets/LockScreenLogo.scale-200.png b/src/modules/cmdpal/Exts/ProcessMonitorExtension/Assets/LockScreenLogo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/ProcessMonitorExtension/Assets/LockScreenLogo.scale-200.png rename to src/modules/cmdpal/Exts/ProcessMonitorExtension/Assets/LockScreenLogo.scale-200.png diff --git a/src/modules/cmdpal/extensions/ProcessMonitorExtension/Assets/SplashScreen.scale-200.png b/src/modules/cmdpal/Exts/ProcessMonitorExtension/Assets/SplashScreen.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/ProcessMonitorExtension/Assets/SplashScreen.scale-200.png rename to src/modules/cmdpal/Exts/ProcessMonitorExtension/Assets/SplashScreen.scale-200.png diff --git a/src/modules/cmdpal/extensions/ProcessMonitorExtension/Assets/Square150x150Logo.scale-200.png b/src/modules/cmdpal/Exts/ProcessMonitorExtension/Assets/Square150x150Logo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/ProcessMonitorExtension/Assets/Square150x150Logo.scale-200.png rename to src/modules/cmdpal/Exts/ProcessMonitorExtension/Assets/Square150x150Logo.scale-200.png diff --git a/src/modules/cmdpal/extensions/ProcessMonitorExtension/Assets/Square44x44Logo.scale-200.png b/src/modules/cmdpal/Exts/ProcessMonitorExtension/Assets/Square44x44Logo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/ProcessMonitorExtension/Assets/Square44x44Logo.scale-200.png rename to src/modules/cmdpal/Exts/ProcessMonitorExtension/Assets/Square44x44Logo.scale-200.png diff --git a/src/modules/cmdpal/extensions/ProcessMonitorExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/src/modules/cmdpal/Exts/ProcessMonitorExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png similarity index 100% rename from src/modules/cmdpal/extensions/ProcessMonitorExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png rename to src/modules/cmdpal/Exts/ProcessMonitorExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png diff --git a/src/modules/cmdpal/extensions/ProcessMonitorExtension/Assets/StoreLogo.png b/src/modules/cmdpal/Exts/ProcessMonitorExtension/Assets/StoreLogo.png similarity index 100% rename from src/modules/cmdpal/extensions/ProcessMonitorExtension/Assets/StoreLogo.png rename to src/modules/cmdpal/Exts/ProcessMonitorExtension/Assets/StoreLogo.png diff --git a/src/modules/cmdpal/extensions/ProcessMonitorExtension/Assets/Wide310x150Logo.scale-200.png b/src/modules/cmdpal/Exts/ProcessMonitorExtension/Assets/Wide310x150Logo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/ProcessMonitorExtension/Assets/Wide310x150Logo.scale-200.png rename to src/modules/cmdpal/Exts/ProcessMonitorExtension/Assets/Wide310x150Logo.scale-200.png diff --git a/src/modules/cmdpal/extensions/ProcessMonitorExtension/Package.appxmanifest b/src/modules/cmdpal/Exts/ProcessMonitorExtension/Package.appxmanifest similarity index 100% rename from src/modules/cmdpal/extensions/ProcessMonitorExtension/Package.appxmanifest rename to src/modules/cmdpal/Exts/ProcessMonitorExtension/Package.appxmanifest diff --git a/src/modules/cmdpal/extensions/ProcessMonitorExtension/ProcessItem.cs b/src/modules/cmdpal/Exts/ProcessMonitorExtension/ProcessItem.cs similarity index 100% rename from src/modules/cmdpal/extensions/ProcessMonitorExtension/ProcessItem.cs rename to src/modules/cmdpal/Exts/ProcessMonitorExtension/ProcessItem.cs diff --git a/src/modules/cmdpal/extensions/ProcessMonitorExtension/ProcessListPage.cs b/src/modules/cmdpal/Exts/ProcessMonitorExtension/ProcessListPage.cs similarity index 100% rename from src/modules/cmdpal/extensions/ProcessMonitorExtension/ProcessListPage.cs rename to src/modules/cmdpal/Exts/ProcessMonitorExtension/ProcessListPage.cs diff --git a/src/modules/cmdpal/extensions/ProcessMonitorExtension/ProcessMonitorActionProvider.cs b/src/modules/cmdpal/Exts/ProcessMonitorExtension/ProcessMonitorCommandProvider.cs similarity index 91% rename from src/modules/cmdpal/extensions/ProcessMonitorExtension/ProcessMonitorActionProvider.cs rename to src/modules/cmdpal/Exts/ProcessMonitorExtension/ProcessMonitorCommandProvider.cs index 4df8272ed3..33b24c2027 100644 --- a/src/modules/cmdpal/extensions/ProcessMonitorExtension/ProcessMonitorActionProvider.cs +++ b/src/modules/cmdpal/Exts/ProcessMonitorExtension/ProcessMonitorCommandProvider.cs @@ -7,7 +7,7 @@ using Microsoft.CmdPal.Extensions.Helpers; namespace ProcessMonitorExtension; -internal sealed class ProcessMonitorActionProvider : ICommandProvider +internal sealed class ProcessMonitorCommandProvider : ICommandProvider { public string DisplayName => "Process Monitor Commands"; diff --git a/src/modules/cmdpal/extensions/ProcessMonitorExtension/ProcessMonitorExtension.csproj b/src/modules/cmdpal/Exts/ProcessMonitorExtension/ProcessMonitorExtension.csproj similarity index 100% rename from src/modules/cmdpal/extensions/ProcessMonitorExtension/ProcessMonitorExtension.csproj rename to src/modules/cmdpal/Exts/ProcessMonitorExtension/ProcessMonitorExtension.csproj diff --git a/src/modules/cmdpal/extensions/ProcessMonitorExtension/Program.cs b/src/modules/cmdpal/Exts/ProcessMonitorExtension/Program.cs similarity index 100% rename from src/modules/cmdpal/extensions/ProcessMonitorExtension/Program.cs rename to src/modules/cmdpal/Exts/ProcessMonitorExtension/Program.cs diff --git a/src/modules/cmdpal/extensions/ProcessMonitorExtension/Properties/PublishProfiles/win-arm64.pubxml b/src/modules/cmdpal/Exts/ProcessMonitorExtension/Properties/PublishProfiles/win-arm64.pubxml similarity index 89% rename from src/modules/cmdpal/extensions/ProcessMonitorExtension/Properties/PublishProfiles/win-arm64.pubxml rename to src/modules/cmdpal/Exts/ProcessMonitorExtension/Properties/PublishProfiles/win-arm64.pubxml index ccd091e1b4..cea430ad55 100644 --- a/src/modules/cmdpal/extensions/ProcessMonitorExtension/Properties/PublishProfiles/win-arm64.pubxml +++ b/src/modules/cmdpal/Exts/ProcessMonitorExtension/Properties/PublishProfiles/win-arm64.pubxml @@ -13,6 +13,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121. False True False - True + False - \ No newline at end of file + diff --git a/src/modules/cmdpal/extensions/MediaControlsExtension/Properties/PublishProfiles/win-x64.pubxml b/src/modules/cmdpal/Exts/ProcessMonitorExtension/Properties/PublishProfiles/win-x64.pubxml similarity index 89% rename from src/modules/cmdpal/extensions/MediaControlsExtension/Properties/PublishProfiles/win-x64.pubxml rename to src/modules/cmdpal/Exts/ProcessMonitorExtension/Properties/PublishProfiles/win-x64.pubxml index d7548ab0a8..2c790532c6 100644 --- a/src/modules/cmdpal/extensions/MediaControlsExtension/Properties/PublishProfiles/win-x64.pubxml +++ b/src/modules/cmdpal/Exts/ProcessMonitorExtension/Properties/PublishProfiles/win-x64.pubxml @@ -13,6 +13,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121. False True False - True + False - \ No newline at end of file + diff --git a/src/modules/cmdpal/extensions/ProcessMonitorExtension/Properties/launchSettings.json b/src/modules/cmdpal/Exts/ProcessMonitorExtension/Properties/launchSettings.json similarity index 98% rename from src/modules/cmdpal/extensions/ProcessMonitorExtension/Properties/launchSettings.json rename to src/modules/cmdpal/Exts/ProcessMonitorExtension/Properties/launchSettings.json index 31adf00d01..7adb50094c 100644 --- a/src/modules/cmdpal/extensions/ProcessMonitorExtension/Properties/launchSettings.json +++ b/src/modules/cmdpal/Exts/ProcessMonitorExtension/Properties/launchSettings.json @@ -7,4 +7,4 @@ "commandName": "Project" } } -} \ No newline at end of file +} diff --git a/src/modules/cmdpal/extensions/ProcessMonitorExtension/SampleExtension.cs b/src/modules/cmdpal/Exts/ProcessMonitorExtension/SampleExtension.cs similarity index 94% rename from src/modules/cmdpal/extensions/ProcessMonitorExtension/SampleExtension.cs rename to src/modules/cmdpal/Exts/ProcessMonitorExtension/SampleExtension.cs index dd52b79d8e..11c16104cf 100644 --- a/src/modules/cmdpal/extensions/ProcessMonitorExtension/SampleExtension.cs +++ b/src/modules/cmdpal/Exts/ProcessMonitorExtension/SampleExtension.cs @@ -26,7 +26,7 @@ public sealed class SampleExtension : IExtension switch (providerType) { case ProviderType.Commands: - return new ProcessMonitorActionProvider(); + return new ProcessMonitorCommandProvider(); default: return null; } diff --git a/src/modules/cmdpal/extensions/ProcessMonitorExtension/SwitchToProcess.cs b/src/modules/cmdpal/Exts/ProcessMonitorExtension/SwitchToProcess.cs similarity index 90% rename from src/modules/cmdpal/extensions/ProcessMonitorExtension/SwitchToProcess.cs rename to src/modules/cmdpal/Exts/ProcessMonitorExtension/SwitchToProcess.cs index 3d9e5671e2..cadb411363 100644 --- a/src/modules/cmdpal/extensions/ProcessMonitorExtension/SwitchToProcess.cs +++ b/src/modules/cmdpal/Exts/ProcessMonitorExtension/SwitchToProcess.cs @@ -22,9 +22,9 @@ internal sealed class SwitchToProcess : InvokableCommand this.Name = "Switch to"; } - public override ActionResult Invoke() + public override CommandResult Invoke() { SwitchToThisWindow(process.Process.MainWindowHandle, true); - return ActionResult.KeepOpen(); + return CommandResult.KeepOpen(); } } diff --git a/src/modules/cmdpal/extensions/ProcessMonitorExtension/TerminateProcess.cs b/src/modules/cmdpal/Exts/ProcessMonitorExtension/TerminateProcess.cs similarity index 88% rename from src/modules/cmdpal/extensions/ProcessMonitorExtension/TerminateProcess.cs rename to src/modules/cmdpal/Exts/ProcessMonitorExtension/TerminateProcess.cs index 2ad8e9836c..438784373e 100644 --- a/src/modules/cmdpal/extensions/ProcessMonitorExtension/TerminateProcess.cs +++ b/src/modules/cmdpal/Exts/ProcessMonitorExtension/TerminateProcess.cs @@ -18,10 +18,10 @@ internal sealed class TerminateProcess : InvokableCommand Name = "End task"; } - public override ActionResult Invoke() + public override CommandResult Invoke() { var process = Process.GetProcessById(_process.ProcessId); process.Kill(); - return ActionResult.KeepOpen(); + return CommandResult.KeepOpen(); } } diff --git a/src/modules/cmdpal/extensions/ProcessMonitorExtension/app.manifest b/src/modules/cmdpal/Exts/ProcessMonitorExtension/app.manifest similarity index 100% rename from src/modules/cmdpal/extensions/ProcessMonitorExtension/app.manifest rename to src/modules/cmdpal/Exts/ProcessMonitorExtension/app.manifest diff --git a/src/modules/cmdpal/extensions/SampleExtension.sln b/src/modules/cmdpal/Exts/SampleExtension.sln similarity index 100% rename from src/modules/cmdpal/extensions/SampleExtension.sln rename to src/modules/cmdpal/Exts/SampleExtension.sln diff --git a/src/modules/cmdpal/extensions/SpongebotExtension/Assets/LockScreenLogo.scale-200.png b/src/modules/cmdpal/Exts/SpongebotExtension/Assets/LockScreenLogo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/SpongebotExtension/Assets/LockScreenLogo.scale-200.png rename to src/modules/cmdpal/Exts/SpongebotExtension/Assets/LockScreenLogo.scale-200.png diff --git a/src/modules/cmdpal/extensions/SpongebotExtension/Assets/SplashScreen.scale-200.png b/src/modules/cmdpal/Exts/SpongebotExtension/Assets/SplashScreen.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/SpongebotExtension/Assets/SplashScreen.scale-200.png rename to src/modules/cmdpal/Exts/SpongebotExtension/Assets/SplashScreen.scale-200.png diff --git a/src/modules/cmdpal/extensions/SpongebotExtension/Assets/Square150x150Logo.scale-200.png b/src/modules/cmdpal/Exts/SpongebotExtension/Assets/Square150x150Logo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/SpongebotExtension/Assets/Square150x150Logo.scale-200.png rename to src/modules/cmdpal/Exts/SpongebotExtension/Assets/Square150x150Logo.scale-200.png diff --git a/src/modules/cmdpal/extensions/SpongebotExtension/Assets/Square44x44Logo.scale-200.png b/src/modules/cmdpal/Exts/SpongebotExtension/Assets/Square44x44Logo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/SpongebotExtension/Assets/Square44x44Logo.scale-200.png rename to src/modules/cmdpal/Exts/SpongebotExtension/Assets/Square44x44Logo.scale-200.png diff --git a/src/modules/cmdpal/extensions/SpongebotExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/src/modules/cmdpal/Exts/SpongebotExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png similarity index 100% rename from src/modules/cmdpal/extensions/SpongebotExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png rename to src/modules/cmdpal/Exts/SpongebotExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png diff --git a/src/modules/cmdpal/extensions/SpongebotExtension/Assets/StoreLogo.png b/src/modules/cmdpal/Exts/SpongebotExtension/Assets/StoreLogo.png similarity index 100% rename from src/modules/cmdpal/extensions/SpongebotExtension/Assets/StoreLogo.png rename to src/modules/cmdpal/Exts/SpongebotExtension/Assets/StoreLogo.png diff --git a/src/modules/cmdpal/extensions/SpongebotExtension/Assets/Wide310x150Logo.scale-200.png b/src/modules/cmdpal/Exts/SpongebotExtension/Assets/Wide310x150Logo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/SpongebotExtension/Assets/Wide310x150Logo.scale-200.png rename to src/modules/cmdpal/Exts/SpongebotExtension/Assets/Wide310x150Logo.scale-200.png diff --git a/src/modules/cmdpal/extensions/SpongebotExtension/CopyTextAction.cs b/src/modules/cmdpal/Exts/SpongebotExtension/CopyTextAction.cs similarity index 69% rename from src/modules/cmdpal/extensions/SpongebotExtension/CopyTextAction.cs rename to src/modules/cmdpal/Exts/SpongebotExtension/CopyTextAction.cs index eb4447f8cd..e76475292f 100644 --- a/src/modules/cmdpal/extensions/SpongebotExtension/CopyTextAction.cs +++ b/src/modules/cmdpal/Exts/SpongebotExtension/CopyTextAction.cs @@ -4,6 +4,7 @@ using Microsoft.CmdPal.Extensions; using Microsoft.CmdPal.Extensions.Helpers; +using Windows.ApplicationModel.DataTransfer; namespace SpongebotExtension; @@ -20,7 +21,11 @@ public class CopyTextAction : InvokableCommand public override ICommandResult Invoke() { - ClipboardHelper.SetText(Text); - return ActionResult.KeepOpen(); + var dataPackage = new DataPackage(); + dataPackage.SetText(Text); + Clipboard.SetContent(dataPackage); + + // ClipboardHelper.SetText(Text); + return CommandResult.KeepOpen(); } } diff --git a/src/modules/cmdpal/extensions/SpongebotExtension/Package.appxmanifest b/src/modules/cmdpal/Exts/SpongebotExtension/Package.appxmanifest similarity index 100% rename from src/modules/cmdpal/extensions/SpongebotExtension/Package.appxmanifest rename to src/modules/cmdpal/Exts/SpongebotExtension/Package.appxmanifest diff --git a/src/modules/cmdpal/extensions/SpongebotExtension/Program.cs b/src/modules/cmdpal/Exts/SpongebotExtension/Program.cs similarity index 100% rename from src/modules/cmdpal/extensions/SpongebotExtension/Program.cs rename to src/modules/cmdpal/Exts/SpongebotExtension/Program.cs diff --git a/src/modules/cmdpal/extensions/MediaControlsExtension/Properties/PublishProfiles/win-arm64.pubxml b/src/modules/cmdpal/Exts/SpongebotExtension/Properties/PublishProfiles/win-arm64.pubxml similarity index 89% rename from src/modules/cmdpal/extensions/MediaControlsExtension/Properties/PublishProfiles/win-arm64.pubxml rename to src/modules/cmdpal/Exts/SpongebotExtension/Properties/PublishProfiles/win-arm64.pubxml index ccd091e1b4..cea430ad55 100644 --- a/src/modules/cmdpal/extensions/MediaControlsExtension/Properties/PublishProfiles/win-arm64.pubxml +++ b/src/modules/cmdpal/Exts/SpongebotExtension/Properties/PublishProfiles/win-arm64.pubxml @@ -13,6 +13,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121. False True False - True + False - \ No newline at end of file + diff --git a/src/modules/cmdpal/Exts/SpongebotExtension/Properties/PublishProfiles/win-x64.pubxml b/src/modules/cmdpal/Exts/SpongebotExtension/Properties/PublishProfiles/win-x64.pubxml new file mode 100644 index 0000000000..2c790532c6 --- /dev/null +++ b/src/modules/cmdpal/Exts/SpongebotExtension/Properties/PublishProfiles/win-x64.pubxml @@ -0,0 +1,18 @@ + + + + + FileSystem + x64 + win-x64 + bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ + true + False + False + True + False + False + + diff --git a/src/modules/cmdpal/extensions/SpongebotExtension/Properties/launchSettings.json b/src/modules/cmdpal/Exts/SpongebotExtension/Properties/launchSettings.json similarity index 98% rename from src/modules/cmdpal/extensions/SpongebotExtension/Properties/launchSettings.json rename to src/modules/cmdpal/Exts/SpongebotExtension/Properties/launchSettings.json index e6c43e9ec8..9c5e235100 100644 --- a/src/modules/cmdpal/extensions/SpongebotExtension/Properties/launchSettings.json +++ b/src/modules/cmdpal/Exts/SpongebotExtension/Properties/launchSettings.json @@ -7,4 +7,4 @@ "commandName": "Project" } } -} \ No newline at end of file +} diff --git a/src/modules/cmdpal/extensions/SpongebotExtension/SampleExtension.cs b/src/modules/cmdpal/Exts/SpongebotExtension/SampleExtension.cs similarity index 100% rename from src/modules/cmdpal/extensions/SpongebotExtension/SampleExtension.cs rename to src/modules/cmdpal/Exts/SpongebotExtension/SampleExtension.cs diff --git a/src/modules/cmdpal/extensions/SpongebotExtension/SpongeSettingsForm.cs b/src/modules/cmdpal/Exts/SpongebotExtension/SpongeSettingsForm.cs similarity index 92% rename from src/modules/cmdpal/extensions/SpongebotExtension/SpongeSettingsForm.cs rename to src/modules/cmdpal/Exts/SpongebotExtension/SpongeSettingsForm.cs index 89319bd952..4db6ef22d1 100644 --- a/src/modules/cmdpal/extensions/SpongebotExtension/SpongeSettingsForm.cs +++ b/src/modules/cmdpal/Exts/SpongebotExtension/SpongeSettingsForm.cs @@ -56,12 +56,12 @@ internal sealed class SpongeSettingsForm : Form public override string StateJson() => throw new NotImplementedException(); - public override ActionResult SubmitForm(string payload) + public override CommandResult SubmitForm(string payload) { var formInput = JsonNode.Parse(payload); if (formInput == null) { - return ActionResult.GoHome(); + return CommandResult.GoHome(); } // get the name and url out of the values @@ -77,6 +77,6 @@ internal sealed class SpongeSettingsForm : Form """; File.WriteAllText(SpongebotPage.StateJsonPath(), json); - return ActionResult.GoHome(); + return CommandResult.GoHome(); } } diff --git a/src/modules/cmdpal/extensions/SpongebotExtension/SpongebotCommandsProvider.cs b/src/modules/cmdpal/Exts/SpongebotExtension/SpongebotCommandsProvider.cs similarity index 100% rename from src/modules/cmdpal/extensions/SpongebotExtension/SpongebotCommandsProvider.cs rename to src/modules/cmdpal/Exts/SpongebotExtension/SpongebotCommandsProvider.cs diff --git a/src/modules/cmdpal/extensions/SpongebotExtension/SpongebotExtension.csproj b/src/modules/cmdpal/Exts/SpongebotExtension/SpongebotExtension.csproj similarity index 100% rename from src/modules/cmdpal/extensions/SpongebotExtension/SpongebotExtension.csproj rename to src/modules/cmdpal/Exts/SpongebotExtension/SpongebotExtension.csproj diff --git a/src/modules/cmdpal/extensions/SpongebotExtension/SpongebotPage.cs b/src/modules/cmdpal/Exts/SpongebotExtension/SpongebotPage.cs similarity index 100% rename from src/modules/cmdpal/extensions/SpongebotExtension/SpongebotPage.cs rename to src/modules/cmdpal/Exts/SpongebotExtension/SpongebotPage.cs diff --git a/src/modules/cmdpal/extensions/SpongebotExtension/SpongebotSettingsPage.cs b/src/modules/cmdpal/Exts/SpongebotExtension/SpongebotSettingsPage.cs similarity index 100% rename from src/modules/cmdpal/extensions/SpongebotExtension/SpongebotSettingsPage.cs rename to src/modules/cmdpal/Exts/SpongebotExtension/SpongebotSettingsPage.cs diff --git a/src/modules/cmdpal/extensions/SpongebotExtension/app.manifest b/src/modules/cmdpal/Exts/SpongebotExtension/app.manifest similarity index 100% rename from src/modules/cmdpal/extensions/SpongebotExtension/app.manifest rename to src/modules/cmdpal/Exts/SpongebotExtension/app.manifest diff --git a/src/modules/cmdpal/extensions/TemplateExtension/Assets/LockScreenLogo.scale-200.png b/src/modules/cmdpal/Exts/TemplateExtension/Assets/LockScreenLogo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/TemplateExtension/Assets/LockScreenLogo.scale-200.png rename to src/modules/cmdpal/Exts/TemplateExtension/Assets/LockScreenLogo.scale-200.png diff --git a/src/modules/cmdpal/extensions/TemplateExtension/Assets/SplashScreen.scale-200.png b/src/modules/cmdpal/Exts/TemplateExtension/Assets/SplashScreen.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/TemplateExtension/Assets/SplashScreen.scale-200.png rename to src/modules/cmdpal/Exts/TemplateExtension/Assets/SplashScreen.scale-200.png diff --git a/src/modules/cmdpal/extensions/TemplateExtension/Assets/Square150x150Logo.scale-200.png b/src/modules/cmdpal/Exts/TemplateExtension/Assets/Square150x150Logo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/TemplateExtension/Assets/Square150x150Logo.scale-200.png rename to src/modules/cmdpal/Exts/TemplateExtension/Assets/Square150x150Logo.scale-200.png diff --git a/src/modules/cmdpal/extensions/TemplateExtension/Assets/Square44x44Logo.scale-200.png b/src/modules/cmdpal/Exts/TemplateExtension/Assets/Square44x44Logo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/TemplateExtension/Assets/Square44x44Logo.scale-200.png rename to src/modules/cmdpal/Exts/TemplateExtension/Assets/Square44x44Logo.scale-200.png diff --git a/src/modules/cmdpal/extensions/TemplateExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/src/modules/cmdpal/Exts/TemplateExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png similarity index 100% rename from src/modules/cmdpal/extensions/TemplateExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png rename to src/modules/cmdpal/Exts/TemplateExtension/Assets/Square44x44Logo.targetsize-24_altform-unplated.png diff --git a/src/modules/cmdpal/extensions/TemplateExtension/Assets/StoreLogo.png b/src/modules/cmdpal/Exts/TemplateExtension/Assets/StoreLogo.png similarity index 100% rename from src/modules/cmdpal/extensions/TemplateExtension/Assets/StoreLogo.png rename to src/modules/cmdpal/Exts/TemplateExtension/Assets/StoreLogo.png diff --git a/src/modules/cmdpal/extensions/TemplateExtension/Assets/Wide310x150Logo.scale-200.png b/src/modules/cmdpal/Exts/TemplateExtension/Assets/Wide310x150Logo.scale-200.png similarity index 100% rename from src/modules/cmdpal/extensions/TemplateExtension/Assets/Wide310x150Logo.scale-200.png rename to src/modules/cmdpal/Exts/TemplateExtension/Assets/Wide310x150Logo.scale-200.png diff --git a/src/modules/cmdpal/extensions/TemplateExtension/Package.appxmanifest b/src/modules/cmdpal/Exts/TemplateExtension/Package.appxmanifest similarity index 100% rename from src/modules/cmdpal/extensions/TemplateExtension/Package.appxmanifest rename to src/modules/cmdpal/Exts/TemplateExtension/Package.appxmanifest diff --git a/src/modules/cmdpal/extensions/TemplateExtension/Program.cs b/src/modules/cmdpal/Exts/TemplateExtension/Program.cs similarity index 100% rename from src/modules/cmdpal/extensions/TemplateExtension/Program.cs rename to src/modules/cmdpal/Exts/TemplateExtension/Program.cs diff --git a/src/modules/cmdpal/extensions/TemplateExtension/Properties/PublishProfiles/win-arm64.pubxml b/src/modules/cmdpal/Exts/TemplateExtension/Properties/PublishProfiles/win-arm64.pubxml similarity index 89% rename from src/modules/cmdpal/extensions/TemplateExtension/Properties/PublishProfiles/win-arm64.pubxml rename to src/modules/cmdpal/Exts/TemplateExtension/Properties/PublishProfiles/win-arm64.pubxml index ccd091e1b4..cea430ad55 100644 --- a/src/modules/cmdpal/extensions/TemplateExtension/Properties/PublishProfiles/win-arm64.pubxml +++ b/src/modules/cmdpal/Exts/TemplateExtension/Properties/PublishProfiles/win-arm64.pubxml @@ -13,6 +13,6 @@ https://go.microsoft.com/fwlink/?LinkID=208121. False True False - True + False - \ No newline at end of file + diff --git a/src/modules/cmdpal/Exts/TemplateExtension/Properties/PublishProfiles/win-x64.pubxml b/src/modules/cmdpal/Exts/TemplateExtension/Properties/PublishProfiles/win-x64.pubxml new file mode 100644 index 0000000000..2c790532c6 --- /dev/null +++ b/src/modules/cmdpal/Exts/TemplateExtension/Properties/PublishProfiles/win-x64.pubxml @@ -0,0 +1,18 @@ + + + + + FileSystem + x64 + win-x64 + bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ + true + False + False + True + False + False + + diff --git a/src/modules/cmdpal/extensions/TemplateExtension/Properties/launchSettings.json b/src/modules/cmdpal/Exts/TemplateExtension/Properties/launchSettings.json similarity index 100% rename from src/modules/cmdpal/extensions/TemplateExtension/Properties/launchSettings.json rename to src/modules/cmdpal/Exts/TemplateExtension/Properties/launchSettings.json diff --git a/src/modules/cmdpal/extensions/TemplateExtension/SampleExtension.cs b/src/modules/cmdpal/Exts/TemplateExtension/SampleExtension.cs similarity index 100% rename from src/modules/cmdpal/extensions/TemplateExtension/SampleExtension.cs rename to src/modules/cmdpal/Exts/TemplateExtension/SampleExtension.cs diff --git a/src/modules/cmdpal/extensions/TemplateExtension/TemplateExtension.csproj b/src/modules/cmdpal/Exts/TemplateExtension/TemplateExtension.csproj similarity index 100% rename from src/modules/cmdpal/extensions/TemplateExtension/TemplateExtension.csproj rename to src/modules/cmdpal/Exts/TemplateExtension/TemplateExtension.csproj diff --git a/src/modules/cmdpal/extensions/TemplateExtension/TemplateExtensionPage.cs b/src/modules/cmdpal/Exts/TemplateExtension/TemplateExtensionPage.cs similarity index 94% rename from src/modules/cmdpal/extensions/TemplateExtension/TemplateExtensionPage.cs rename to src/modules/cmdpal/Exts/TemplateExtension/TemplateExtensionPage.cs index 7af04d49ba..fd19fc6987 100644 --- a/src/modules/cmdpal/extensions/TemplateExtension/TemplateExtensionPage.cs +++ b/src/modules/cmdpal/Exts/TemplateExtension/TemplateExtensionPage.cs @@ -23,7 +23,7 @@ internal sealed class TemplateExtensionPage : ListPage new ListSection() { Items = [ - new ListItem(new NoOpAction()) { Title = "TODO: Implement your extension here" } + new ListItem(new NoOpCommand()) { Title = "TODO: Implement your extension here" } ], } ]; diff --git a/src/modules/cmdpal/extensions/TemplateExtension/app.manifest b/src/modules/cmdpal/Exts/TemplateExtension/app.manifest similarity index 100% rename from src/modules/cmdpal/extensions/TemplateExtension/app.manifest rename to src/modules/cmdpal/Exts/TemplateExtension/app.manifest diff --git a/src/modules/cmdpal/src/Microsoft.CmdPal.Common/Contracts/IFileService.cs b/src/modules/cmdpal/Microsoft.CmdPal.Common/Contracts/IFileService.cs similarity index 100% rename from src/modules/cmdpal/src/Microsoft.CmdPal.Common/Contracts/IFileService.cs rename to src/modules/cmdpal/Microsoft.CmdPal.Common/Contracts/IFileService.cs diff --git a/src/modules/cmdpal/src/Microsoft.CmdPal.Common/Contracts/ILocalSettingsService.cs b/src/modules/cmdpal/Microsoft.CmdPal.Common/Contracts/ILocalSettingsService.cs similarity index 100% rename from src/modules/cmdpal/src/Microsoft.CmdPal.Common/Contracts/ILocalSettingsService.cs rename to src/modules/cmdpal/Microsoft.CmdPal.Common/Contracts/ILocalSettingsService.cs diff --git a/src/modules/cmdpal/src/Microsoft.CmdPal.Common/Extensions/ApplicationExtensions.cs b/src/modules/cmdpal/Microsoft.CmdPal.Common/Extensions/ApplicationExtensions.cs similarity index 100% rename from src/modules/cmdpal/src/Microsoft.CmdPal.Common/Extensions/ApplicationExtensions.cs rename to src/modules/cmdpal/Microsoft.CmdPal.Common/Extensions/ApplicationExtensions.cs diff --git a/src/modules/cmdpal/src/Microsoft.CmdPal.Common/Extensions/IHostExtensions.cs b/src/modules/cmdpal/Microsoft.CmdPal.Common/Extensions/IHostExtensions.cs similarity index 100% rename from src/modules/cmdpal/src/Microsoft.CmdPal.Common/Extensions/IHostExtensions.cs rename to src/modules/cmdpal/Microsoft.CmdPal.Common/Extensions/IHostExtensions.cs diff --git a/src/modules/cmdpal/src/Microsoft.CmdPal.Common/Helpers/Json.cs b/src/modules/cmdpal/Microsoft.CmdPal.Common/Helpers/Json.cs similarity index 100% rename from src/modules/cmdpal/src/Microsoft.CmdPal.Common/Helpers/Json.cs rename to src/modules/cmdpal/Microsoft.CmdPal.Common/Helpers/Json.cs diff --git a/src/modules/cmdpal/src/Microsoft.CmdPal.Common/Helpers/RuntimeHelper.cs b/src/modules/cmdpal/Microsoft.CmdPal.Common/Helpers/RuntimeHelper.cs similarity index 100% rename from src/modules/cmdpal/src/Microsoft.CmdPal.Common/Helpers/RuntimeHelper.cs rename to src/modules/cmdpal/Microsoft.CmdPal.Common/Helpers/RuntimeHelper.cs diff --git a/src/modules/cmdpal/src/Microsoft.CmdPal.Common/Microsoft.CmdPal.Common.csproj b/src/modules/cmdpal/Microsoft.CmdPal.Common/Microsoft.CmdPal.Common.csproj similarity index 77% rename from src/modules/cmdpal/src/Microsoft.CmdPal.Common/Microsoft.CmdPal.Common.csproj rename to src/modules/cmdpal/Microsoft.CmdPal.Common/Microsoft.CmdPal.Common.csproj index 85e1c9bae7..d82d1a5342 100644 --- a/src/modules/cmdpal/src/Microsoft.CmdPal.Common/Microsoft.CmdPal.Common.csproj +++ b/src/modules/cmdpal/Microsoft.CmdPal.Common/Microsoft.CmdPal.Common.csproj @@ -1,5 +1,5 @@ - + Microsoft.CmdPal.Common enable @@ -18,7 +18,7 @@ - + diff --git a/src/modules/cmdpal/src/Microsoft.CmdPal.Common/Models/LocalSettingsOptions.cs b/src/modules/cmdpal/Microsoft.CmdPal.Common/Models/LocalSettingsOptions.cs similarity index 100% rename from src/modules/cmdpal/src/Microsoft.CmdPal.Common/Models/LocalSettingsOptions.cs rename to src/modules/cmdpal/Microsoft.CmdPal.Common/Models/LocalSettingsOptions.cs diff --git a/src/modules/cmdpal/src/Microsoft.CmdPal.Common/NativeMethods.txt b/src/modules/cmdpal/Microsoft.CmdPal.Common/NativeMethods.txt similarity index 100% rename from src/modules/cmdpal/src/Microsoft.CmdPal.Common/NativeMethods.txt rename to src/modules/cmdpal/Microsoft.CmdPal.Common/NativeMethods.txt diff --git a/src/modules/cmdpal/src/Microsoft.CmdPal.Common/Services/FileService.cs b/src/modules/cmdpal/Microsoft.CmdPal.Common/Services/FileService.cs similarity index 100% rename from src/modules/cmdpal/src/Microsoft.CmdPal.Common/Services/FileService.cs rename to src/modules/cmdpal/Microsoft.CmdPal.Common/Services/FileService.cs diff --git a/src/modules/cmdpal/src/Microsoft.CmdPal.Common/Services/IApp.cs b/src/modules/cmdpal/Microsoft.CmdPal.Common/Services/IApp.cs similarity index 100% rename from src/modules/cmdpal/src/Microsoft.CmdPal.Common/Services/IApp.cs rename to src/modules/cmdpal/Microsoft.CmdPal.Common/Services/IApp.cs diff --git a/src/modules/cmdpal/src/Microsoft.CmdPal.Common/Services/IExtensionService.cs b/src/modules/cmdpal/Microsoft.CmdPal.Common/Services/IExtensionService.cs similarity index 100% rename from src/modules/cmdpal/src/Microsoft.CmdPal.Common/Services/IExtensionService.cs rename to src/modules/cmdpal/Microsoft.CmdPal.Common/Services/IExtensionService.cs diff --git a/src/modules/cmdpal/src/Microsoft.CmdPal.Common/Services/IExtensionWrapper.cs b/src/modules/cmdpal/Microsoft.CmdPal.Common/Services/IExtensionWrapper.cs similarity index 100% rename from src/modules/cmdpal/src/Microsoft.CmdPal.Common/Services/IExtensionWrapper.cs rename to src/modules/cmdpal/Microsoft.CmdPal.Common/Services/IExtensionWrapper.cs diff --git a/src/modules/cmdpal/src/Microsoft.CmdPal.Common/Services/LocalSettingsService.cs b/src/modules/cmdpal/Microsoft.CmdPal.Common/Services/LocalSettingsService.cs similarity index 100% rename from src/modules/cmdpal/src/Microsoft.CmdPal.Common/Services/LocalSettingsService.cs rename to src/modules/cmdpal/Microsoft.CmdPal.Common/Services/LocalSettingsService.cs diff --git a/src/modules/cmdpal/src/Microsoft.Terminal.UI/Converters.cpp b/src/modules/cmdpal/Microsoft.Terminal.UI/Converters.cpp similarity index 100% rename from src/modules/cmdpal/src/Microsoft.Terminal.UI/Converters.cpp rename to src/modules/cmdpal/Microsoft.Terminal.UI/Converters.cpp diff --git a/src/modules/cmdpal/src/Microsoft.Terminal.UI/Converters.h b/src/modules/cmdpal/Microsoft.Terminal.UI/Converters.h similarity index 100% rename from src/modules/cmdpal/src/Microsoft.Terminal.UI/Converters.h rename to src/modules/cmdpal/Microsoft.Terminal.UI/Converters.h diff --git a/src/modules/cmdpal/src/Microsoft.Terminal.UI/Converters.idl b/src/modules/cmdpal/Microsoft.Terminal.UI/Converters.idl similarity index 100% rename from src/modules/cmdpal/src/Microsoft.Terminal.UI/Converters.idl rename to src/modules/cmdpal/Microsoft.Terminal.UI/Converters.idl diff --git a/src/modules/cmdpal/src/Microsoft.Terminal.UI/IDirectKeyListener.idl b/src/modules/cmdpal/Microsoft.Terminal.UI/IDirectKeyListener.idl similarity index 100% rename from src/modules/cmdpal/src/Microsoft.Terminal.UI/IDirectKeyListener.idl rename to src/modules/cmdpal/Microsoft.Terminal.UI/IDirectKeyListener.idl diff --git a/src/modules/cmdpal/src/Microsoft.Terminal.UI/IconPathConverter.cpp b/src/modules/cmdpal/Microsoft.Terminal.UI/IconPathConverter.cpp similarity index 100% rename from src/modules/cmdpal/src/Microsoft.Terminal.UI/IconPathConverter.cpp rename to src/modules/cmdpal/Microsoft.Terminal.UI/IconPathConverter.cpp diff --git a/src/modules/cmdpal/src/Microsoft.Terminal.UI/IconPathConverter.h b/src/modules/cmdpal/Microsoft.Terminal.UI/IconPathConverter.h similarity index 100% rename from src/modules/cmdpal/src/Microsoft.Terminal.UI/IconPathConverter.h rename to src/modules/cmdpal/Microsoft.Terminal.UI/IconPathConverter.h diff --git a/src/modules/cmdpal/src/Microsoft.Terminal.UI/IconPathConverter.idl b/src/modules/cmdpal/Microsoft.Terminal.UI/IconPathConverter.idl similarity index 100% rename from src/modules/cmdpal/src/Microsoft.Terminal.UI/IconPathConverter.idl rename to src/modules/cmdpal/Microsoft.Terminal.UI/IconPathConverter.idl diff --git a/src/modules/cmdpal/src/Microsoft.Terminal.UI/Microsoft.Terminal.UI.def b/src/modules/cmdpal/Microsoft.Terminal.UI/Microsoft.Terminal.UI.def similarity index 100% rename from src/modules/cmdpal/src/Microsoft.Terminal.UI/Microsoft.Terminal.UI.def rename to src/modules/cmdpal/Microsoft.Terminal.UI/Microsoft.Terminal.UI.def diff --git a/src/modules/cmdpal/src/Microsoft.Terminal.UI/Microsoft.Terminal.UI.vcxproj b/src/modules/cmdpal/Microsoft.Terminal.UI/Microsoft.Terminal.UI.vcxproj similarity index 69% rename from src/modules/cmdpal/src/Microsoft.Terminal.UI/Microsoft.Terminal.UI.vcxproj rename to src/modules/cmdpal/Microsoft.Terminal.UI/Microsoft.Terminal.UI.vcxproj index 9717bcc55b..efceefbf82 100644 --- a/src/modules/cmdpal/src/Microsoft.Terminal.UI/Microsoft.Terminal.UI.vcxproj +++ b/src/modules/cmdpal/Microsoft.Terminal.UI/Microsoft.Terminal.UI.vcxproj @@ -1,8 +1,12 @@ - - - + + ..\..\..\..\ + $(PathToRoot)packages\Microsoft.WindowsAppSDK.1.5.240428000 + $(PathToRoot)packages\Microsoft.Windows.CppWinRT.2.0.240111.5 + + + true true @@ -182,22 +186,19 @@ - - - - + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - + + + + + diff --git a/src/modules/cmdpal/src/Microsoft.Terminal.UI/ResourceString.cpp b/src/modules/cmdpal/Microsoft.Terminal.UI/ResourceString.cpp similarity index 100% rename from src/modules/cmdpal/src/Microsoft.Terminal.UI/ResourceString.cpp rename to src/modules/cmdpal/Microsoft.Terminal.UI/ResourceString.cpp diff --git a/src/modules/cmdpal/src/Microsoft.Terminal.UI/ResourceString.h b/src/modules/cmdpal/Microsoft.Terminal.UI/ResourceString.h similarity index 100% rename from src/modules/cmdpal/src/Microsoft.Terminal.UI/ResourceString.h rename to src/modules/cmdpal/Microsoft.Terminal.UI/ResourceString.h diff --git a/src/modules/cmdpal/src/Microsoft.Terminal.UI/ResourceString.idl b/src/modules/cmdpal/Microsoft.Terminal.UI/ResourceString.idl similarity index 100% rename from src/modules/cmdpal/src/Microsoft.Terminal.UI/ResourceString.idl rename to src/modules/cmdpal/Microsoft.Terminal.UI/ResourceString.idl diff --git a/src/modules/cmdpal/src/Microsoft.Terminal.UI/init.cpp b/src/modules/cmdpal/Microsoft.Terminal.UI/init.cpp similarity index 100% rename from src/modules/cmdpal/src/Microsoft.Terminal.UI/init.cpp rename to src/modules/cmdpal/Microsoft.Terminal.UI/init.cpp diff --git a/src/modules/cmdpal/src/Microsoft.Terminal.UI/packages.config b/src/modules/cmdpal/Microsoft.Terminal.UI/packages.config similarity index 100% rename from src/modules/cmdpal/src/Microsoft.Terminal.UI/packages.config rename to src/modules/cmdpal/Microsoft.Terminal.UI/packages.config diff --git a/src/modules/cmdpal/src/Microsoft.Terminal.UI/pch.cpp b/src/modules/cmdpal/Microsoft.Terminal.UI/pch.cpp similarity index 100% rename from src/modules/cmdpal/src/Microsoft.Terminal.UI/pch.cpp rename to src/modules/cmdpal/Microsoft.Terminal.UI/pch.cpp diff --git a/src/modules/cmdpal/src/Microsoft.Terminal.UI/pch.h b/src/modules/cmdpal/Microsoft.Terminal.UI/pch.h similarity index 100% rename from src/modules/cmdpal/src/Microsoft.Terminal.UI/pch.h rename to src/modules/cmdpal/Microsoft.Terminal.UI/pch.h diff --git a/src/modules/cmdpal/src/Microsoft.Terminal.UI/til_string.h b/src/modules/cmdpal/Microsoft.Terminal.UI/til_string.h similarity index 100% rename from src/modules/cmdpal/src/Microsoft.Terminal.UI/til_string.h rename to src/modules/cmdpal/Microsoft.Terminal.UI/til_string.h diff --git a/src/modules/cmdpal/src/Microsoft.Terminal.UI/version.rc b/src/modules/cmdpal/Microsoft.Terminal.UI/version.rc similarity index 100% rename from src/modules/cmdpal/src/Microsoft.Terminal.UI/version.rc rename to src/modules/cmdpal/Microsoft.Terminal.UI/version.rc diff --git a/src/modules/cmdpal/WindowsCommandPalette.sln b/src/modules/cmdpal/WindowsCommandPalette.sln index 9f61b540dd..1925615ccf 100644 --- a/src/modules/cmdpal/WindowsCommandPalette.sln +++ b/src/modules/cmdpal/WindowsCommandPalette.sln @@ -2,11 +2,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.11.34929.205 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CmdPal.UI.Poc", "src\WindowsCommandPalette\Microsoft.CmdPal.UI.Poc.csproj", "{F71CF22B-A5C7-4328-A5B3-F4191AE57314}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CmdPal.UI.Poc", "WindowsCommandPalette\Microsoft.CmdPal.UI.Poc.csproj", "{F71CF22B-A5C7-4328-A5B3-F4191AE57314}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sample Extensions", "Sample Extensions", "{B7FF739F-7716-4FC3-B622-705486187B87}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.Terminal.UI", "src\Microsoft.Terminal.UI\Microsoft.Terminal.UI.vcxproj", "{6515F03F-E56D-4DB4-B23D-AC4FB80DB36F}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.Terminal.UI", "Microsoft.Terminal.UI\Microsoft.Terminal.UI.vcxproj", "{6515F03F-E56D-4DB4-B23D-AC4FB80DB36F}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extension SDK", "Extension SDK", "{FAA24D36-5515-467C-91E7-101A189AAF48}" EndProject @@ -14,15 +14,15 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.CmdPal.Extensions EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CmdPal.Extensions.Helpers", "extensionsdk\Microsoft.CmdPal.Extensions.Helpers\Microsoft.CmdPal.Extensions.Helpers.csproj", "{79060D06-7174-4D66-8D0B-4FF021154049}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CmdPal.Common", "src\Microsoft.CmdPal.Common\Microsoft.CmdPal.Common.csproj", "{05CDE6EE-23AE-42AF-A9F5-E398C382675F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CmdPal.Common", "Microsoft.CmdPal.Common\Microsoft.CmdPal.Common.csproj", "{05CDE6EE-23AE-42AF-A9F5-E398C382675F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SpongebotExtension", "extensions\SpongebotExtension\SpongebotExtension.csproj", "{57617906-DEC8-4D62-A270-6EBE3F8E5C0D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SpongebotExtension", "Exts\SpongebotExtension\SpongebotExtension.csproj", "{57617906-DEC8-4D62-A270-6EBE3F8E5C0D}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HackerNewsExtension", "extensions\HackerNewsExtension\HackerNewsExtension.csproj", "{1A506BBA-06A9-476E-B5D3-1495F299D53F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HackerNewsExtension", "Exts\HackerNewsExtension\HackerNewsExtension.csproj", "{1A506BBA-06A9-476E-B5D3-1495F299D53F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MediaControlsExtension", "extensions\MediaControlsExtension\MediaControlsExtension.csproj", "{D08AE85F-B6FE-4E1C-8402-DB396B70D6DA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MediaControlsExtension", "Exts\MediaControlsExtension\MediaControlsExtension.csproj", "{D08AE85F-B6FE-4E1C-8402-DB396B70D6DA}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProcessMonitorExtension", "extensions\ProcessMonitorExtension\ProcessMonitorExtension.csproj", "{9456257A-3292-4A8D-AF63-9830EABE7ED2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProcessMonitorExtension", "Exts\ProcessMonitorExtension\ProcessMonitorExtension.csproj", "{9456257A-3292-4A8D-AF63-9830EABE7ED2}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Prototype", "Prototype", "{B4B13D2C-8C19-43D0-9FD4-3084F42EA4C2}" EndProject diff --git a/src/modules/cmdpal/WindowsCommandPalette/ActionViewModel.cs b/src/modules/cmdpal/WindowsCommandPalette/ActionViewModel.cs new file mode 100644 index 0000000000..748b300293 --- /dev/null +++ b/src/modules/cmdpal/WindowsCommandPalette/ActionViewModel.cs @@ -0,0 +1,17 @@ +// 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.UI.Xaml.Controls; + +namespace DeveloperCommandPalette; + +public sealed class ActionViewModel(ICommand cmd) +{ + public ICommand Command => cmd; + + internal bool CanInvoke => cmd is IInvokableCommand; + + internal IconElement IcoElement => Microsoft.Terminal.UI.IconPathConverter.IconMUX(Command.Icon.Icon); +} diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/App.xaml b/src/modules/cmdpal/WindowsCommandPalette/App.xaml similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/App.xaml rename to src/modules/cmdpal/WindowsCommandPalette/App.xaml diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/App.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/App.xaml.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/App.xaml.cs rename to src/modules/cmdpal/WindowsCommandPalette/App.xaml.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/LargeTile.scale-100.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/LargeTile.scale-100.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/LargeTile.scale-100.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/LargeTile.scale-100.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/LargeTile.scale-125.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/LargeTile.scale-125.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/LargeTile.scale-125.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/LargeTile.scale-125.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/LargeTile.scale-150.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/LargeTile.scale-150.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/LargeTile.scale-150.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/LargeTile.scale-150.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/LargeTile.scale-200.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/LargeTile.scale-200.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/LargeTile.scale-200.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/LargeTile.scale-200.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/LargeTile.scale-400.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/LargeTile.scale-400.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/LargeTile.scale-400.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/LargeTile.scale-400.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/LockScreenLogo.scale-200.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/LockScreenLogo.scale-200.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/LockScreenLogo.scale-200.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/LockScreenLogo.scale-200.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/SmallTile.scale-100.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/SmallTile.scale-100.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/SmallTile.scale-100.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/SmallTile.scale-100.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/SmallTile.scale-125.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/SmallTile.scale-125.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/SmallTile.scale-125.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/SmallTile.scale-125.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/SmallTile.scale-150.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/SmallTile.scale-150.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/SmallTile.scale-150.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/SmallTile.scale-150.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/SmallTile.scale-200.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/SmallTile.scale-200.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/SmallTile.scale-200.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/SmallTile.scale-200.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/SmallTile.scale-400.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/SmallTile.scale-400.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/SmallTile.scale-400.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/SmallTile.scale-400.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/SplashScreen.scale-100.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/SplashScreen.scale-100.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/SplashScreen.scale-100.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/SplashScreen.scale-100.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/SplashScreen.scale-125.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/SplashScreen.scale-125.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/SplashScreen.scale-125.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/SplashScreen.scale-125.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/SplashScreen.scale-150.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/SplashScreen.scale-150.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/SplashScreen.scale-150.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/SplashScreen.scale-150.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/SplashScreen.scale-200.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/SplashScreen.scale-200.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/SplashScreen.scale-200.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/SplashScreen.scale-200.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/SplashScreen.scale-400.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/SplashScreen.scale-400.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/SplashScreen.scale-400.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/SplashScreen.scale-400.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square150x150Logo.scale-100.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square150x150Logo.scale-100.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square150x150Logo.scale-100.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square150x150Logo.scale-100.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square150x150Logo.scale-125.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square150x150Logo.scale-125.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square150x150Logo.scale-125.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square150x150Logo.scale-125.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square150x150Logo.scale-150.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square150x150Logo.scale-150.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square150x150Logo.scale-150.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square150x150Logo.scale-150.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square150x150Logo.scale-200.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square150x150Logo.scale-200.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square150x150Logo.scale-200.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square150x150Logo.scale-200.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square150x150Logo.scale-400.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square150x150Logo.scale-400.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square150x150Logo.scale-400.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square150x150Logo.scale-400.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.altform-lightunplated_targetsize-16.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.altform-lightunplated_targetsize-24.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.altform-lightunplated_targetsize-24.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.altform-lightunplated_targetsize-24.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.altform-lightunplated_targetsize-24.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.altform-lightunplated_targetsize-256.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.altform-lightunplated_targetsize-32.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.altform-lightunplated_targetsize-48.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.altform-unplated_targetsize-16.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.altform-unplated_targetsize-16.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.altform-unplated_targetsize-16.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.altform-unplated_targetsize-16.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.altform-unplated_targetsize-256.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.altform-unplated_targetsize-256.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.altform-unplated_targetsize-256.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.altform-unplated_targetsize-256.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.altform-unplated_targetsize-32.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.altform-unplated_targetsize-32.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.altform-unplated_targetsize-32.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.altform-unplated_targetsize-32.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.altform-unplated_targetsize-48.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.altform-unplated_targetsize-48.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.altform-unplated_targetsize-48.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.altform-unplated_targetsize-48.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.scale-100.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.scale-100.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.scale-100.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.scale-100.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.scale-125.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.scale-125.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.scale-125.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.scale-125.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.scale-150.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.scale-150.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.scale-150.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.scale-150.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.scale-200.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.scale-200.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.scale-200.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.scale-200.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.scale-400.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.scale-400.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.scale-400.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.scale-400.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-16.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-16.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-16.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-16.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-24.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-24.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-24.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-24.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-24_altform-unplated.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-24_altform-unplated.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-24_altform-unplated.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-256.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-256.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-256.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-256.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-32.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-32.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-32.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-32.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-48.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-48.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-48.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Square44x44Logo.targetsize-48.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/StoreLogo.backup.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/StoreLogo.backup.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/StoreLogo.backup.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/StoreLogo.backup.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/StoreLogo.scale-100.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/StoreLogo.scale-100.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/StoreLogo.scale-100.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/StoreLogo.scale-100.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/StoreLogo.scale-125.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/StoreLogo.scale-125.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/StoreLogo.scale-125.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/StoreLogo.scale-125.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/StoreLogo.scale-150.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/StoreLogo.scale-150.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/StoreLogo.scale-150.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/StoreLogo.scale-150.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/StoreLogo.scale-200.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/StoreLogo.scale-200.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/StoreLogo.scale-200.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/StoreLogo.scale-200.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/StoreLogo.scale-400.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/StoreLogo.scale-400.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/StoreLogo.scale-400.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/StoreLogo.scale-400.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Wide310x150Logo.scale-100.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Wide310x150Logo.scale-100.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Wide310x150Logo.scale-100.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Wide310x150Logo.scale-100.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Wide310x150Logo.scale-125.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Wide310x150Logo.scale-125.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Wide310x150Logo.scale-125.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Wide310x150Logo.scale-125.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Wide310x150Logo.scale-150.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Wide310x150Logo.scale-150.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Wide310x150Logo.scale-150.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Wide310x150Logo.scale-150.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Wide310x150Logo.scale-200.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Wide310x150Logo.scale-200.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Wide310x150Logo.scale-200.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Wide310x150Logo.scale-200.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Assets/Wide310x150Logo.scale-400.png b/src/modules/cmdpal/WindowsCommandPalette/Assets/Wide310x150Logo.scale-400.png similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Assets/Wide310x150Logo.scale-400.png rename to src/modules/cmdpal/WindowsCommandPalette/Assets/Wide310x150Logo.scale-400.png diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/AllAppsPage.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/AllAppsPage.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/AllAppsPage.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/AllAppsPage.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/AppAction.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/AppAction.cs similarity index 95% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/AppAction.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/AppAction.cs index d32dae0a5d..005c3fa723 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/AppAction.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/AppAction.cs @@ -59,9 +59,9 @@ internal sealed class AppAction : InvokableCommand } } - public override ActionResult Invoke() + public override CommandResult Invoke() { _ = Launch(); - return ActionResult.GoHome(); + return CommandResult.GoHome(); } } diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/AppCache.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/AppCache.cs similarity index 61% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/AppCache.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/AppCache.cs index 6cbd2e72e2..60ae4b4ade 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/AppCache.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/AppCache.cs @@ -8,7 +8,12 @@ namespace WindowsCommandPalette.BuiltinCommands.AllApps; public sealed class AppCache { - internal IList Win32s = Win32Program.All(); - internal IList UWPs = UWP.All(); + private readonly IList _win32s = Win32Program.All(); + private readonly IList _uwps = UWP.All(); + + public IList Win32s => _win32s; + + public IList UWPs => _uwps; + public static readonly Lazy Instance = new(() => new()); } diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/AppItem.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/AppItem.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/AppItem.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/AppItem.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/AppListItem.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/AppListItem.cs similarity index 57% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/AppListItem.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/AppListItem.cs index 078ee4019d..e8a7a3c8f6 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/AppListItem.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/AppListItem.cs @@ -13,17 +13,28 @@ internal sealed class AppListItem : ListItem public AppListItem(AppItem app) : base(new AppAction(app)) { - this._app = app; - this.Title = app.Name; - this.Subtitle = app.Subtitle; - this.Details = new Details() { Title = this.Title, HeroImage = this.Command.Icon, Body = "### App" }; - this.Tags = [new Tag() { Text = "App" }]; + _app = app; + Title = app.Name; + Subtitle = app.Subtitle; + Tags = [new Tag() { Text = "App" }]; + + Details = new Details() + { + Title = this.Title, + HeroImage = Command?.Icon ?? new(string.Empty), + Body = "### App", + }; if (string.IsNullOrEmpty(app.UserModelId)) { // Win32 exe or other non UWP app MoreCommands = [ - new CommandContextItem(new OpenPathAction(app.DirPath) { Name = "Open location", Icon = new("\ue838") }) + new CommandContextItem( + new OpenPathAction(app.DirPath) + { + Name = "Open location", + Icon = new("\ue838"), + }) ]; } else diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/OpenPathAction.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/OpenPathAction.cs similarity index 90% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/OpenPathAction.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/OpenPathAction.cs index 4a75315bfd..bfcf29da2a 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/OpenPathAction.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/OpenPathAction.cs @@ -20,10 +20,10 @@ internal sealed class OpenPathAction(string target) : InvokableCommand }); } - public override ActionResult Invoke() + public override CommandResult Invoke() { LaunchTarget(_target).Start(); - return ActionResult.GoHome(); + return CommandResult.GoHome(); } } diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/AppxFactory.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/AppxFactory.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/AppxFactory.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/AppxFactory.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/AppxPackageHelper.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/AppxPackageHelper.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/AppxPackageHelper.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/AppxPackageHelper.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/IApplicationActivationManager.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/IApplicationActivationManager.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/IApplicationActivationManager.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/IApplicationActivationManager.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/IAppxFactory.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/IAppxFactory.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/IAppxFactory.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/IAppxFactory.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/IAppxManifestApplication.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/IAppxManifestApplication.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/IAppxManifestApplication.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/IAppxManifestApplication.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/IAppxManifestApplicationsEnumerator.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/IAppxManifestApplicationsEnumerator.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/IAppxManifestApplicationsEnumerator.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/IAppxManifestApplicationsEnumerator.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/IAppxManifestProperties.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/IAppxManifestProperties.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/IAppxManifestProperties.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/IAppxManifestProperties.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/IAppxManifestReader.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/IAppxManifestReader.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/IAppxManifestReader.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/IAppxManifestReader.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/IPackage.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/IPackage.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/IPackage.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/IPackage.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/IPackageManager.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/IPackageManager.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/IPackageManager.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/IPackageManager.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/IProgram.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/IProgram.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/IProgram.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/IProgram.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/IShellLinkHelper.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/IShellLinkHelper.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/IShellLinkHelper.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/IShellLinkHelper.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/LogoType.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/LogoType.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/LogoType.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/LogoType.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/Native.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/Native.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/Native.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/Native.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/PackageManagerWrapper.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/PackageManagerWrapper.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/PackageManagerWrapper.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/PackageManagerWrapper.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/PackageWrapper.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/PackageWrapper.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/PackageWrapper.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/PackageWrapper.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/ProgramSource.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/ProgramSource.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/ProgramSource.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/ProgramSource.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/ShellLinkHelper.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/ShellLinkHelper.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/ShellLinkHelper.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/ShellLinkHelper.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/UWP.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/UWP.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/UWP.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/UWP.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/UWPApplication.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/UWPApplication.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/UWPApplication.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/UWPApplication.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/Win32Program.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/Win32Program.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/Apps/Programs/Win32Program.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/Apps/Programs/Win32Program.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/QuitAction/QuitAction.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/QuitAction/QuitAction.cs similarity index 95% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/QuitAction/QuitAction.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/QuitAction/QuitAction.cs index 2cdfafbc94..29dcc4194f 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/QuitAction/QuitAction.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Builtins/QuitAction/QuitAction.cs @@ -20,7 +20,7 @@ public class QuitAction : InvokableCommand, IFallbackHandler public override ICommandResult Invoke() { QuitRequested?.Invoke(this, new()); - return ActionResult.KeepOpen(); + return CommandResult.KeepOpen(); } public void UpdateQuery(string query) diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/QuitAction/QuitActionProvider.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/QuitAction/QuitCommandProvider.cs similarity index 95% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/QuitAction/QuitActionProvider.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/QuitAction/QuitCommandProvider.cs index 3aefec8d92..c1d2fb31f3 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/QuitAction/QuitActionProvider.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Builtins/QuitAction/QuitCommandProvider.cs @@ -8,7 +8,7 @@ using Windows.Foundation; namespace WindowsCommandPalette.BuiltinCommands; -public class QuitActionProvider : ICommandProvider +public class QuitCommandProvider : ICommandProvider { public string DisplayName => string.Empty; diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/ReloadExtensionsAction.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/ReloadExtensionsAction.cs similarity index 95% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/ReloadExtensionsAction.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/ReloadExtensionsAction.cs index 97c35e252b..aaf1c7258e 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/ReloadExtensionsAction.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Builtins/ReloadExtensionsAction.cs @@ -17,7 +17,7 @@ public class ReloadExtensionsAction : InvokableCommand, IFallbackHandler public override ICommandResult Invoke() { - return ActionResult.GoHome(); + return CommandResult.GoHome(); } public void UpdateQuery(string query) diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/ReloadExtensionsActionProvider.cs b/src/modules/cmdpal/WindowsCommandPalette/Builtins/ReloadExtensionsCommandProvider.cs similarity index 93% rename from src/modules/cmdpal/src/WindowsCommandPalette/Builtins/ReloadExtensionsActionProvider.cs rename to src/modules/cmdpal/WindowsCommandPalette/Builtins/ReloadExtensionsCommandProvider.cs index b458d8e92b..ec89f2bd88 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Builtins/ReloadExtensionsActionProvider.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Builtins/ReloadExtensionsCommandProvider.cs @@ -8,7 +8,7 @@ using Windows.Foundation; namespace WindowsCommandPalette.BuiltinCommands; -public class ReloadExtensionsActionProvider : ICommandProvider +public class ReloadExtensionsCommandProvider : ICommandProvider { public string DisplayName => string.Empty; diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/ContextItemViewModel.cs b/src/modules/cmdpal/WindowsCommandPalette/ContextItemViewModel.cs similarity index 65% rename from src/modules/cmdpal/src/WindowsCommandPalette/ContextItemViewModel.cs rename to src/modules/cmdpal/WindowsCommandPalette/ContextItemViewModel.cs index 62dc5bc827..b63bfe85ea 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/ContextItemViewModel.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/ContextItemViewModel.cs @@ -2,31 +2,15 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; using System.ComponentModel; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Microsoft.Terminal.UI; -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Controls.Primitives; -using Microsoft.UI.Xaml.Data; -using Microsoft.UI.Xaml.Input; -using Microsoft.UI.Xaml.Media; -using Microsoft.UI.Xaml.Navigation; using Microsoft.CmdPal.Extensions; -using Windows.ApplicationModel.AppExtensions; -using Windows.Foundation; -using Windows.Foundation.Collections; +using Microsoft.UI.Xaml.Controls; namespace DeveloperCommandPalette; public sealed class ContextItemViewModel : INotifyPropertyChanged { - internal ICommand Command; + public ICommand Command { get; set; } internal string Name => Command.Name; @@ -38,9 +22,9 @@ public sealed class ContextItemViewModel : INotifyPropertyChanged internal IconElement IcoElement => Microsoft.Terminal.UI.IconPathConverter.IconMUX(Icon.Icon); - public ContextItemViewModel(ICommand action) + public ContextItemViewModel(ICommand cmd) { - this.Command = action; + this.Command = cmd; this.Command.PropChanged += Action_PropertyChanged; } diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/FilteredListSection.cs b/src/modules/cmdpal/WindowsCommandPalette/FilteredListSection.cs similarity index 98% rename from src/modules/cmdpal/src/WindowsCommandPalette/FilteredListSection.cs rename to src/modules/cmdpal/WindowsCommandPalette/FilteredListSection.cs index 8f72c7cd37..a856d99bbe 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/FilteredListSection.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/FilteredListSection.cs @@ -6,10 +6,10 @@ using System.Collections.ObjectModel; using System.Collections.Specialized; using System.Linq; using CmdPal.Models; -using Microsoft.UI.Dispatching; -using Microsoft.UI.Xaml; using Microsoft.CmdPal.Extensions; using Microsoft.CmdPal.Extensions.Helpers; +using Microsoft.UI.Dispatching; +using Microsoft.UI.Xaml; using WindowsCommandPalette.Views; namespace DeveloperCommandPalette; @@ -29,7 +29,7 @@ public sealed class FilteredListSection : ISection, INotifyCollectionChanged public ObservableCollection TopLevelItems { get; set; } // Apps, from the apps built in command. - private IEnumerable AllApps => _mainViewModel.apps.GetItems().First().Items; + private IEnumerable AllApps => _mainViewModel.Apps.GetItems().First().Items; // Results from the last searched text private IEnumerable? lastSearchResults; diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/ListItemViewModel.cs b/src/modules/cmdpal/WindowsCommandPalette/ListItemViewModel.cs similarity index 96% rename from src/modules/cmdpal/src/WindowsCommandPalette/ListItemViewModel.cs rename to src/modules/cmdpal/WindowsCommandPalette/ListItemViewModel.cs index 34be829198..91cc77074d 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/ListItemViewModel.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/ListItemViewModel.cs @@ -5,9 +5,9 @@ using System.ComponentModel; using System.Runtime.InteropServices; using CmdPal.Models; +using Microsoft.CmdPal.Extensions; using Microsoft.UI.Dispatching; using Microsoft.UI.Xaml.Controls; -using Microsoft.CmdPal.Extensions; using WindowsCommandPalette.Views; namespace DeveloperCommandPalette; @@ -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/MainListItem.cs b/src/modules/cmdpal/WindowsCommandPalette/MainListItem.cs new file mode 100644 index 0000000000..e24385e0b1 --- /dev/null +++ b/src/modules/cmdpal/WindowsCommandPalette/MainListItem.cs @@ -0,0 +1,55 @@ +// 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.Extensions.Helpers; + +namespace DeveloperCommandPalette; + +public sealed class MainListItem : ListItem +{ + public IListItem Item { get; set; } + + internal MainListItem(IListItem listItem) + : base(listItem.Command) + { + Item = listItem; + + Title = Item.Title ?? Item.Command.Name; + Subtitle = Item.Subtitle; + MoreCommands = Item.MoreCommands; + FallbackHandler = Item.FallbackHandler; + Tags = Item.Tags; + + if (Command != null) + { + Command.PropChanged += Action_PropertyChanged; + } + + Item.PropChanged += Action_PropertyChanged; + } + + private void Action_PropertyChanged(object sender, PropChangedEventArgs args) + { + if (args.PropertyName == "Name") + { + Title = !string.IsNullOrEmpty(Item.Title) ? Item.Title : Command?.Name ?? string.Empty; + OnPropertyChanged(nameof(Title)); + } + else if (args.PropertyName == nameof(Title)) + { + Title = Item.Title; + } + else if (args.PropertyName == nameof(Subtitle)) + { + Subtitle = Item.Subtitle; + } + else if (args.PropertyName == nameof(MoreCommands)) + { + MoreCommands = Item.MoreCommands; + } + + OnPropertyChanged(args.PropertyName); + } +} diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/MainListPage.cs b/src/modules/cmdpal/WindowsCommandPalette/MainListPage.cs similarity index 92% rename from src/modules/cmdpal/src/WindowsCommandPalette/MainListPage.cs rename to src/modules/cmdpal/WindowsCommandPalette/MainListPage.cs index 122d0f8d16..660b9c145d 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/MainListPage.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/MainListPage.cs @@ -68,7 +68,7 @@ public sealed class MainListPage : DynamicListPage // Eh, it's fine to be unsafe here, we're probably tossing MainListItem if (!_mainViewModel.Recent.Contains(listItem)) { - _mainSection._Items.Add(new MainListItem(listItem.Unsafe)); + _mainSection.TopLevelItems.Add(new MainListItem(listItem.Unsafe)); } _filteredSection.TopLevelItems.Add(new MainListItem(listItem.Unsafe)); @@ -81,11 +81,11 @@ public sealed class MainListPage : DynamicListPage { if (item is ExtensionObject listItem) { - foreach (var mainListItem in _mainSection._Items) + foreach (var mainListItem in _mainSection.TopLevelItems) { if (mainListItem.Item == listItem) { - _mainSection._Items.Remove(mainListItem); + _mainSection.TopLevelItems.Remove(mainListItem); break; } } diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/MainListSection.cs b/src/modules/cmdpal/WindowsCommandPalette/MainListSection.cs similarity index 74% rename from src/modules/cmdpal/src/WindowsCommandPalette/MainListSection.cs rename to src/modules/cmdpal/WindowsCommandPalette/MainListSection.cs index 11bed52b32..08de9e027b 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/MainListSection.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/MainListSection.cs @@ -4,12 +4,8 @@ using System.Collections.ObjectModel; using System.Collections.Specialized; -using System.Linq; -using CmdPal.Models; -using Microsoft.UI.Dispatching; -using Microsoft.UI.Xaml; using Microsoft.CmdPal.Extensions; -using Microsoft.CmdPal.Extensions.Helpers; +using Microsoft.UI.Dispatching; using WindowsCommandPalette.Views; namespace DeveloperCommandPalette; @@ -25,7 +21,7 @@ public sealed class MainListSection : ISection, INotifyCollectionChanged private readonly DispatcherQueue _dispatcherQueue = DispatcherQueue.GetForCurrentThread(); // Top-level list items, from builtin commands and extensions - internal ObservableCollection _Items { get; set; } + public ObservableCollection TopLevelItems { get; set; } // Things we should enumerate over, depending on the search query. // This is either @@ -33,8 +29,7 @@ public sealed class MainListSection : ISection, INotifyCollectionChanged // * OR one of: // * Just the top-level actions (if there's no query) // * OR the top-level actions AND the apps (if there's a query) - private IEnumerable itemsToEnumerate => - _Items.Where(i => i != null && (!_mainViewModel.IsRecentCommand(i))); + private IEnumerable TopLevelItemsToEnumerate => TopLevelItems.Where(i => i != null && (!_mainViewModel.IsRecentCommand(i))); // Watch out future me! // @@ -45,18 +40,18 @@ public sealed class MainListSection : ISection, INotifyCollectionChanged // // instead run the query once when the action query changes, and store the // results. - public IListItem[] Items => itemsToEnumerate.ToArray(); + public IListItem[] Items => TopLevelItemsToEnumerate.ToArray(); public MainListSection(MainViewModel viewModel) { this._mainViewModel = viewModel; - _Items = new(_mainViewModel.TopLevelCommands.Select(w => w.Unsafe).Where(li => li != null).Select(li => new MainListItem(li!))); - _Items.CollectionChanged += Bubble_CollectionChanged; + TopLevelItems = new(_mainViewModel.TopLevelCommands.Select(w => w.Unsafe).Where(li => li != null).Select(li => new MainListItem(li!))); + TopLevelItems.CollectionChanged += Bubble_CollectionChanged; } internal void UpdateQuery(string query) { - var fallbacks = _Items.Select(i => i?.FallbackHandler).Where(fb => fb != null).Select(fb => fb!); + var fallbacks = TopLevelItems.Select(i => i?.FallbackHandler).Where(fb => fb != null).Select(fb => fb!); foreach (var fb in fallbacks) { fb.UpdateQuery(query); @@ -73,6 +68,6 @@ public sealed class MainListSection : ISection, INotifyCollectionChanged internal void Reset() { - _Items.Clear(); + TopLevelItems.Clear(); } } diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/MainWindow.xaml b/src/modules/cmdpal/WindowsCommandPalette/MainWindow.xaml similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/MainWindow.xaml rename to src/modules/cmdpal/WindowsCommandPalette/MainWindow.xaml diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/MainWindow.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/MainWindow.xaml.cs similarity index 88% rename from src/modules/cmdpal/src/WindowsCommandPalette/MainWindow.xaml.cs rename to src/modules/cmdpal/WindowsCommandPalette/MainWindow.xaml.cs index afe2bee15e..37c70cff72 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/MainWindow.xaml.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/MainWindow.xaml.cs @@ -27,20 +27,24 @@ namespace DeveloperCommandPalette; /// public sealed partial class MainWindow : Window { - private readonly AppWindow m_AppWindow; + private readonly AppWindow _appWindow; - private MainViewModel _mainViewModel { get; init; } + private readonly MainViewModel _mainViewModel; private readonly HWND hwnd; - private const uint DOT_KEY = 0xBE; - private const uint WM_HOTKEY = 0x0312; private WNDPROC? origPrc; private WNDPROC? hotKeyPrc; - private Windows.Win32.Foundation.LRESULT HotKeyPrc(Windows.Win32.Foundation.HWND hwnd, - uint uMsg, - Windows.Win32.Foundation.WPARAM wParam, - Windows.Win32.Foundation.LPARAM lParam) +#pragma warning disable SA1310 // Field names should not contain underscore + private const uint DOT_KEY = 0xBE; + private const uint WM_HOTKEY = 0x0312; +#pragma warning restore SA1310 // Field names should not contain underscore + + private LRESULT HotKeyPrc( + HWND hwnd, + uint uMsg, + WPARAM wParam, + LPARAM lParam) { if (uMsg == WM_HOTKEY) { @@ -71,8 +75,8 @@ public sealed partial class MainWindow : Window public MainWindow() { - this.InitializeComponent(); - this._mainViewModel = MainPage.ViewModel; + InitializeComponent(); + _mainViewModel = MainPage.ViewModel; hwnd = new Windows.Win32.Foundation.HWND(WinRT.Interop.WindowNative.GetWindowHandle(this).ToInt32()); @@ -80,7 +84,7 @@ public sealed partial class MainWindow : Window // Assumes "this" is a XAML Window. In projects that don't use // WinUI 3 1.3 or later, use interop APIs to get the AppWindow. - m_AppWindow = this.AppWindow; + _appWindow = AppWindow; Activated += MainWindow_Activated; AppTitleBar.SizeChanged += AppTitleBar_SizeChanged; @@ -88,10 +92,10 @@ public sealed partial class MainWindow : Window ExtendsContentIntoTitleBar = true; // Hide our titlebar. We'll make the sides draggable later - m_AppWindow.TitleBar.PreferredHeightOption = TitleBarHeightOption.Collapsed; + _appWindow.TitleBar.PreferredHeightOption = TitleBarHeightOption.Collapsed; AppTitleTextBlock.Text = AppInfo.Current.DisplayInfo.DisplayName; - m_AppWindow.Title = AppTitleTextBlock.Text; + _appWindow.Title = AppTitleTextBlock.Text; Application.Current.GetService().SaveSettingAsync("ThisIsAVeryBizarreString", true); @@ -101,7 +105,7 @@ public sealed partial class MainWindow : Window _mainViewModel.QuitRequested += (s, e) => { - this.Close(); + Close(); // Application.Current.Exit(); }; @@ -120,8 +124,8 @@ public sealed partial class MainWindow : Window private void PositionCentered() { - m_AppWindow.Resize(new SizeInt32 { Width = 860, Height = 512 }); - DisplayArea displayArea = DisplayArea.GetFromWindowId(m_AppWindow.Id, DisplayAreaFallback.Nearest); + _appWindow.Resize(new SizeInt32 { Width = 860, Height = 512 }); + DisplayArea displayArea = DisplayArea.GetFromWindowId(_appWindow.Id, DisplayAreaFallback.Nearest); if (displayArea is not null) { var centeredPosition = AppWindow.Position; @@ -134,7 +138,7 @@ public sealed partial class MainWindow : Window private void PositionForStartMenu() { - m_AppWindow.Resize(new Windows.Graphics.SizeInt32(768, 768)); + _appWindow.Resize(new Windows.Graphics.SizeInt32(768, 768)); // now put the window in the right place // @@ -168,22 +172,22 @@ public sealed partial class MainWindow : Window // react appropriately } - Microsoft.UI.Windowing.DisplayArea displayArea = Microsoft.UI.Windowing.DisplayArea.GetFromWindowId(m_AppWindow.Id, Microsoft.UI.Windowing.DisplayAreaFallback.Nearest); + Microsoft.UI.Windowing.DisplayArea displayArea = Microsoft.UI.Windowing.DisplayArea.GetFromWindowId(_appWindow.Id, Microsoft.UI.Windowing.DisplayAreaFallback.Nearest); if (displayArea is not null) { - var centeredPosition = m_AppWindow.Position; + var centeredPosition = _appWindow.Position; if (onLeft) { centeredPosition.X = 16; - centeredPosition.Y = displayArea.WorkArea.Height - m_AppWindow.Size.Height - 16; + centeredPosition.Y = displayArea.WorkArea.Height - _appWindow.Size.Height - 16; } else { - centeredPosition.X = (displayArea.WorkArea.Width - m_AppWindow.Size.Width) / 2; - centeredPosition.Y = displayArea.WorkArea.Height - m_AppWindow.Size.Height - 16; + centeredPosition.X = (displayArea.WorkArea.Width - _appWindow.Size.Width) / 2; + centeredPosition.Y = displayArea.WorkArea.Height - _appWindow.Size.Height - 16; } - m_AppWindow.Move(centeredPosition); + _appWindow.Move(centeredPosition); } } @@ -215,8 +219,8 @@ public sealed partial class MainWindow : Window // Specify the interactive regions of the title bar. var scaleAdjustment = AppTitleBar.XamlRoot.RasterizationScale; - RightPaddingColumn.Width = new GridLength(m_AppWindow.TitleBar.RightInset / scaleAdjustment); - LeftPaddingColumn.Width = new GridLength(m_AppWindow.TitleBar.LeftInset / scaleAdjustment); + RightPaddingColumn.Width = new GridLength(_appWindow.TitleBar.RightInset / scaleAdjustment); + LeftPaddingColumn.Width = new GridLength(_appWindow.TitleBar.LeftInset / scaleAdjustment); //// Get the rectangle around the content GeneralTransform transform = MainPage.TransformToVisual(null); @@ -317,7 +321,7 @@ public sealed partial class MainWindow : Window return modifierString + keyString; } - private static (VirtualKey key, VirtualKeyModifiers modifiers) StringToKeybinding(string keybinding) + private static (VirtualKey Key, VirtualKeyModifiers Modifiers) StringToKeybinding(string keybinding) { var parts = keybinding.Split('+'); var modifiers = VirtualKeyModifiers.None; @@ -351,9 +355,10 @@ public sealed partial class MainWindow : Window return (key, modifiers); } - private static (uint vk, Windows.Win32.UI.Input.KeyboardAndMouse.HOT_KEY_MODIFIERS mod) UwpToWin32(VirtualKey key, VirtualKeyModifiers modifiers) + private static (uint Vk, Windows.Win32.UI.Input.KeyboardAndMouse.HOT_KEY_MODIFIERS Mod) UwpToWin32(VirtualKey key, VirtualKeyModifiers modifiers) { - Windows.Win32.UI.Input.KeyboardAndMouse.HOT_KEY_MODIFIERS mod = new(); + Windows.Win32.UI.Input.KeyboardAndMouse.HOT_KEY_MODIFIERS mod = default; + if (modifiers.HasFlag(VirtualKeyModifiers.Control)) { mod |= Windows.Win32.UI.Input.KeyboardAndMouse.HOT_KEY_MODIFIERS.MOD_CONTROL; diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Microsoft.CmdPal.UI.Poc.csproj b/src/modules/cmdpal/WindowsCommandPalette/Microsoft.CmdPal.UI.Poc.csproj similarity index 95% rename from src/modules/cmdpal/src/WindowsCommandPalette/Microsoft.CmdPal.UI.Poc.csproj rename to src/modules/cmdpal/WindowsCommandPalette/Microsoft.CmdPal.UI.Poc.csproj index c1acc8cdd9..c54f812f98 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Microsoft.CmdPal.UI.Poc.csproj +++ b/src/modules/cmdpal/WindowsCommandPalette/Microsoft.CmdPal.UI.Poc.csproj @@ -1,5 +1,5 @@  - + WinExe WindowsCommandPalette @@ -9,7 +9,6 @@ true enable enable - False @@ -68,7 +67,7 @@ - + diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Models/ExtensionObject`1.cs b/src/modules/cmdpal/WindowsCommandPalette/Models/ExtensionObject`1.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Models/ExtensionObject`1.cs rename to src/modules/cmdpal/WindowsCommandPalette/Models/ExtensionObject`1.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Models/ExtensionWrapper.cs b/src/modules/cmdpal/WindowsCommandPalette/Models/ExtensionWrapper.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Models/ExtensionWrapper.cs rename to src/modules/cmdpal/WindowsCommandPalette/Models/ExtensionWrapper.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/NativeMethods.txt b/src/modules/cmdpal/WindowsCommandPalette/NativeMethods.txt similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/NativeMethods.txt rename to src/modules/cmdpal/WindowsCommandPalette/NativeMethods.txt diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Package.appxmanifest b/src/modules/cmdpal/WindowsCommandPalette/Package.appxmanifest similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Package.appxmanifest rename to src/modules/cmdpal/WindowsCommandPalette/Package.appxmanifest diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/PageViewModel.cs b/src/modules/cmdpal/WindowsCommandPalette/PageViewModel.cs similarity index 85% rename from src/modules/cmdpal/src/WindowsCommandPalette/PageViewModel.cs rename to src/modules/cmdpal/WindowsCommandPalette/PageViewModel.cs index 99065255ee..5c6350f324 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/PageViewModel.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/PageViewModel.cs @@ -9,11 +9,9 @@ namespace DeveloperCommandPalette; public class PageViewModel { - private bool nested; + public bool Nested { get; set; } - public bool Nested { get => nested; set => nested = value; } - - protected IPage pageAction { get; } + public IPage PageAction { get; } // public IPage PageAction { get => pageAction; set => pageAction = value; } public ActionViewModel Command { get; } @@ -26,8 +24,8 @@ public class PageViewModel protected PageViewModel(IPage page) { - this.pageAction = page; - this.Command = new(page); + PageAction = page; + Command = new(page); } public void DoAction(ActionViewModel action) diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Program.cs b/src/modules/cmdpal/WindowsCommandPalette/Program.cs similarity index 96% rename from src/modules/cmdpal/src/WindowsCommandPalette/Program.cs rename to src/modules/cmdpal/WindowsCommandPalette/Program.cs index 2f2464a74b..507e295804 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Program.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Program.cs @@ -13,7 +13,7 @@ namespace DeveloperCommandPalette; // cribbed heavily from // // https://github.com/microsoft/WindowsAppSDK-Samples/tree/main/Samples/AppLifecycle/Instancing/cs2/cs-winui-packaged/CsWinUiDesktopInstancing -sealed class Program +internal sealed class Program { private static App? app; @@ -21,7 +21,7 @@ sealed class Program // // Main cannot be async. If it is, then the clipboard won't work, and neither will narrator. [STAThread] - static int Main(string[] args) + private static int Main(string[] args) { WinRT.ComWrappersSupport.InitializeComWrappers(); var isRedirect = DecideRedirection(); diff --git a/src/modules/cmdpal/extensions/TemplateExtension/Properties/PublishProfiles/win-x86.pubxml b/src/modules/cmdpal/WindowsCommandPalette/Properties/PublishProfiles/win-x64.pubxml similarity index 77% rename from src/modules/cmdpal/extensions/TemplateExtension/Properties/PublishProfiles/win-x86.pubxml rename to src/modules/cmdpal/WindowsCommandPalette/Properties/PublishProfiles/win-x64.pubxml index 4ed30a5eed..fb069f3e3d 100644 --- a/src/modules/cmdpal/extensions/TemplateExtension/Properties/PublishProfiles/win-x86.pubxml +++ b/src/modules/cmdpal/WindowsCommandPalette/Properties/PublishProfiles/win-x64.pubxml @@ -5,15 +5,15 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem - x86 - win-x86 - win10-x86 + x64 + win-x64 + win10-x64 bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ true False False True False - True + False - \ No newline at end of file + diff --git a/src/modules/cmdpal/WindowsCommandPalette/Properties/launchSettings.json b/src/modules/cmdpal/WindowsCommandPalette/Properties/launchSettings.json new file mode 100644 index 0000000000..2043707ea3 --- /dev/null +++ b/src/modules/cmdpal/WindowsCommandPalette/Properties/launchSettings.json @@ -0,0 +1,10 @@ +{ + "profiles": { + "WindowsCommandPalette (Package)": { + "commandName": "MsixPackage" + }, + "WindowsCommandPalette (Unpackaged)": { + "commandName": "Project" + } + } +} \ No newline at end of file diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/RecentsListSection.cs b/src/modules/cmdpal/WindowsCommandPalette/RecentsListSection.cs similarity index 70% rename from src/modules/cmdpal/src/WindowsCommandPalette/RecentsListSection.cs rename to src/modules/cmdpal/WindowsCommandPalette/RecentsListSection.cs index 8983549e9e..6bfc2ee452 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/RecentsListSection.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/RecentsListSection.cs @@ -4,12 +4,9 @@ using System.Collections.ObjectModel; using System.Collections.Specialized; -using System.Linq; -using CmdPal.Models; -using Microsoft.UI.Dispatching; -using Microsoft.UI.Xaml; using Microsoft.CmdPal.Extensions; using Microsoft.CmdPal.Extensions.Helpers; +using Microsoft.UI.Dispatching; using WindowsCommandPalette.Views; namespace DeveloperCommandPalette; @@ -21,26 +18,27 @@ public sealed class RecentsListSection : ListSection, INotifyCollectionChanged private readonly DispatcherQueue _dispatcherQueue = DispatcherQueue.GetForCurrentThread(); private readonly MainViewModel _mainViewModel; - internal ObservableCollection _Items { get; set; } = []; + private readonly ObservableCollection _items = []; private bool loadedApps; public RecentsListSection(MainViewModel viewModel) { - this.Title = "Recent"; - this._mainViewModel = viewModel; + Title = "Recent"; + _mainViewModel = viewModel; var recent = _mainViewModel.RecentActions; Reset(); - _Items.CollectionChanged += Bubble_CollectionChanged; + _items.CollectionChanged += Bubble_CollectionChanged; - _mainViewModel.AppsReady += _mainViewModel_AppsReady; + _mainViewModel.AppsReady += MainViewModel_AppsReady; } - private void _mainViewModel_AppsReady(object sender, object? args) + private void MainViewModel_AppsReady(object sender, object? args) { loadedApps = true; - _mainViewModel.AppsReady -= _mainViewModel_AppsReady; + _mainViewModel.AppsReady -= MainViewModel_AppsReady; + AddApps(); } @@ -52,11 +50,11 @@ public sealed class RecentsListSection : ListSection, INotifyCollectionChanged }); } - public override IListItem[] Items => _Items.ToArray(); + public override IListItem[] Items => _items.ToArray(); internal void Reset() { - _Items.Clear(); + _items.Clear(); if (loadedApps) { AddApps(); @@ -68,7 +66,7 @@ public sealed class RecentsListSection : ListSection, INotifyCollectionChanged var apps = _mainViewModel.Recent; foreach (var app in apps) { - _Items.Add(new MainListItem(app.Unsafe)); // we know these are all local + _items.Add(new MainListItem(app.Unsafe)); // we know these are all local } } } diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Services/ExtensionService.cs b/src/modules/cmdpal/WindowsCommandPalette/Services/ExtensionService.cs similarity index 97% rename from src/modules/cmdpal/src/WindowsCommandPalette/Services/ExtensionService.cs rename to src/modules/cmdpal/WindowsCommandPalette/Services/ExtensionService.cs index 5adb899259..038b6216c7 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Services/ExtensionService.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Services/ExtensionService.cs @@ -6,8 +6,8 @@ using CmdPal.Models; using Microsoft.CmdPal.Common.Contracts; using Microsoft.CmdPal.Common.Extensions; using Microsoft.CmdPal.Common.Services; -using Microsoft.UI.Xaml; using Microsoft.CmdPal.Extensions; +using Microsoft.UI.Xaml; using Windows.ApplicationModel; using Windows.ApplicationModel.AppExtensions; using Windows.Foundation.Collections; @@ -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(); @@ -168,8 +168,9 @@ public class ExtensionService : IExtensionService, IDisposable var extensions = await GetInstalledAppExtensionsAsync(); foreach (var extension in extensions) { - var (CmdPalProvider, classIds) = await GetCmdPalExtensionPropertiesAsync(extension); - if (CmdPalProvider == null || classIds.Count == 0) + var (cmdPalProvider, classIds) = await GetCmdPalExtensionPropertiesAsync(extension); + + if (cmdPalProvider == null || classIds.Count == 0) { continue; } @@ -178,7 +179,7 @@ public class ExtensionService : IExtensionService, IDisposable { var extensionWrapper = new ExtensionWrapper(extension, classId); - var supportedInterfaces = GetSubPropertySet(CmdPalProvider, "SupportedInterfaces"); + var supportedInterfaces = GetSubPropertySet(cmdPalProvider, "SupportedInterfaces"); if (supportedInterfaces is not null) { foreach (var supportedInterface in supportedInterfaces) diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/SubmitFormArgs.cs b/src/modules/cmdpal/WindowsCommandPalette/SubmitFormArgs.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/SubmitFormArgs.cs rename to src/modules/cmdpal/WindowsCommandPalette/SubmitFormArgs.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/TagViewModel.cs b/src/modules/cmdpal/WindowsCommandPalette/TagViewModel.cs similarity index 67% rename from src/modules/cmdpal/src/WindowsCommandPalette/TagViewModel.cs rename to src/modules/cmdpal/WindowsCommandPalette/TagViewModel.cs index a58a2283c8..5b1678069e 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/TagViewModel.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/TagViewModel.cs @@ -3,20 +3,20 @@ // See the LICENSE file in the project root for more information. using System.ComponentModel; +using Microsoft.CmdPal.Extensions; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Media; -using Microsoft.CmdPal.Extensions; using Windows.UI; 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/src/WindowsCommandPalette/Themes/Generic.xaml b/src/modules/cmdpal/WindowsCommandPalette/Themes/Generic.xaml similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Themes/Generic.xaml rename to src/modules/cmdpal/WindowsCommandPalette/Themes/Generic.xaml diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Views/ActionsProviderWrapper.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/Views/CommandProviderWrapper.cs similarity index 64% rename from src/modules/cmdpal/src/WindowsCommandPalette/Views/ActionsProviderWrapper.xaml.cs rename to src/modules/cmdpal/WindowsCommandPalette/Views/CommandProviderWrapper.cs index 6e660dc965..ffd70b7aa5 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Views/ActionsProviderWrapper.xaml.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Views/CommandProviderWrapper.cs @@ -2,46 +2,32 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Collections.ObjectModel; -using System.Runtime.InteropServices; -using System.Runtime.InteropServices.WindowsRuntime; -using CmdPal.Models; -using DeveloperCommandPalette; -using Microsoft.CmdPal.Common.Extensions; using Microsoft.CmdPal.Common.Services; -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Input; -using Microsoft.UI.Xaml.Media.Animation; using Microsoft.CmdPal.Extensions; -using Microsoft.CmdPal.Extensions.Helpers; -using Windows.Foundation; using Windows.Win32; -using WindowsCommandPalette.BuiltinCommands; -using WindowsCommandPalette.BuiltinCommands.AllApps; namespace WindowsCommandPalette.Views; -internal sealed class ActionsProviderWrapper +public sealed class CommandProviderWrapper { public bool IsExtension => extensionWrapper != null; private readonly bool isValid; - private ICommandProvider ActionProvider { get; } + private ICommandProvider CommandProvider { get; } private readonly IExtensionWrapper? extensionWrapper; private IListItem[] _topLevelItems = []; public IListItem[] TopLevelItems => _topLevelItems; - public ActionsProviderWrapper(ICommandProvider provider) + public CommandProviderWrapper(ICommandProvider provider) { - ActionProvider = provider; + CommandProvider = provider; isValid = true; } - public ActionsProviderWrapper(IExtensionWrapper extension) + public CommandProviderWrapper(IExtensionWrapper extension) { extensionWrapper = extension; var extensionImpl = extension.GetExtensionObject(); @@ -50,7 +36,7 @@ internal sealed class ActionsProviderWrapper throw new ArgumentException("extension didn't actually implement ICommandProvider"); } - ActionProvider = provider; + CommandProvider = provider; isValid = true; } @@ -61,7 +47,7 @@ internal sealed class ActionsProviderWrapper return; } - var t = new Task(() => ActionProvider.TopLevelCommands()); + var t = new Task(() => CommandProvider.TopLevelCommands()); t.Start(); var commands = await t.ConfigureAwait(false); @@ -86,7 +72,7 @@ internal sealed class ActionsProviderWrapper } } - public override bool Equals(object? obj) => obj is ActionsProviderWrapper wrapper && isValid == wrapper.isValid; + public override bool Equals(object? obj) => obj is CommandProviderWrapper wrapper && isValid == wrapper.isValid; public override int GetHashCode() { diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Views/DetailsControl.xaml b/src/modules/cmdpal/WindowsCommandPalette/Views/DetailsControl.xaml similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Views/DetailsControl.xaml rename to src/modules/cmdpal/WindowsCommandPalette/Views/DetailsControl.xaml diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Views/DetailsControl.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/Views/DetailsControl.xaml.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Views/DetailsControl.xaml.cs rename to src/modules/cmdpal/WindowsCommandPalette/Views/DetailsControl.xaml.cs diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Views/DetailsViewModel.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/Views/DetailsViewModel.xaml.cs similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Views/DetailsViewModel.xaml.cs rename to src/modules/cmdpal/WindowsCommandPalette/Views/DetailsViewModel.xaml.cs index e068351d8c..1868264ec9 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Views/DetailsViewModel.xaml.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Views/DetailsViewModel.xaml.cs @@ -2,8 +2,8 @@ // 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.UI.Xaml.Controls; using Microsoft.CmdPal.Extensions; +using Microsoft.UI.Xaml.Controls; // To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. diff --git a/src/modules/cmdpal/WindowsCommandPalette/Views/ErrorListItem.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/Views/ErrorListItem.xaml.cs new file mode 100644 index 0000000000..5078115cda --- /dev/null +++ b/src/modules/cmdpal/WindowsCommandPalette/Views/ErrorListItem.xaml.cs @@ -0,0 +1,17 @@ +// 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.Helpers; + +namespace WindowsCommandPalette.Views; + +public sealed class ErrorListItem : ListItem +{ + public ErrorListItem(Exception ex) + : base(new NoOpAction()) + { + Title = "Error in extension:"; + Subtitle = ex.Message; + } +} diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Views/FormPage.xaml b/src/modules/cmdpal/WindowsCommandPalette/Views/FormPage.xaml similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Views/FormPage.xaml rename to src/modules/cmdpal/WindowsCommandPalette/Views/FormPage.xaml diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Views/FormPage.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/Views/FormPage.xaml.cs similarity index 96% rename from src/modules/cmdpal/src/WindowsCommandPalette/Views/FormPage.xaml.cs rename to src/modules/cmdpal/WindowsCommandPalette/Views/FormPage.xaml.cs index 95fdc6feef..d28c1d6ffb 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Views/FormPage.xaml.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Views/FormPage.xaml.cs @@ -14,8 +14,9 @@ namespace WindowsCommandPalette.Views; public sealed partial class FormPage : Page { - private readonly AdaptiveCardRenderer Renderer = new(); - private FormPageViewModel? ViewModel; + private readonly AdaptiveCardRenderer _renderer = new(); + + public FormPageViewModel? ViewModel { get; set; } public FormPage() { @@ -26,12 +27,12 @@ public sealed partial class FormPage : Page // yep it's this dumb var foreground = settings.GetColorValue(UIColorType.Foreground); var lightTheme = foreground.R < 128; - Renderer.HostConfig = AdaptiveHostConfig.FromJsonString(lightTheme ? LightHostConfig : DarkHostConfig).HostConfig; + _renderer.HostConfig = AdaptiveHostConfig.FromJsonString(lightTheme ? LightHostConfig : DarkHostConfig).HostConfig; } private void AddCardElement(FormViewModel form) { - form.RenderToXaml(Renderer); + form.RenderToXaml(_renderer); } protected override void OnNavigatedTo(NavigationEventArgs e) diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Views/FormPageViewModel.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/Views/FormPageViewModel.xaml.cs similarity index 71% rename from src/modules/cmdpal/src/WindowsCommandPalette/Views/FormPageViewModel.xaml.cs rename to src/modules/cmdpal/WindowsCommandPalette/Views/FormPageViewModel.xaml.cs index e4e005999a..6be6722daa 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Views/FormPageViewModel.xaml.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Views/FormPageViewModel.xaml.cs @@ -2,30 +2,17 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using System.Collections.ObjectModel; -using System.ComponentModel; -using AdaptiveCards.ObjectModel.WinUI3; -using AdaptiveCards.Rendering.WinUI3; -using AdaptiveCards.Templating; using DeveloperCommandPalette; -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Input; -using Microsoft.UI.Xaml.Navigation; using Microsoft.CmdPal.Extensions; -using Microsoft.CmdPal.Extensions.Helpers; -using Windows.Foundation; -using Windows.System; -using Windows.UI.ViewManagement; namespace WindowsCommandPalette.Views; public sealed class FormPageViewModel : PageViewModel { - internal IFormPage Page => (IFormPage)this.pageAction; + 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/src/WindowsCommandPalette/Views/FormViewModel.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/Views/FormViewModel.xaml.cs similarity index 66% rename from src/modules/cmdpal/src/WindowsCommandPalette/Views/FormViewModel.xaml.cs rename to src/modules/cmdpal/WindowsCommandPalette/Views/FormViewModel.xaml.cs index ad1b95318c..fb400d5cd0 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Views/FormViewModel.xaml.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Views/FormViewModel.xaml.cs @@ -7,62 +7,63 @@ using AdaptiveCards.ObjectModel.WinUI3; using AdaptiveCards.Rendering.WinUI3; using AdaptiveCards.Templating; using DeveloperCommandPalette; -using Microsoft.UI.Xaml; using Microsoft.CmdPal.Extensions; +using Microsoft.UI.Xaml; using Windows.Foundation; using Windows.System; namespace WindowsCommandPalette.Views; -public sealed class FormViewModel : System.ComponentModel.INotifyPropertyChanged +public sealed class FormViewModel : INotifyPropertyChanged { - internal readonly IForm form; - internal AdaptiveCardParseResult? card; - internal RenderedAdaptiveCard? RenderedAdaptiveCard; - internal string TemplateJson = "{}"; - internal string DataJson = "{}"; + private readonly IForm _form; + private AdaptiveCardParseResult? _card; + private RenderedAdaptiveCard? _renderedAdaptiveCard; + private string _templateJson = "{}"; + private string _dataJson = "{}"; public event TypedEventHandler? RequestSubmitForm; public event PropertyChangedEventHandler? PropertyChanged; - public bool ShouldDisplay => RenderedAdaptiveCard?.FrameworkElement != null; + public bool ShouldDisplay => _renderedAdaptiveCard?.FrameworkElement != null; - public FrameworkElement? RenderedChildElement => RenderedAdaptiveCard?.FrameworkElement; + public FrameworkElement? RenderedChildElement => _renderedAdaptiveCard?.FrameworkElement; public FormViewModel(IForm form) { - this.form = form; + this._form = form; } internal void InitialRender() { // var t = new Task(() => { - this.TemplateJson = this.form.TemplateJson(); + this._templateJson = this._form.TemplateJson(); + try { - this.DataJson = this.form.DataJson(); + this._dataJson = this._form.DataJson(); } catch (Exception) { - this.DataJson = "{}"; + this._dataJson = "{}"; } // return true; // }); // t.Start(); // await t; - AdaptiveCardTemplate template = new(TemplateJson); - var cardJson = template.Expand(DataJson); - this.card = AdaptiveCard.FromJsonString(cardJson); + AdaptiveCardTemplate template = new(_templateJson); + var cardJson = template.Expand(_dataJson); + this._card = AdaptiveCard.FromJsonString(cardJson); } internal void RenderToXaml(AdaptiveCardRenderer renderer) { - if (this.card != null) + if (this._card != null) { - RenderedAdaptiveCard = renderer.RenderAdaptiveCard(card.AdaptiveCard); - RenderedAdaptiveCard.Action += RenderedAdaptiveCard_Action; + _renderedAdaptiveCard = renderer.RenderAdaptiveCard(_card.AdaptiveCard); + _renderedAdaptiveCard.Action += RenderedAdaptiveCard_Action; var handlers = this.PropertyChanged; handlers?.Invoke(this, new PropertyChangedEventArgs(nameof(ShouldDisplay))); @@ -86,7 +87,7 @@ public sealed class FormViewModel : System.ComponentModel.INotifyPropertyChanged // Process them as desired var handlers = RequestSubmitForm; - handlers?.Invoke(this, new() { FormData = inputs, Form = form }); + handlers?.Invoke(this, new() { FormData = inputs, Form = _form }); } } } diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Views/ListPage.xaml b/src/modules/cmdpal/WindowsCommandPalette/Views/ListPage.xaml similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Views/ListPage.xaml rename to src/modules/cmdpal/WindowsCommandPalette/Views/ListPage.xaml diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Views/ListPage.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/Views/ListPage.xaml.cs similarity index 94% rename from src/modules/cmdpal/src/WindowsCommandPalette/Views/ListPage.xaml.cs rename to src/modules/cmdpal/WindowsCommandPalette/Views/ListPage.xaml.cs index ac55cec986..838439428d 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Views/ListPage.xaml.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Views/ListPage.xaml.cs @@ -4,6 +4,7 @@ using System.ComponentModel; using DeveloperCommandPalette; +using Microsoft.CmdPal.Extensions.Helpers; using Microsoft.UI.Dispatching; using Microsoft.UI.Input; using Microsoft.UI.Xaml; @@ -11,14 +12,13 @@ using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Controls.Primitives; using Microsoft.UI.Xaml.Input; using Microsoft.UI.Xaml.Navigation; -using Microsoft.CmdPal.Extensions.Helpers; namespace WindowsCommandPalette.Views; /// /// An empty page that can be used on its own or navigated to within a Frame. /// -public sealed partial class ListPage : Page, INotifyPropertyChanged +public sealed partial class ListPage : Microsoft.UI.Xaml.Controls.Page, INotifyPropertyChanged { public ListPageViewModel? ViewModel { get; set; } @@ -255,20 +255,16 @@ public sealed partial class ListPage : Page, INotifyPropertyChanged } e.Handled = true; - } - else if (ctrlPressed && e.Key == Windows.System.VirtualKey.K) // ctrl+k + } // ctrl+k + else if (ctrlPressed && e.Key == Windows.System.VirtualKey.K && ActionsDropdown.Items.Count > 0) { - // Open the more actions flyout and focus the first item - if (ActionsDropdown.Items.Count > 0) + FlyoutShowOptions options = new FlyoutShowOptions { - FlyoutShowOptions options = new FlyoutShowOptions - { - ShowMode = FlyoutShowMode.Standard, - }; - MoreCommandsButton.Flyout.ShowAt(MoreCommandsButton, options); - ActionsDropdown.SelectedIndex = 0; - ActionsDropdown.Focus(FocusState.Programmatic); - } + ShowMode = FlyoutShowMode.Standard, + }; + MoreCommandsButton.Flyout.ShowAt(MoreCommandsButton, options); + ActionsDropdown.SelectedIndex = 0; + ActionsDropdown.Focus(FocusState.Programmatic); } } diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Views/ListPageViewModel.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/Views/ListPageViewModel.xaml.cs similarity index 83% rename from src/modules/cmdpal/src/WindowsCommandPalette/Views/ListPageViewModel.xaml.cs rename to src/modules/cmdpal/WindowsCommandPalette/Views/ListPageViewModel.xaml.cs index 6a38ab72ef..34fe9d25f5 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Views/ListPageViewModel.xaml.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Views/ListPageViewModel.xaml.cs @@ -5,25 +5,26 @@ using System.Collections.ObjectModel; using System.Runtime.InteropServices; using DeveloperCommandPalette; -using Microsoft.UI.Dispatching; using Microsoft.CmdPal.Extensions; using Microsoft.CmdPal.Extensions.Helpers; +using Microsoft.UI.Dispatching; namespace WindowsCommandPalette.Views; public sealed class ListPageViewModel : PageViewModel { - internal readonly ObservableCollection Items = []; - internal readonly ObservableCollection FilteredItems = []; + private readonly ObservableCollection _items = []; - internal IListPage Page => (IListPage)this.pageAction; + public ObservableCollection FilteredItems { get; set; } = []; - private bool isDynamic => Page is IDynamicListPage; + internal IListPage Page => (IListPage)this.PageAction; - private IDynamicListPage? dynamicPage => Page as IDynamicListPage; + private bool IsDynamic => Page is IDynamicListPage; + + private IDynamicListPage? IsDynamicPage => Page as IDynamicListPage; private readonly DispatcherQueue _dispatcherQueue = DispatcherQueue.GetForCurrentThread(); - internal string Query = string.Empty; + private string _query = string.Empty; public ListPageViewModel(IListPage page) : base(page) @@ -42,8 +43,8 @@ public sealed class ListPageViewModel : PageViewModel { try { - return dynamicPage != null ? - dynamicPage.GetItems(Query) : + return IsDynamicPage != null ? + IsDynamicPage.GetItems(_query) : this.Page.GetItems(); } catch (Exception ex) @@ -92,19 +93,19 @@ public sealed class ListPageViewModel : PageViewModel // FilteredItems.Add(sectionItems); } - ListHelpers.InPlaceUpdateList(Items, newItems); + ListHelpers.InPlaceUpdateList(_items, newItems); ListHelpers.InPlaceUpdateList(FilteredItems, newItems); } internal async Task> GetFilteredItems(string query) { - if (query == Query) + if (query == _query) { return FilteredItems; } - Query = query; - if (isDynamic) + _query = query; + if (IsDynamic) { await UpdateListItems(); return FilteredItems; @@ -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,10 +123,10 @@ 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)); + _query).Select(li => new ListItemViewModel(li)); var newSection = new SectionInfoList(null, allFilteredItems); return [newSection]; diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Views/MainPage.xaml b/src/modules/cmdpal/WindowsCommandPalette/Views/MainPage.xaml similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Views/MainPage.xaml rename to src/modules/cmdpal/WindowsCommandPalette/Views/MainPage.xaml diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Views/MainPage.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/Views/MainPage.xaml.cs similarity index 93% rename from src/modules/cmdpal/src/WindowsCommandPalette/Views/MainPage.xaml.cs rename to src/modules/cmdpal/WindowsCommandPalette/Views/MainPage.xaml.cs index 35ecf971ad..eaa6553428 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Views/MainPage.xaml.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Views/MainPage.xaml.cs @@ -6,11 +6,11 @@ using System.Runtime.InteropServices; using DeveloperCommandPalette; using Microsoft.CmdPal.Common.Extensions; using Microsoft.CmdPal.Common.Services; +using Microsoft.CmdPal.Extensions; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Input; using Microsoft.UI.Xaml.Media.Animation; -using Microsoft.CmdPal.Extensions; namespace WindowsCommandPalette.Views; @@ -89,10 +89,11 @@ public sealed partial class MainPage : Page { // Load commands from builtins // TODO! I don't understand async enough to get why this has to be ConfigureAwait(false) - foreach (var provider in ViewModel._builtInCommands) + foreach (var provider in ViewModel.BuiltInCommands) { - var wrapper = new ActionsProviderWrapper(provider); - ViewModel.CommandsProviders.Add(wrapper); + var wrapper = new CommandProviderWrapper(provider); + ViewModel.ActionsProvider.Add(wrapper); + await LoadTopLevelCommandsFromProvider(wrapper).ConfigureAwait(false); } } @@ -138,7 +139,7 @@ public sealed partial class MainPage : Page private void TryAllowForeground(ICommand action) { - foreach (var provider in ViewModel.CommandsProviders) + foreach (var provider in ViewModel.ActionsProvider) { if (!provider.IsExtension) { @@ -270,8 +271,8 @@ public sealed partial class MainPage : Page try { await extension.StartExtensionAsync(); - var wrapper = new ActionsProviderWrapper(extension); - ViewModel.CommandsProviders.Add(wrapper); + var wrapper = new CommandProviderWrapper(extension); + ViewModel.ActionsProvider.Add(wrapper); await LoadTopLevelCommandsFromProvider(wrapper); } catch (Exception ex) @@ -280,11 +281,11 @@ public sealed partial class MainPage : Page } } - private async Task LoadTopLevelCommandsFromProvider(ActionsProviderWrapper actionProvider) + private async Task LoadTopLevelCommandsFromProvider(CommandProviderWrapper commandProvider) { // TODO! do this better async - await actionProvider.LoadTopLevelCommands().ConfigureAwait(false); - foreach (var i in actionProvider.TopLevelItems) + await commandProvider.LoadTopLevelCommands().ConfigureAwait(false); + foreach (var i in commandProvider.TopLevelItems) { ViewModel.TopLevelCommands.Add(new(i)); } diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Views/MainViewModel.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/Views/MainViewModel.xaml.cs similarity index 75% rename from src/modules/cmdpal/src/WindowsCommandPalette/Views/MainViewModel.xaml.cs rename to src/modules/cmdpal/WindowsCommandPalette/Views/MainViewModel.xaml.cs index 8db145677e..8f9f31fc15 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Views/MainViewModel.xaml.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Views/MainViewModel.xaml.cs @@ -7,40 +7,37 @@ using System.Runtime.InteropServices; using System.Runtime.InteropServices.WindowsRuntime; using CmdPal.Models; using DeveloperCommandPalette; -using Microsoft.CmdPal.Common.Extensions; -using Microsoft.CmdPal.Common.Services; using Microsoft.CmdPal.Ext.Bookmarks; using Microsoft.CmdPal.Ext.Calc; using Microsoft.CmdPal.Ext.Settings; -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Input; -using Microsoft.UI.Xaml.Media.Animation; using Microsoft.CmdPal.Extensions; using Microsoft.CmdPal.Extensions.Helpers; using Windows.Foundation; -using Windows.Win32; using WindowsCommandPalette.BuiltinCommands; using WindowsCommandPalette.BuiltinCommands.AllApps; namespace WindowsCommandPalette.Views; -public sealed class MainViewModel +public sealed class MainViewModel : IDisposable { - internal readonly AllAppsPage apps = new(); - internal readonly QuitActionProvider quitActionProvider = new(); - internal readonly ReloadExtensionsActionProvider reloadActionProvider = new(); + private readonly QuitCommandProvider _quitCommandProvider = new(); + private readonly ReloadExtensionsCommandProvider _reloadCommandProvider = new(); - public event TypedEventHandler? QuitRequested { add => quitActionProvider.QuitRequested += value; remove => quitActionProvider.QuitRequested -= value; } + public AllAppsPage Apps { get; set; } = new(); - internal readonly ObservableCollection CommandsProviders = new(); - internal readonly ObservableCollection> TopLevelCommands = []; + public event TypedEventHandler? QuitRequested { add => _quitCommandProvider.QuitRequested += value; remove => _quitCommandProvider.QuitRequested -= value; } - internal readonly List _builtInCommands = []; + public ObservableCollection ActionsProvider { get; set; } = []; - internal bool Loaded; - internal bool LoadingExtensions; - internal bool LoadedApps; + public ObservableCollection> TopLevelCommands { get; set; } = []; + + public List BuiltInCommands { get; set; } = []; + + public bool Loaded { get; set; } + + public bool LoadingExtensions { get; set; } + + public bool LoadedApps { get; set; } public event TypedEventHandler? HideRequested; @@ -50,18 +47,19 @@ public sealed class MainViewModel internal MainViewModel() { - _builtInCommands.Add(new BookmarksActionProvider()); - _builtInCommands.Add(new CalculatorActionProvider()); - _builtInCommands.Add(new SettingsActionProvider()); - _builtInCommands.Add(quitActionProvider); - _builtInCommands.Add(reloadActionProvider); + BuiltInCommands.Add(new BookmarksCommandProvider()); + BuiltInCommands.Add(new CalculatorCommandProvider()); + BuiltInCommands.Add(new SettingsCommandProvider()); + BuiltInCommands.Add(_quitCommandProvider); + BuiltInCommands.Add(_reloadCommandProvider); ResetTopLevel(); // On a background thread, warm up the app cache since we want it more often than not new Task(() => { - var _ = AppCache.Instance.Value; + _ = AppCache.Instance.Value; + LoadedApps = true; AppsReady?.Invoke(this, null); }).Start(); @@ -70,7 +68,7 @@ public sealed class MainViewModel public void ResetTopLevel() { TopLevelCommands.Clear(); - TopLevelCommands.Add(new(new ListItem(apps))); + TopLevelCommands.Add(new(new ListItem(Apps))); } internal void RequestHide() @@ -111,7 +109,7 @@ public sealed class MainViewModel return false; }).Select(i => i!); - public IEnumerable AppItems => LoadedApps ? apps.GetItems().First().Items : []; + public IEnumerable AppItems => LoadedApps ? Apps.GetItems().First().Items : []; public IEnumerable> Everything => TopLevelCommands .Concat(AppItems.Select(i => new ExtensionObject(i))) @@ -183,4 +181,10 @@ public sealed class MainViewModel } } } + + public void Dispose() + { + _quitCommandProvider.Dispose(); + _reloadCommandProvider.Dispose(); + } } diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Views/MarkdownPage.xaml b/src/modules/cmdpal/WindowsCommandPalette/Views/MarkdownPage.xaml similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/Views/MarkdownPage.xaml rename to src/modules/cmdpal/WindowsCommandPalette/Views/MarkdownPage.xaml diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Views/MarkdownPage.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/Views/MarkdownPage.xaml.cs similarity index 98% rename from src/modules/cmdpal/src/WindowsCommandPalette/Views/MarkdownPage.xaml.cs rename to src/modules/cmdpal/WindowsCommandPalette/Views/MarkdownPage.xaml.cs index e9a0948cdd..371d218a96 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Views/MarkdownPage.xaml.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Views/MarkdownPage.xaml.cs @@ -4,19 +4,19 @@ using System.ComponentModel; using DeveloperCommandPalette; +using Microsoft.CmdPal.Extensions; using Microsoft.UI.Input; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Controls.Primitives; using Microsoft.UI.Xaml.Input; using Microsoft.UI.Xaml.Navigation; -using Microsoft.CmdPal.Extensions; namespace WindowsCommandPalette.Views; public sealed partial class MarkdownPage : Page, INotifyPropertyChanged { - private MarkdownPageViewModel? ViewModel; + public MarkdownPageViewModel? ViewModel { get; set; } #pragma warning disable CS0067 public event PropertyChangedEventHandler? PropertyChanged; diff --git a/src/modules/cmdpal/WindowsCommandPalette/Views/MarkdownPageViewModel.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/Views/MarkdownPageViewModel.xaml.cs new file mode 100644 index 0000000000..8730cce05c --- /dev/null +++ b/src/modules/cmdpal/WindowsCommandPalette/Views/MarkdownPageViewModel.xaml.cs @@ -0,0 +1,39 @@ +// 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 DeveloperCommandPalette; +using Microsoft.CmdPal.Extensions; + +namespace WindowsCommandPalette.Views; + +public sealed class MarkdownPageViewModel : PageViewModel +{ + public IMarkdownPage Page => (IMarkdownPage)PageAction; + + public string[] MarkdownContent { get; set; } = [string.Empty]; + + public string Title => Page.Title; + + private IEnumerable GetCommandContextItems() + { + return Page.Commands.Where(i => i is ICommandContextItem).Select(i => (ICommandContextItem)i); + } + + public bool HasMoreCommands => GetCommandContextItems().Any(); + + public IList ContextActions => GetCommandContextItems().Select(a => new ContextItemViewModel(a)).ToList(); + + public MarkdownPageViewModel(IMarkdownPage page) + : base(page) + { + } + + public async Task InitialRender(MarkdownPage markdownPage) + { + var t = new Task(Page.Bodies); + + t.Start(); + MarkdownContent = await t; + } +} diff --git a/src/modules/cmdpal/WindowsCommandPalette/Views/NoOpAction.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/Views/NoOpAction.xaml.cs new file mode 100644 index 0000000000..138e84292b --- /dev/null +++ b/src/modules/cmdpal/WindowsCommandPalette/Views/NoOpAction.xaml.cs @@ -0,0 +1,16 @@ +// 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.Extensions.Helpers; + +namespace WindowsCommandPalette.Views; + +public sealed class NoOpAction : InvokableCommand +{ + public override ICommandResult Invoke() + { + return CommandResult.KeepOpen(); + } +} diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Views/SectionInfoList.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/Views/SectionInfoList.xaml.cs similarity index 87% rename from src/modules/cmdpal/src/WindowsCommandPalette/Views/SectionInfoList.xaml.cs rename to src/modules/cmdpal/WindowsCommandPalette/Views/SectionInfoList.xaml.cs index 7ea9cb7b20..e934cc5fbe 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Views/SectionInfoList.xaml.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Views/SectionInfoList.xaml.cs @@ -4,19 +4,9 @@ using System.Collections.ObjectModel; using System.Collections.Specialized; -using System.ComponentModel; -using System.Runtime.InteropServices; using DeveloperCommandPalette; -using Microsoft.UI.Dispatching; -using Microsoft.UI.Input; -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Controls.Primitives; -using Microsoft.UI.Xaml.Data; -using Microsoft.UI.Xaml.Input; -using Microsoft.UI.Xaml.Navigation; using Microsoft.CmdPal.Extensions; -using Microsoft.CmdPal.Extensions.Helpers; +using Microsoft.UI.Dispatching; namespace WindowsCommandPalette.Views; diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Views/StringNotEmptyToVisibilityConverter.xaml.cs b/src/modules/cmdpal/WindowsCommandPalette/Views/StringNotEmptyToVisibilityConverter.xaml.cs similarity index 61% rename from src/modules/cmdpal/src/WindowsCommandPalette/Views/StringNotEmptyToVisibilityConverter.xaml.cs rename to src/modules/cmdpal/WindowsCommandPalette/Views/StringNotEmptyToVisibilityConverter.xaml.cs index 8955c497ee..fe574af363 100644 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Views/StringNotEmptyToVisibilityConverter.xaml.cs +++ b/src/modules/cmdpal/WindowsCommandPalette/Views/StringNotEmptyToVisibilityConverter.xaml.cs @@ -2,21 +2,8 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Collections.ObjectModel; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Runtime.InteropServices; -using DeveloperCommandPalette; -using Microsoft.UI.Dispatching; -using Microsoft.UI.Input; using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Controls.Primitives; using Microsoft.UI.Xaml.Data; -using Microsoft.UI.Xaml.Input; -using Microsoft.UI.Xaml.Navigation; -using Microsoft.CmdPal.Extensions; -using Microsoft.CmdPal.Extensions.Helpers; namespace WindowsCommandPalette.Views; diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/app.manifest b/src/modules/cmdpal/WindowsCommandPalette/app.manifest similarity index 100% rename from src/modules/cmdpal/src/WindowsCommandPalette/app.manifest rename to src/modules/cmdpal/WindowsCommandPalette/app.manifest diff --git a/src/modules/cmdpal/doc/initial-sdk-spec/initial-sdk-spec.md b/src/modules/cmdpal/doc/initial-sdk-spec/initial-sdk-spec.md index 5b9997de18..cf921270b2 100644 --- a/src/modules/cmdpal/doc/initial-sdk-spec/initial-sdk-spec.md +++ b/src/modules/cmdpal/doc/initial-sdk-spec/initial-sdk-spec.md @@ -1,7 +1,7 @@ --- author: Mike Griese created on: 2024-07-19 -last updated: 2024-08-26 +last updated: 2024-09-06 issue id: n/a --- @@ -67,6 +67,7 @@ functionality. - [Using the Clipboard](#using-the-clipboard) - [Advanced scenarios](#advanced-scenarios) - [Status messages](#status-messages) + - [Class diagram](#class-diagram) - [Future considerations](#future-considerations) - [Arbitrary parameters and arguments](#arbitrary-parameters-and-arguments) - [URI activation](#uri-activation) @@ -487,6 +488,7 @@ information that the host application will then use to render the page. ```csharp interface IPage requires ICommand { + String Title { get; }; Boolean Loading { get; }; } ``` @@ -499,6 +501,9 @@ Pages can be one of several types, each detailed below: * [Markdown](#Markdown) * [Form](#Form) +If a page returns a null or empty `Title`, DevPal will display the `Name` of the +`ICommand` instead. + Pages have a `Loading` property which they can use to indicate to DevPal that the content is still loading. When `Loading` is `true`, DevPal will show an intederminate loading bar to the user. When `Loading` is `false`, DevPal will @@ -550,10 +555,11 @@ interface ICommandContextItem requires IContextItem { interface ISeparatorContextItem requires IContextItem {} interface IListItem requires INotifyPropChanged { + IconDataType Icon{ get; }; String Title{ get; }; String Subtitle{ get; }; ICommand Command{ get; }; - IContextItem[] MoreCommands{ get; }; // TODO: name should be better + IContextItem[] MoreCommands{ get; }; ITag[] Tags{ get; }; IDetails Details{ get; }; IFallbackHandler FallbackHandler{ get; }; @@ -594,9 +600,14 @@ they like. * For example: An "Agenda" extension may want to have one section for each day, with each section's items containing the events for the day. +![Another mockup of the elements of a list item](./list-elements-mock-002.png) -Each ListItem has one default `Action`. This is the action that will be run when -the user selects the item. ListItems may also have a list of `MoreCommands`. +Each ListItem has one default `Command`. This is the command that will be run +when the user selects the item. If the IListItem has a non-null `Icon`, that +icon will be displayed in the list. If the `Icon` is null, DevPal will display +the `Icon` of the list item's `Command` instead. + + ListItems may also have a list of `MoreCommands`. These are additional commands that the user can take on the item. These will be displayed to the user in the "More commands" flyout when the user has that item selected. As the user moves focus through the list to select different items, we @@ -896,7 +907,6 @@ simple formatting options. ```csharp interface IMarkdownPage requires IPage { - String Title { get; }; String[] Bodies(); // TODO! should this be an IBody, so we can make it observable? IDetails Details(); IContextItem[] Commands { get; }; @@ -1271,6 +1281,165 @@ enum PageStatusKind { push pop sounds wrong. Maybe `AddStatus` and `ClearStatus`? +## Class diagram + +This is a diagram attempting to show the relationships between the various types we've defined for the SDK. Some elements are omitted for clarity. (Notably, `IconDataType` and `IPropChanged`, which are used in many places.) + +The notes on the arrows help indicate the multiplicity of the relationship. +* "*" means 0 or more (for arrays) +* "?" means 0 or 1 (for optional/nullable properties) +* "1" means exactly 1 (for required properties) + +```mermaid +classDiagram + class ICommand { + String Name + IconDataType Icon + } + IPage --|> ICommand + class IPage { + String Title + Boolean Loading + } + + IInvokableCommand --|> ICommand + class IInvokableCommand { + ICommandResult Invoke() + } + + class IForm { + String TemplateJson() + String DataJson() + String StateJson() + ICommandResult SubmitForm(String payload) + } + IFormPage --|> IPage + class IFormPage { + IForm[] Forms() + } + IForm "*" *-- IFormPage + + IMarkdownPage --|> IPage + class IMarkdownPage { + String[] Bodies() + IDetails Details() + IContextItem[] Commands + } + %% IMarkdownPage *-- IDetails + IContextItem "*" *-- IMarkdownPage + IDetails "?" *-- IMarkdownPage + %%%%%%%%% + + class IFilterItem + + ISeparatorFilterItem --|> IFilterItem + class ISeparatorFilterItem + + IFilter --|> IFilterItem + class IFilter { + String Id + String Name + IconDataType Icon + } + + class IFilters { + String CurrentFilterId + IFilterItem[] AvailableFilters() + } + IFilterItem "*" *-- IFilters + + class IFallbackHandler { + void UpdateQuery(String query) + } + + + %% IListItem --|> INotifyPropChanged + class IListItem { + IconDataType Icon + String Title + String Subtitle + ICommand Command + IContextItem[] MoreCommands + ITag[] Tags + IDetails Details + IFallbackHandler FallbackHandler + } + IContextItem "*" *-- IListItem + IDetails "?" *-- IListItem + ICommand "?" *-- IListItem + ITag "*" *-- IListItem + IFallbackHandler "?" *-- IListItem + + class ISection { + String Title + IListItem[] Items + } + IListItem "*" *-- ISection + + class IGridProperties { + Windows.Foundation.Size TileSize + } + + IListPage --|> IPage + class IListPage { + String SearchText + String PlaceholderText + Boolean ShowDetails + IFilters Filters + IGridProperties GridProperties + + ISection[] GetItems() + } + IGridProperties "?" *-- IListPage + ISection "*" *-- IListPage + IFilters "*" *-- IListPage + + IDynamicListPage --|> IListPage + class IDynamicListPage { + ISection[] GetItems(String query) + } + + class IDetails { + IconDataType HeroImage + String Title + String Body + IDetailsElement[] Metadata + } + + class ITag { + IconDataType Icon + String Text + Windows.UI.Color Color + String ToolTip + ICommand Command + } + ICommand "?" *-- ITag + + %%%%%% + class IContextItem + + ISeparatorContextItem --|> IContextItem + class ISeparatorContextItem + ICommandContextItem --|> IContextItem + class ICommandContextItem { + ICommand Command + String Tooltip + Boolean IsCritical + } + ICommand "?" *-- ICommandContextItem + + + + class ICommandProvider { + String DisplayName + IconDataType Icon + + IListItem[] TopLevelCommands() + } + IListItem "*" *-- ICommandProvider +``` + + ## Future considerations ### Arbitrary parameters and arguments @@ -1356,6 +1525,7 @@ shown to the user when the page stops loading and the list of elements filtered is empty. Is that just a `Details` object? A markdown body? + ## Footnotes The `.idl` for this SDK can be generated directly from this file. To do so, run the following command: diff --git a/src/modules/cmdpal/doc/initial-sdk-spec/list-elements-mock-002.pdn b/src/modules/cmdpal/doc/initial-sdk-spec/list-elements-mock-002.pdn new file mode 100644 index 0000000000..541fbc8b52 Binary files /dev/null and b/src/modules/cmdpal/doc/initial-sdk-spec/list-elements-mock-002.pdn differ diff --git a/src/modules/cmdpal/doc/initial-sdk-spec/list-elements-mock-002.png b/src/modules/cmdpal/doc/initial-sdk-spec/list-elements-mock-002.png new file mode 100644 index 0000000000..2890664562 Binary files /dev/null and b/src/modules/cmdpal/doc/initial-sdk-spec/list-elements-mock-002.png differ diff --git a/src/modules/cmdpal/extensions/TemplateExtension/Properties/PublishProfiles/win-x64.pubxml b/src/modules/cmdpal/extensions/TemplateExtension/Properties/PublishProfiles/win-x64.pubxml deleted file mode 100644 index d7548ab0a8..0000000000 --- a/src/modules/cmdpal/extensions/TemplateExtension/Properties/PublishProfiles/win-x64.pubxml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - FileSystem - x64 - win-x64 - bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ - true - False - False - True - False - True - - \ No newline at end of file diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ActionResult.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ActionResult.cs deleted file mode 100644 index 1835c201d3..0000000000 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ActionResult.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Microsoft.CmdPal.Extensions.Helpers; - -public class ActionResult : ICommandResult -{ - private ICommandResultArgs _Args = null; - private CommandResultKind _Kind = CommandResultKind.Dismiss; - public ICommandResultArgs Args => _Args; - public CommandResultKind Kind => _Kind; - public static ActionResult Dismiss() { - return new ActionResult() { _Kind = CommandResultKind.Dismiss }; - } - public static ActionResult GoHome() - { - return new ActionResult() { _Kind = CommandResultKind.GoHome }; - } - public static ActionResult KeepOpen() - { - return new ActionResult() { _Kind = CommandResultKind.KeepOpen }; - } -} diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/BaseObservable.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/BaseObservable.cs index f7aa03e85e..dad47eef06 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/BaseObservable.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/BaseObservable.cs @@ -1,3 +1,7 @@ +// 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 Windows.Foundation; namespace Microsoft.CmdPal.Extensions.Helpers; @@ -11,6 +15,8 @@ public class BaseObservable : INotifyPropChanged protected void OnPropertyChanged(string propertyName) { if (PropChanged != null) - PropChanged.Invoke(this, new Microsoft.CmdPal.Extensions.PropChangedEventArgs(propertyName)); + { + PropChanged.Invoke(this, new PropChangedEventArgs(propertyName)); + } } } diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ClipboardHelper.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ClipboardHelper.cs index 8cf6f4b7cf..128fbced2f 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ClipboardHelper.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ClipboardHelper.cs @@ -1,6 +1,7 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - +// 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 System; using System.Diagnostics; using System.Runtime.InteropServices; @@ -25,11 +26,12 @@ public static partial class ClipboardHelper return _internalClipboard ?? string.Empty; } - string tool = string.Empty; - string args = string.Empty; - string clipboardText = string.Empty; - ExecuteOnStaThread(() => GetTextImpl(out clipboardText)); - return clipboardText; + var tool = string.Empty; + var args = string.Empty; + var clipboardText = string.Empty; + + ExecuteOnStaThread(() => GetTextImpl(out clipboardText)); + return clipboardText; } public static void SetText(string text) @@ -40,10 +42,10 @@ public static partial class ClipboardHelper return; } - string tool = string.Empty; - string args = string.Empty; - ExecuteOnStaThread(() => SetClipboardData(Tuple.Create(text, CF_UNICODETEXT))); - return; + var tool = string.Empty; + var args = string.Empty; + ExecuteOnStaThread(() => SetClipboardData(Tuple.Create(text, CF_UNICODETEXT))); + return; } public static void SetRtf(string plainText, string rtfText) @@ -120,7 +122,7 @@ public static partial class ClipboardHelper if (data != IntPtr.Zero) { data = GlobalLock(data); - text = Marshal.PtrToStringUni(data); + text = Marshal.PtrToStringUni(data) ?? string.Empty; GlobalUnlock(data); return true; } @@ -134,7 +136,7 @@ public static partial class ClipboardHelper if (data != IntPtr.Zero) { data = GlobalLock(data); - text = Marshal.PtrToStringAnsi(data); + text = Marshal.PtrToStringAnsi(data) ?? string.Empty; GlobalUnlock(data); return true; } @@ -183,8 +185,8 @@ public static partial class ClipboardHelper private static bool SetSingleClipboardData(string text, uint format) { - IntPtr hGlobal = IntPtr.Zero; - IntPtr data = IntPtr.Zero; + var hGlobal = IntPtr.Zero; + var data = IntPtr.Zero; try { @@ -216,7 +218,7 @@ public static partial class ClipboardHelper return false; } - IntPtr dataCopy = GlobalLock(hGlobal); + var dataCopy = GlobalLock(hGlobal); if (dataCopy == IntPtr.Zero) { return false; @@ -254,7 +256,7 @@ public static partial class ClipboardHelper private static void ExecuteOnStaThread(Func action) { const int RetryCount = 5; - int tries = 0; + var tries = 0; if (Thread.CurrentThread.GetApartmentState() == ApartmentState.STA) { @@ -266,7 +268,7 @@ public static partial class ClipboardHelper return; } - Exception exception = null; + Exception? exception = null; var thread = new Thread(() => { try @@ -292,3 +294,4 @@ public static partial class ClipboardHelper } } } +*/ \ No newline at end of file diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Action.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Command.cs similarity index 60% rename from src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Action.cs rename to src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Command.cs index b0dafd8ba3..e868badd31 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Action.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Command.cs @@ -1,6 +1,10 @@ -namespace Microsoft.CmdPal.Extensions.Helpers; +// 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. -public class Action : BaseObservable, ICommand +namespace Microsoft.CmdPal.Extensions.Helpers; + +public class Command : BaseObservable, ICommand { private string _name = string.Empty; private IconDataType _icon = new(string.Empty); diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/CommandContextItem.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/CommandContextItem.cs index fa28e6c69f..aafc90450c 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/CommandContextItem.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/CommandContextItem.cs @@ -1,10 +1,17 @@ -namespace Microsoft.CmdPal.Extensions.Helpers; +// 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. + +namespace Microsoft.CmdPal.Extensions.Helpers; public class CommandContextItem : ICommandContextItem { public bool IsCritical { get; set; } + public ICommand Command { get; set; } - public string Tooltip { get; set; } = ""; + + public string Tooltip { get; set; } = string.Empty; + public CommandContextItem(ICommand command) { Command = command; diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/CommandResult.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/CommandResult.cs new file mode 100644 index 0000000000..3f15281c9b --- /dev/null +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/CommandResult.cs @@ -0,0 +1,42 @@ +// 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. + +namespace Microsoft.CmdPal.Extensions.Helpers; + +public class CommandResult : ICommandResult +{ + // TODO: is Args needed? + private ICommandResultArgs? _args; + private CommandResultKind _kind = CommandResultKind.Dismiss; + + // TODO: is Args needed? + public ICommandResultArgs? Args => _args; + + public CommandResultKind Kind => _kind; + + public static CommandResult Dismiss() + { + return new CommandResult() + { + _kind = CommandResultKind.Dismiss + }; + } + + public static CommandResult GoHome() + { + return new CommandResult() + { + _kind = CommandResultKind.GoHome, + _args = null, + }; + } + public static CommandResult KeepOpen() + { + return new CommandResult() + { + _kind = CommandResultKind.KeepOpen, + _args = null, + }; + } +} diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Details.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Details.cs index d1ce6ea65b..4e2215540e 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Details.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Details.cs @@ -1,4 +1,8 @@ -namespace Microsoft.CmdPal.Extensions.Helpers; +// 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. + +namespace Microsoft.CmdPal.Extensions.Helpers; public class Details : BaseObservable, IDetails { diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/DetailsElement.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/DetailsElement.cs index eeb56e1f7c..f8b158ba2c 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/DetailsElement.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/DetailsElement.cs @@ -1,7 +1,12 @@ -namespace Microsoft.CmdPal.Extensions.Helpers; +// 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. + +namespace Microsoft.CmdPal.Extensions.Helpers; public class DetailsElement : IDetailsElement { - public string Key { get; set; } + public string Key { get; set; } = string.Empty; + public IDetailsData? Data { get; set; } } diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/DetailsLink.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/DetailsLink.cs index c4e2911749..f6daa16de7 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/DetailsLink.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/DetailsLink.cs @@ -1,7 +1,12 @@ -namespace Microsoft.CmdPal.Extensions.Helpers; +// 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. + +namespace Microsoft.CmdPal.Extensions.Helpers; public class DetailsLink : IDetailsLink { - public Uri Link { get; set; } - public string Text { get; set; } + public Uri Link { get; set; } = new(string.Empty); + + public string Text { get; set; } = string.Empty; } diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/DetailsTags.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/DetailsTags.cs index c6521ca984..075964ebf4 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/DetailsTags.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/DetailsTags.cs @@ -1,6 +1,10 @@ -namespace Microsoft.CmdPal.Extensions.Helpers; +// 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. + +namespace Microsoft.CmdPal.Extensions.Helpers; public class DetailsTags : IDetailsTags { - public ITag[] Tags { get; set; } + public ITag[] Tags { get; set; } = []; } diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/DynamicListPage.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/DynamicListPage.cs index 0e210e4b9e..01cac09519 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/DynamicListPage.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/DynamicListPage.cs @@ -1,4 +1,8 @@ -namespace Microsoft.CmdPal.Extensions.Helpers; +// 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. + +namespace Microsoft.CmdPal.Extensions.Helpers; public class DynamicListPage : ListPage, IDynamicListPage { diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ExtensionInstanceManager.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ExtensionInstanceManager.cs index 53b5fedc59..8f0925ef3b 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ExtensionInstanceManager.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ExtensionInstanceManager.cs @@ -1,5 +1,6 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. +// 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 System.Runtime.InteropServices; using Windows.Win32; @@ -22,7 +23,7 @@ internal sealed class ExtensionInstanceManager : IClassFactory // Known constant ignored by win32metadata and cswin32 projections. // https://github.com/microsoft/win32metadata/blob/main/generation/WinSDK/RecompiledIdlHeaders/um/processthreadsapi.h - private static HANDLE CURRENT_THREAD_PSEUDO_HANDLE = (HANDLE)(IntPtr)(-6); + private static readonly HANDLE CURRENT_THREAD_PSEUDO_HANDLE = (HANDLE)(IntPtr)(-6); private static readonly Guid IID_IUnknown = Guid.Parse("00000000-0000-0000-C000-000000000046"); diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ExtensionServer.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ExtensionServer.cs index 1c9a9e9bc8..f9eeaa8fb9 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ExtensionServer.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ExtensionServer.cs @@ -1,5 +1,6 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. +// 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 System.Diagnostics; using System.Runtime.InteropServices; diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Filter.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Filter.cs index 72eb1b0ce8..5493655651 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Filter.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Filter.cs @@ -1,4 +1,8 @@ -namespace Microsoft.CmdPal.Extensions.Helpers; +// 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. + +namespace Microsoft.CmdPal.Extensions.Helpers; public class Filter : IFilter { diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Form.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Form.cs index cfc8b9549a..0250e0bbc1 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Form.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Form.cs @@ -1,13 +1,22 @@ -namespace Microsoft.CmdPal.Extensions.Helpers; +// 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. + +namespace Microsoft.CmdPal.Extensions.Helpers; public class Form: IForm { - public string Data { get; set; } - public string State { get; set; } - public string Template { get; set; } + public string Data { get; set; } = string.Empty; + + public string State { get; set; } = string.Empty; + + public string Template { get; set; } = string.Empty; public virtual string DataJson() => Data; + public virtual string StateJson() => State; + public virtual string TemplateJson() => Template; + public virtual ICommandResult SubmitForm(string payload) => throw new NotImplementedException(); } diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/FormPage.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/FormPage.cs index e9b5e35cb9..4d3f742637 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/FormPage.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/FormPage.cs @@ -1,10 +1,10 @@ -namespace Microsoft.CmdPal.Extensions.Helpers; +// 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. -public class FormPage : Action, IFormPage +namespace Microsoft.CmdPal.Extensions.Helpers; + +public class FormPage : Page, IFormPage { - private bool _Loading = false; - - public bool Loading { get => _Loading; set { _Loading = value; OnPropertyChanged(nameof(Loading)); } } - public virtual IForm[] Forms() => throw new NotImplementedException(); } diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/GoToPageArgs.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/GoToPageArgs.cs index 794bbecf5e..99ecf5cb49 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/GoToPageArgs.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/GoToPageArgs.cs @@ -1,4 +1,8 @@ -namespace Microsoft.CmdPal.Extensions.Helpers; +// 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. + +namespace Microsoft.CmdPal.Extensions.Helpers; public class GoToPageArgs : IGoToPageArgs { diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/InvokableCommand.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/InvokableCommand.cs index 546f0298b0..8418ed6108 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/InvokableCommand.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/InvokableCommand.cs @@ -1,6 +1,10 @@ -namespace Microsoft.CmdPal.Extensions.Helpers; +// 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. -public class InvokableCommand : Action, IInvokableCommand +namespace Microsoft.CmdPal.Extensions.Helpers; + +public class InvokableCommand : Command, IInvokableCommand { public virtual ICommandResult Invoke() => throw new NotImplementedException(); } diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ListHelpers.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ListHelpers.cs index 0a510d83a8..55629a67ae 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ListHelpers.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ListHelpers.cs @@ -1,5 +1,6 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. +// 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 System.Collections.ObjectModel; @@ -11,7 +12,7 @@ public class ListHelpers // TODO! This has side effects! This calls UpdateQuery on fallback handlers and that's async public static int ScoreListItem(string query, IListItem listItem) { - bool isFallback = false; + var isFallback = false; if (listItem.FallbackHandler != null) { isFallback = true; diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ListItem.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ListItem.cs index 41e32d3aa5..c6a1127c19 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ListItem.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ListItem.cs @@ -1,32 +1,107 @@ -namespace Microsoft.CmdPal.Extensions.Helpers; +// 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 System.ComponentModel.DataAnnotations; + +namespace Microsoft.CmdPal.Extensions.Helpers; public class ListItem : BaseObservable, IListItem { - private string _title = ""; - private string _subtitle = ""; + private IconDataType? _icon; + private string _title = string.Empty; + private string _subtitle = string.Empty; private ITag[] _tags = []; private IDetails? _details; - private ICommand _command; + private ICommand? _command; private IContextItem[] _moreCommands = []; private IFallbackHandler? _fallbackHandler; - public string Title + public IconDataType? Icon { - get => !string.IsNullOrEmpty(this._title) ? this._title : _command.Name; + get => _icon ?? _command?.Icon; set { - _title = value; OnPropertyChanged(nameof(Title)); + _icon = value; + OnPropertyChanged(nameof(Icon)); } - } - public string Subtitle { get => _subtitle; set { _subtitle = value; OnPropertyChanged(nameof(Subtitle)); } } - public ITag[] Tags { get => _tags; set { _tags = value; OnPropertyChanged(nameof(Tags)); } } - public IDetails? Details { get => _details; set { _details = value; OnPropertyChanged(nameof(Details)); } } - public ICommand Command { get => _command; set { _command = value; OnPropertyChanged(nameof(Command)); } } - public IContextItem[] MoreCommands { get => _moreCommands; set { _moreCommands = value; OnPropertyChanged(nameof(MoreCommands)); } } + public string Title + { + get + { + if (!string.IsNullOrEmpty(this._title)) + { + return _title; + } + else + { + return _command?.Name ?? string.Empty; + } + } + set + { + _title = value; + OnPropertyChanged(nameof(Title)); + } + } - public IFallbackHandler? FallbackHandler { get => _fallbackHandler ?? _command as IFallbackHandler; init { _fallbackHandler = value; } } + public string Subtitle + { + get => _subtitle; + set + { + _subtitle = value; + OnPropertyChanged(nameof(Subtitle)); + } + } + + public ITag[] Tags + { + get => _tags; + set + { + _tags = value; + OnPropertyChanged(nameof(Tags)); + } + } + + public IDetails? Details + { + get => _details; + set + { + _details = value; + OnPropertyChanged(nameof(Details)); + } + } + + public ICommand? Command + { + get => _command; + set + { + _command = value; + OnPropertyChanged(nameof(Command)); + } + } + + public IContextItem[] MoreCommands + { + get => _moreCommands; + set + { + _moreCommands = value; + OnPropertyChanged(nameof(MoreCommands)); + } + } + + public IFallbackHandler? FallbackHandler + { + get => _fallbackHandler ?? _command as IFallbackHandler; + init => _fallbackHandler = value; + } public ListItem(ICommand command) { diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ListPage.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ListPage.cs index f66350b5da..63bb85fee5 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ListPage.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ListPage.cs @@ -1,20 +1,62 @@ namespace Microsoft.CmdPal.Extensions.Helpers; -public class ListPage : Action, IListPage +public class ListPage : Page, IListPage { - private string _PlaceholderText = ""; - private string _SearchText = ""; - private bool _ShowDetails = false; - private bool _Loading = false; - private IFilters _Filters = null; - private IGridProperties _GridProperties = null; + private string _placeholderText = string.Empty; + private string _searchText = string.Empty; + private bool _showDetails; + private IFilters? _filters; + private IGridProperties? _gridProperties; - public string PlaceholderText { get => _PlaceholderText; set { _PlaceholderText = value; OnPropertyChanged(nameof(PlaceholderText)); } } - public string SearchText { get => _SearchText; set { _SearchText = value; OnPropertyChanged(nameof(SearchText)); } } - public bool ShowDetails { get => _ShowDetails; set { _ShowDetails = value; OnPropertyChanged(nameof(ShowDetails)); } } - public bool Loading { get => _Loading; set { _Loading = value; OnPropertyChanged(nameof(Loading)); } } - public IFilters Filters { get => _Filters; set { _Filters = value; OnPropertyChanged(nameof(Filters)); } } - public IGridProperties GridProperties { get => _GridProperties; set { _GridProperties = value; OnPropertyChanged(nameof(GridProperties)); } } + public string PlaceholderText + { + get => _placeholderText; + set + { + _placeholderText = value; + OnPropertyChanged(nameof(PlaceholderText)); + } + } + + public string SearchText + { + get => _searchText; + set + { + _searchText = value; + OnPropertyChanged(nameof(SearchText)); + } + } + + public bool ShowDetails + { + get => _showDetails; + set + { + _showDetails = value; + OnPropertyChanged(nameof(ShowDetails)); + } + } + + public IFilters? Filters + { + get => _filters; + set + { + _filters = value; + OnPropertyChanged(nameof(Filters)); + } + } + + public IGridProperties? GridProperties + { + get => _gridProperties; + set + { + _gridProperties = value; + OnPropertyChanged(nameof(GridProperties)); + } + } public virtual ISection[] GetItems() => throw new NotImplementedException(); } diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ListSection.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ListSection.cs index 90d1d6b725..8efb54a1b6 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ListSection.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/ListSection.cs @@ -1,4 +1,8 @@ -namespace Microsoft.CmdPal.Extensions.Helpers; +// 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. + +namespace Microsoft.CmdPal.Extensions.Helpers; public class ListSection : ISection { diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/MarkdownPage.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/MarkdownPage.cs index 650fee350e..a804bf17f7 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/MarkdownPage.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/MarkdownPage.cs @@ -1,30 +1,13 @@ -namespace Microsoft.CmdPal.Extensions.Helpers; +// 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. -public class MarkdownPage : Action, IMarkdownPage +namespace Microsoft.CmdPal.Extensions.Helpers; + +public class MarkdownPage : Page, IMarkdownPage { - private bool _loading; private ITag[] _tags = []; - private string _title = ""; - public string Title - { - get => !string.IsNullOrEmpty(_title) ? _title : Name; - set - { - _title = value; - OnPropertyChanged(nameof(Title)); - } - } - - public bool Loading - { - get => _loading; - set - { - _loading = value; - OnPropertyChanged(nameof(Loading)); - } - } public ITag[] Tags { get => _tags; diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/MatchResult.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/MatchResult.cs index fb42c0fe61..405d1fae0d 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/MatchResult.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/MatchResult.cs @@ -38,10 +38,7 @@ public class MatchResult public int RawScore { - get - { - return _rawScore; - } + get => _rawScore; set { @@ -53,7 +50,7 @@ public class MatchResult /// /// Gets matched data to highlight. /// - public List MatchData { get; private set; } + public List MatchData { get; private set; } = new(); public SearchPrecisionScore SearchPrecision { get; set; } diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Microsoft.CmdPal.Extensions.Helpers.csproj b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Microsoft.CmdPal.Extensions.Helpers.csproj index 0d6cd749f7..6208275383 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Microsoft.CmdPal.Extensions.Helpers.csproj +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Microsoft.CmdPal.Extensions.Helpers.csproj @@ -1,13 +1,8 @@  - None enable enable - pdbonly - - 0436 - False diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/NoOpAction.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/NoOpAction.cs deleted file mode 100644 index e8b594dc16..0000000000 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/NoOpAction.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Microsoft.CmdPal.Extensions.Helpers; - -public class NoOpAction : InvokableCommand -{ - public override ICommandResult Invoke() => ActionResult.KeepOpen(); -} diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/NoOpCommand.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/NoOpCommand.cs new file mode 100644 index 0000000000..c6ab2865c3 --- /dev/null +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/NoOpCommand.cs @@ -0,0 +1,6 @@ +namespace Microsoft.CmdPal.Extensions.Helpers; + +public class NoOpCommand : InvokableCommand +{ + public override ICommandResult Invoke() => CommandResult.KeepOpen(); +} diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Page.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Page.cs new file mode 100644 index 0000000000..2554610efc --- /dev/null +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Page.cs @@ -0,0 +1,30 @@ +// 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. + +namespace Microsoft.CmdPal.Extensions.Helpers; + +public class Page : Command, IPage +{ + private bool _loading; + private string _title = string.Empty; + + public bool Loading + { + get => _loading; + set + { + _loading = value; + OnPropertyChanged(nameof(Loading)); + } + } + public string Title + { + get => _title; + set + { + _title = value; + OnPropertyChanged(nameof(Name)); + } + } +} diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/SearchPrecisionScore.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/SearchPrecisionScore.cs index 012e4e7f6f..eca58cf64e 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/SearchPrecisionScore.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/SearchPrecisionScore.cs @@ -2,10 +2,6 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -//[assembly: InternalsVisibleTo("Microsoft.Plugin.Program.UnitTests")] -//[assembly: InternalsVisibleTo("Microsoft.PowerToys.Run.Plugin.System.UnitTests")] -//[assembly: InternalsVisibleTo("Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests")] - namespace Microsoft.CmdPal.Extensions.Helpers; public enum SearchPrecisionScore diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/StringMatcher.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/StringMatcher.cs index 3241542697..3e10280034 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/StringMatcher.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/StringMatcher.cs @@ -4,10 +4,6 @@ using System.Globalization; -//[assembly: InternalsVisibleTo("Microsoft.Plugin.Program.UnitTests")] -//[assembly: InternalsVisibleTo("Microsoft.PowerToys.Run.Plugin.System.UnitTests")] -//[assembly: InternalsVisibleTo("Microsoft.PowerToys.Run.Plugin.TimeDate.UnitTests")] - namespace Microsoft.CmdPal.Extensions.Helpers; public class StringMatcher @@ -23,24 +19,23 @@ public class StringMatcher //_alphabet = alphabet; } - public static StringMatcher Instance { get; set; } + private static StringMatcher? _instance; + public static StringMatcher Instance + { + get + { + _instance ??= new StringMatcher(); + + return _instance; + } + set => _instance = value; + } private static readonly char[] Separator = new[] { ' ' }; - [Obsolete("This method is obsolete and should not be used. Please use the static function StringMatcher.FuzzySearch")] - public static int Score(string source, string target) - { - return FuzzySearch(target, source).Score; - } - - [Obsolete("This method is obsolete and should not be used. Please use the static function StringMatcher.FuzzySearch")] - public static bool IsMatch(string source, string target) - { - return Score(source, target) > 0; - } - public static MatchResult FuzzySearch(string query, string stringToCompare) { + return Instance.FuzzyMatch(query, stringToCompare); } diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Tag.cs b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Tag.cs index e609e6f614..9cbfff7679 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Tag.cs +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions.Helpers/Tag.cs @@ -1,19 +1,67 @@ -using Windows.UI; +// 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 Windows.UI; namespace Microsoft.CmdPal.Extensions.Helpers; public class Tag : BaseObservable, ITag { - protected Color _Color = new(); - protected IconDataType _Icon = null; - protected string _Text = ""; - protected string _ToolTip = ""; - protected ICommand _Action; + private Color _color; + private IconDataType _icon = new(string.Empty); + private string _text = string.Empty; + private string _ToolTip = string.Empty; + private ICommand? _command; - public Color Color { get => _Color; set { _Color = value; OnPropertyChanged(nameof(Color)); } } - public IconDataType Icon { get => _Icon; set { _Icon = value; OnPropertyChanged(nameof(Icon)); } } - public string Text { get => _Text; set { _Text = value; OnPropertyChanged(nameof(Text)); } } - public string ToolTip { get => _ToolTip; set { _ToolTip = value; OnPropertyChanged(nameof(ToolTip)); } } - public ICommand Command { get => _Action; set { _Action = value; OnPropertyChanged(nameof(Action)); } } + public Color Color + { + get => _color; + set + { + _color = value; + OnPropertyChanged(nameof(Color)); + } + } + + public IconDataType Icon + { + get => _icon; + set + { + _icon = value; + OnPropertyChanged(nameof(Icon)); + } + } + + public string Text + { + get => _text; + set + { + _text = value; + OnPropertyChanged(nameof(Text)); + } + } + + public string ToolTip + { + get => _ToolTip; + set + { + _ToolTip = value; + OnPropertyChanged(nameof(ToolTip)); + } + } + + public ICommand? Command + { + get => _command; + set + { + _command = value; + OnPropertyChanged(nameof(Command)); + } + } } diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions/Microsoft.CmdPal.Extensions.idl b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions/Microsoft.CmdPal.Extensions.idl index 4b22161417..51f2ced8d1 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions/Microsoft.CmdPal.Extensions.idl +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions/Microsoft.CmdPal.Extensions.idl @@ -124,6 +124,7 @@ namespace Microsoft.CmdPal.Extensions [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] interface IPage requires ICommand { + String Title { get; }; Boolean Loading { get; }; } @@ -150,10 +151,11 @@ namespace Microsoft.CmdPal.Extensions [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] interface IListItem requires INotifyPropChanged { + IconDataType Icon{ get; }; String Title{ get; }; String Subtitle{ get; }; ICommand Command{ get; }; - IContextItem[] MoreCommands{ get; }; // TODO: name should be better + IContextItem[] MoreCommands{ get; }; ITag[] Tags{ get; }; IDetails Details{ get; }; IFallbackHandler FallbackHandler{ get; }; @@ -188,7 +190,6 @@ namespace Microsoft.CmdPal.Extensions [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] interface IMarkdownPage requires IPage { - String Title { get; }; String[] Bodies(); // TODO! should this be an IBody, so we can make it observable? IDetails Details(); IContextItem[] Commands { get; }; diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions/Microsoft.CmdPal.Extensions.vcxproj b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions/Microsoft.CmdPal.Extensions.vcxproj index c2e85d5963..03236338ac 100644 --- a/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions/Microsoft.CmdPal.Extensions.vcxproj +++ b/src/modules/cmdpal/extensionsdk/Microsoft.CmdPal.Extensions/Microsoft.CmdPal.Extensions.vcxproj @@ -1,9 +1,10 @@ - ..\..\..\..\..\packages\Microsoft.WindowsAppSDK.1.5.240428000 - ..\..\..\..\..\packages\Microsoft.Windows.CppWinRT.2.0.240111.5 - ..\..\..\..\..\packages\Microsoft.Windows.SDK.BuildTools.10.0.22621.2428 + ..\..\..\..\..\ + $(PathToRoot)packages\Microsoft.WindowsAppSDK.1.5.240428000 + $(PathToRoot)packages\Microsoft.Windows.CppWinRT.2.0.240111.5 + $(PathToRoot)packages\Microsoft.Windows.SDK.BuildTools.10.0.22621.2428 diff --git a/src/modules/cmdpal/extensionsdk/Microsoft.Windows.CommandPalette.Extensions/Microsoft.Windows.CommandPalette.Extensions.idl b/src/modules/cmdpal/extensionsdk/Microsoft.Windows.CommandPalette.Extensions/Microsoft.Windows.CommandPalette.Extensions.idl deleted file mode 100644 index 723c429aa9..0000000000 --- a/src/modules/cmdpal/extensionsdk/Microsoft.Windows.CommandPalette.Extensions/Microsoft.Windows.CommandPalette.Extensions.idl +++ /dev/null @@ -1,222 +0,0 @@ -namespace Microsoft.CmdPal.Extensions -{ - [contractversion(1)] - apicontract RunContract {} - - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IExtension { - IInspectable GetProvider(ProviderType providerType); - void Dispose(); - }; - - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - enum ProviderType { - Commands = 0, - }; - - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - runtimeclass IconDataType { - IconDataType(String iconString); - String Icon { get; }; - }; - - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface INotifyPropChanged { - event Windows.Foundation.TypedEventHandler PropChanged; - }; - - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - runtimeclass PropChangedEventArgs { - PropChangedEventArgs(String propertyName); - String PropertyName { get; }; - }; - - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface ICommand requires INotifyPropChanged{ - String Name{ get; }; - IconDataType Icon{ get; }; - } - - enum CommandResultKind { - Dismiss, // Reset the palette to the main page and dismiss - GoHome, // Go back to the main page, but keep it open - KeepOpen, // Do nothing. - GoToPage, // Go to another page. GoToPageArgs will tell you where. - }; - [uuid("f9d6423b-bd5e-44bb-a204-2f5c77a72396")] - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface ICommandResultArgs{}; - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface ICommandResult { - CommandResultKind Kind { get; }; - ICommandResultArgs Args { get; }; - } - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IGoToPageArgs requires ICommandResultArgs{ - String PageId { get; }; - } - - // This is a "leaf" of the UI. This is something that can be "done" by the user. - // * A ListPage - // * the MoreCommands flyout of for a ListItem or a MarkdownPage - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IInvokableCommand requires ICommand { - ICommandResult Invoke(); - } - - [uuid("ef5db50c-d26b-4aee-9343-9f98739ab411")] - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IFilterItem {} - - [uuid("0a923c7f-5b7b-431d-9898-3c8c841d02ed")] - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface ISeparatorFilterItem requires IFilterItem {} - - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IFilter requires IFilterItem { - String Id { get; }; - String Name { get; }; - IconDataType Icon { get; }; - } - - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IFilters { - String CurrentFilterId { get; set; }; - IFilterItem[] Filters(); - } - - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface ITag { - IconDataType Icon { get; }; - String Text { get; }; - Windows.UI.Color Color { get; }; - String ToolTip { get; }; - ICommand Command { get; }; - }; - - [uuid("6a6dd345-37a3-4a1e-914d-4f658a4d583d")] - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IDetailsData {} - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IDetailsElement { - String Key { get; }; - IDetailsData Data { get; }; - } - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IDetails { - IconDataType HeroImage { get; }; - String Title { get; }; - String Body { get; }; - IDetailsElement[] Metadata { get; }; - } - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IDetailsTags requires IDetailsData { - ITag[] Tags { get; }; - } - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IDetailsLink requires IDetailsData { - Windows.Foundation.Uri Link { get; }; - String Text { get; }; - } - [uuid("58070392-02bb-4e89-9beb-47ceb8c3d741")] - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IDetailsSeparator requires IDetailsData {} - - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IPage requires ICommand { - Boolean Loading { get; }; - } - - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IFallbackHandler { - void UpdateQuery(String query); - } - - [uuid("c78b9851-e76b-43ee-8f76-da5ba14e69a4")] - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IContextItem {} - - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface ICommandContextItem requires IContextItem { - ICommand Command { get; }; - String Tooltip { get; }; - Boolean IsCritical { get; }; // todo: better name for "make this red" - - // TODO-future: we should allow app developers to specify a default keybinding for each of these actions - } - [uuid("924a87fc-32fe-4471-9156-84b3b30275a6")] - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface ISeparatorContextItem requires IContextItem {} - - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IListItem requires INotifyPropChanged { - String Title{ get; }; - String Subtitle{ get; }; - ICommand Command{ get; }; - IContextItem[] MoreCommands{ get; }; // TODO: name should be better - ITag[] Tags{ get; }; - IDetails Details{ get; }; - IFallbackHandler FallbackHandler{ get; }; - } - - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface ISection { - String Title { get; }; - IListItem[] Items { get; }; - } - - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IGridProperties { - Windows.Foundation.Size TileSize { get; }; - } - - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IListPage requires IPage { - String SearchText { get; }; - String PlaceholderText { get; }; - Boolean ShowDetails{ get; }; - IFilters Filters { get; }; - IGridProperties GridProperties { get; }; - - ISection[] GetItems(); // DevPal will be responsible for filtering the list of items - } - - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IDynamicListPage requires IListPage { - ISection[] GetItems(String query); // DevPal will do no filtering of these items - } - - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IMarkdownPage requires IPage { - String Title { get; }; - String[] Bodies(); // TODO! should this be an IBody, so we can make it observable? - IDetails Details(); - IContextItem[] Commands { get; }; - } - - - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IForm { // TODO! should this be observable? - String TemplateJson(); - String DataJson(); - String StateJson(); - ICommandResult SubmitForm(String payload); - } - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface IFormPage requires IPage { - IForm[] Forms(); - } - - [contract(Microsoft.CmdPal.Extensions.ExtensionsContract, 1)] - interface ICommandProvider requires Windows.Foundation.IClosable - { - String DisplayName { get; }; - IconDataType Icon { get; }; - // TODO! Boolean CanBeCached { get; }; - // TODO! IFormPage SettingsPage { get; }; - - IListItem[] TopLevelCommands(); - }; - - -} diff --git a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Calc/Microsoft.CmdPal.Ext.Calc.csproj b/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Calc/Microsoft.CmdPal.Ext.Calc.csproj deleted file mode 100644 index 25408c8154..0000000000 --- a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.Calc/Microsoft.CmdPal.Ext.Calc.csproj +++ /dev/null @@ -1,9 +0,0 @@ - - - - Microsoft.CmdPal.Ext.Calc - - - - - diff --git a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/Microsoft.CmdPal.Ext.Settings.csproj b/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/Microsoft.CmdPal.Ext.Settings.csproj deleted file mode 100644 index 475f532c0f..0000000000 --- a/src/modules/cmdpal/src/Exts/Microsoft.CmdPal.Ext.CmdPalSettings/Microsoft.CmdPal.Ext.Settings.csproj +++ /dev/null @@ -1,9 +0,0 @@ - - - - Microsoft.CmdPal.Ext.Settings - - - - - diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/ActionViewModel.cs b/src/modules/cmdpal/src/WindowsCommandPalette/ActionViewModel.cs deleted file mode 100644 index fa26f62992..0000000000 --- a/src/modules/cmdpal/src/WindowsCommandPalette/ActionViewModel.cs +++ /dev/null @@ -1,36 +0,0 @@ -// 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 System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Microsoft.Terminal.UI; -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Controls.Primitives; -using Microsoft.UI.Xaml.Data; -using Microsoft.UI.Xaml.Input; -using Microsoft.UI.Xaml.Media; -using Microsoft.UI.Xaml.Navigation; -using Microsoft.CmdPal.Extensions; -using Windows.ApplicationModel.AppExtensions; -using Windows.Foundation; -using Windows.Foundation.Collections; - -namespace DeveloperCommandPalette; - -public sealed class ActionViewModel(ICommand model) -{ - public ICommand Command => model; - - internal readonly string Name = model.Name; - internal readonly string Icon = model.Icon.Icon; - - internal bool CanInvoke => model is IInvokableCommand; - - internal IconElement IcoElement => Microsoft.Terminal.UI.IconPathConverter.IconMUX(Icon); -} diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/MainListItem.cs b/src/modules/cmdpal/src/WindowsCommandPalette/MainListItem.cs deleted file mode 100644 index a2c67d889f..0000000000 --- a/src/modules/cmdpal/src/WindowsCommandPalette/MainListItem.cs +++ /dev/null @@ -1,54 +0,0 @@ -// 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.Extensions.Helpers; -using Windows.Foundation; - -namespace DeveloperCommandPalette; - -public sealed class MainListItem : ListItem -{ - private readonly IListItem _listItem; - - public IListItem Item => _listItem; - - internal MainListItem(IListItem listItem) - : base(listItem.Command) - { - _listItem = listItem; - - Title = _listItem.Title ?? _listItem.Command.Name; - Subtitle = _listItem.Subtitle; - MoreCommands = _listItem.MoreCommands; - FallbackHandler = _listItem.FallbackHandler; - Tags = _listItem.Tags; - - Command.PropChanged += Action_PropertyChanged; - _listItem.PropChanged += Action_PropertyChanged; - } - - private void Action_PropertyChanged(object sender, Microsoft.CmdPal.Extensions.PropChangedEventArgs args) - { - if (args.PropertyName == "Name") - { - this.Title = !string.IsNullOrEmpty(this._listItem.Title) ? this._listItem.Title : Command.Name; - OnPropertyChanged(nameof(Title)); - } - else if (args.PropertyName == nameof(Title)) - { - this.Title = this._listItem.Title; - } - else if (args.PropertyName == nameof(Subtitle)) - { - this.Subtitle = this._listItem.Subtitle; - } - else if (args.PropertyName == nameof(MoreCommands)) - { - this.MoreCommands = this._listItem.MoreCommands; - } - - OnPropertyChanged(args.PropertyName); - } -} diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Properties/PublishProfiles/win-arm64.pubxml b/src/modules/cmdpal/src/WindowsCommandPalette/Properties/PublishProfiles/win-arm64.pubxml deleted file mode 100644 index ccd091e1b4..0000000000 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Properties/PublishProfiles/win-arm64.pubxml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - FileSystem - ARM64 - win-arm64 - bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ - true - False - False - True - False - True - - \ No newline at end of file diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Properties/PublishProfiles/win-x64.pubxml b/src/modules/cmdpal/src/WindowsCommandPalette/Properties/PublishProfiles/win-x64.pubxml deleted file mode 100644 index d7548ab0a8..0000000000 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Properties/PublishProfiles/win-x64.pubxml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - FileSystem - x64 - win-x64 - bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ - true - False - False - True - False - True - - \ No newline at end of file diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Views/ErrorListItem.xaml.cs b/src/modules/cmdpal/src/WindowsCommandPalette/Views/ErrorListItem.xaml.cs deleted file mode 100644 index 7e4c978e02..0000000000 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Views/ErrorListItem.xaml.cs +++ /dev/null @@ -1,31 +0,0 @@ -// 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 System.Collections.ObjectModel; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Runtime.InteropServices; -using DeveloperCommandPalette; -using Microsoft.UI.Dispatching; -using Microsoft.UI.Input; -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Controls.Primitives; -using Microsoft.UI.Xaml.Data; -using Microsoft.UI.Xaml.Input; -using Microsoft.UI.Xaml.Navigation; -using Microsoft.CmdPal.Extensions; -using Microsoft.CmdPal.Extensions.Helpers; - -namespace WindowsCommandPalette.Views; - -public sealed class ErrorListItem : Microsoft.CmdPal.Extensions.Helpers.ListItem -{ - public ErrorListItem(Exception ex) - : base(new NoOpAction()) - { - this.Title = "Error in extension:"; - this.Subtitle = ex.Message; - } -} diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Views/MarkdownPageViewModel.xaml.cs b/src/modules/cmdpal/src/WindowsCommandPalette/Views/MarkdownPageViewModel.xaml.cs deleted file mode 100644 index 4a65dd9a70..0000000000 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Views/MarkdownPageViewModel.xaml.cs +++ /dev/null @@ -1,37 +0,0 @@ -// 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 DeveloperCommandPalette; -using Microsoft.CmdPal.Extensions; - -namespace WindowsCommandPalette.Views; - -public sealed class MarkdownPageViewModel : PageViewModel -{ - internal IMarkdownPage Page => (IMarkdownPage)this.pageAction; - - internal string[] MarkdownContent = [string.Empty]; - - internal string Title => Page.Title; - - private IEnumerable contextActions => Page.Commands.Where(i => i is ICommandContextItem).Select(i => (ICommandContextItem)i); - - internal bool HasMoreCommands => contextActions.Any(); - - internal IList ContextActions => contextActions.Select(a => new ContextItemViewModel(a)).ToList(); - - public MarkdownPageViewModel(IMarkdownPage page) - : base(page) - { - } - - internal async Task InitialRender(MarkdownPage markdownPage) - { - var t = new Task(() => { - return this.Page.Bodies(); - }); - t.Start(); - this.MarkdownContent = await t; - } -} diff --git a/src/modules/cmdpal/src/WindowsCommandPalette/Views/NoOpAction.xaml.cs b/src/modules/cmdpal/src/WindowsCommandPalette/Views/NoOpAction.xaml.cs deleted file mode 100644 index 4faa302453..0000000000 --- a/src/modules/cmdpal/src/WindowsCommandPalette/Views/NoOpAction.xaml.cs +++ /dev/null @@ -1,29 +0,0 @@ -// 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 System.Collections.ObjectModel; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Runtime.InteropServices; -using DeveloperCommandPalette; -using Microsoft.UI.Dispatching; -using Microsoft.UI.Input; -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Controls.Primitives; -using Microsoft.UI.Xaml.Data; -using Microsoft.UI.Xaml.Input; -using Microsoft.UI.Xaml.Navigation; -using Microsoft.CmdPal.Extensions; -using Microsoft.CmdPal.Extensions.Helpers; - -namespace WindowsCommandPalette.Views; - -public sealed class NoOpAction : InvokableCommand -{ - public override ICommandResult Invoke() - { - return ActionResult.KeepOpen(); - } -}