Some other SDK renaming (to get rid of old Actions references) (#47)

* All the `ActionProvider`s were renamed to `CommandProvider`
* `Page`s all got a `Title`
* `IListItem` got it own `Icon`
* `ActionResult` -> `CommandResult`
* add all the pubxml's we lost
This commit is contained in:
Mike Griese
2024-09-06 14:12:27 -05:00
committed by GitHub
parent f5d58be822
commit 3b7a33b3dc
65 changed files with 362 additions and 766 deletions

6
.gitignore vendored
View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>x64</Platform>
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) >= 8">win-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x64</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<SelfContained>true</SelfContained>
<PublishSingleFile>False</PublishSingleFile>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">False</PublishTrimmed>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,10 @@
{
"profiles": {
"HackerNewsExtension (Package)": {
"commandName": "MsixPackage"
},
"HackerNewsExtension (Unpackaged)": {
"commandName": "Project"
}
}
}

View File

@@ -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" }
],
}
];

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>x64</Platform>
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) >= 8">win-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x64</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<SelfContained>true</SelfContained>
<PublishSingleFile>False</PublishSingleFile>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">False</PublishTrimmed>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,10 @@
{
"profiles": {
"MastodonExtension (Package)": {
"commandName": "MsixPackage"
},
"MastodonExtension (Unpackaged)": {
"commandName": "Project"
}
}
}

View File

@@ -41,6 +41,6 @@ internal sealed class PrevNextTrackAction : InvokableCommand
_ = _mediaSession.TrySkipNextAsync();
}
return ActionResult.KeepOpen();
return CommandResult.KeepOpen();
}
}

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>x64</Platform>
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) >= 8">win-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x64</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<SelfContained>true</SelfContained>
<PublishSingleFile>False</PublishSingleFile>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">False</PublishTrimmed>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,10 @@
{
"profiles": {
"MediaControlsExtension (Package)": {
"commandName": "MsixPackage"
},
"MediaControlsExtension (Unpackaged)": {
"commandName": "Project"
}
}
}

View File

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

View File

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

View File

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

View File

@@ -39,6 +39,6 @@ public sealed class Bookmarks
{
var jsonString = JsonSerializer.Serialize(data, _jsonOptions);
File.WriteAllText(BookmarksActionProvider.StateJsonPath(), jsonString);
File.WriteAllText(BookmarksCommandProvider.StateJsonPath(), jsonString);
}
}

View File

@@ -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<ICommand> _commands = [];
private readonly AddBookmarkPage _addNewCommand = new();
public BookmarksActionProvider()
public BookmarksCommandProvider()
{
_addNewCommand.AddedAction += AddNewCommand_AddedAction;
}

View File

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

View File

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

View File

@@ -31,7 +31,7 @@ public class CalculatorAction : InvokableCommand
// ClipboardHelper.SetText(_result);
}
return ActionResult.KeepOpen();
return CommandResult.KeepOpen();
}
internal void SetResult(string result, bool success)

View File

@@ -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()
{
}

View File

@@ -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()
{
}

View File

@@ -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<ILocalSettingsService>().SaveSettingAsync("GlobalHotkey", formInput["hotkey"]?.ToString() ?? string.Empty);
return ActionResult.GoHome();
return CommandResult.GoHome();
}
}

View File

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

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>x64</Platform>
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) >= 8">win-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x64</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<SelfContained>true</SelfContained>
<PublishSingleFile>False</PublishSingleFile>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">False</PublishTrimmed>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,10 @@
{
"profiles": {
"ProcessMonitorExtension (Package)": {
"commandName": "MsixPackage"
},
"ProcessMonitorExtension (Unpackaged)": {
"commandName": "Project"
}
}
}

View File

@@ -26,7 +26,7 @@ public sealed class SampleExtension : IExtension
switch (providerType)
{
case ProviderType.Commands:
return new ProcessMonitorActionProvider();
return new ProcessMonitorCommandProvider();
default:
return null;
}

View File

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

View File

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

View File

@@ -26,6 +26,6 @@ public class CopyTextAction : InvokableCommand
Clipboard.SetContent(dataPackage);
// ClipboardHelper.SetText(Text);
return ActionResult.KeepOpen();
return CommandResult.KeepOpen();
}
}

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>x64</Platform>
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) >= 8">win-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x64</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<SelfContained>true</SelfContained>
<PublishSingleFile>False</PublishSingleFile>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">False</PublishTrimmed>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,10 @@
{
"profiles": {
"SpongebotExtension (Package)": {
"commandName": "MsixPackage"
},
"SpongebotExtension (Unpackaged)": {
"commandName": "Project"
}
}
}

View File

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

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>x64</Platform>
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) >= 8">win-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x64</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<SelfContained>true</SelfContained>
<PublishSingleFile>False</PublishSingleFile>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">False</PublishTrimmed>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,10 @@
{
"profiles": {
"TemplateExtension (Package)": {
"commandName": "MsixPackage"
},
"TemplateExtension (Unpackaged)": {
"commandName": "Project"
}
}
}

View File

@@ -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" }
],
}
];

View File

@@ -59,9 +59,9 @@ internal sealed class AppAction : InvokableCommand
}
}
public override ActionResult Invoke()
public override CommandResult Invoke()
{
_ = Launch();
return ActionResult.GoHome();
return CommandResult.GoHome();
}
}

View File

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

View File

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

View File

@@ -8,7 +8,7 @@ using Windows.Foundation;
namespace WindowsCommandPalette.BuiltinCommands;
public class QuitActionProvider : ICommandProvider
public class QuitCommandProvider : ICommandProvider
{
public string DisplayName => string.Empty;

View File

@@ -17,7 +17,7 @@ public class ReloadExtensionsAction : InvokableCommand, IFallbackHandler
public override ICommandResult Invoke()
{
return ActionResult.GoHome();
return CommandResult.GoHome();
}
public void UpdateQuery(string query)

View File

@@ -8,7 +8,7 @@ using Windows.Foundation;
namespace WindowsCommandPalette.BuiltinCommands;
public class ReloadExtensionsActionProvider : ICommandProvider
public class ReloadExtensionsCommandProvider : ICommandProvider
{
public string DisplayName => string.Empty;

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>x64</Platform>
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) >= 8">win-x64</RuntimeIdentifier>
<RuntimeIdentifier Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">win10-x64</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<SelfContained>true</SelfContained>
<PublishSingleFile>False</PublishSingleFile>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
<PublishTrimmed Condition="'$(Configuration)' == 'Debug'">False</PublishTrimmed>
<PublishTrimmed Condition="'$(Configuration)' != 'Debug'">False</PublishTrimmed>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,10 @@
{
"profiles": {
"WindowsCommandPalette (Package)": {
"commandName": "MsixPackage"
},
"WindowsCommandPalette (Unpackaged)": {
"commandName": "Project"
}
}
}

View File

@@ -8,26 +8,26 @@ using Windows.Win32;
namespace WindowsCommandPalette.Views;
public 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();
@@ -36,7 +36,7 @@ public sealed class ActionsProviderWrapper
throw new ArgumentException("extension didn't actually implement ICommandProvider");
}
ActionProvider = provider;
CommandProvider = provider;
isValid = true;
}
@@ -47,7 +47,7 @@ public sealed class ActionsProviderWrapper
return;
}
var t = new Task<IListItem[]>(() => ActionProvider.TopLevelCommands());
var t = new Task<IListItem[]>(() => CommandProvider.TopLevelCommands());
t.Start();
var commands = await t.ConfigureAwait(false);
@@ -72,7 +72,7 @@ public 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()
{

View File

@@ -18,7 +18,7 @@ namespace WindowsCommandPalette.Views;
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class ListPage : Page, INotifyPropertyChanged
public sealed partial class ListPage : Microsoft.UI.Xaml.Controls.Page, INotifyPropertyChanged
{
public ListPageViewModel? ViewModel { get; set; }

View File

@@ -91,7 +91,7 @@ public sealed partial class MainPage : Page
// TODO! I don't understand async enough to get why this has to be ConfigureAwait(false)
foreach (var provider in ViewModel.BuiltInCommands)
{
var wrapper = new ActionsProviderWrapper(provider);
var wrapper = new CommandProviderWrapper(provider);
ViewModel.ActionsProvider.Add(wrapper);
await LoadTopLevelCommandsFromProvider(wrapper).ConfigureAwait(false);
@@ -271,7 +271,7 @@ public sealed partial class MainPage : Page
try
{
await extension.StartExtensionAsync();
var wrapper = new ActionsProviderWrapper(extension);
var wrapper = new CommandProviderWrapper(extension);
ViewModel.ActionsProvider.Add(wrapper);
await LoadTopLevelCommandsFromProvider(wrapper);
}
@@ -281,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));
}

View File

@@ -20,14 +20,14 @@ namespace WindowsCommandPalette.Views;
public sealed class MainViewModel : IDisposable
{
private readonly QuitActionProvider _quitActionProvider = new();
private readonly ReloadExtensionsActionProvider _reloadActionProvider = new();
private readonly QuitCommandProvider _quitCommandProvider = new();
private readonly ReloadExtensionsCommandProvider _reloadCommandProvider = new();
public AllAppsPage Apps { get; set; } = new();
public event TypedEventHandler<object, object?>? QuitRequested { add => _quitActionProvider.QuitRequested += value; remove => _quitActionProvider.QuitRequested -= value; }
public event TypedEventHandler<object, object?>? QuitRequested { add => _quitCommandProvider.QuitRequested += value; remove => _quitCommandProvider.QuitRequested -= value; }
public ObservableCollection<ActionsProviderWrapper> ActionsProvider { get; set; } = [];
public ObservableCollection<CommandProviderWrapper> ActionsProvider { get; set; } = [];
public ObservableCollection<ExtensionObject<IListItem>> TopLevelCommands { get; set; } = [];
@@ -47,11 +47,11 @@ public sealed class MainViewModel : IDisposable
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();
@@ -184,7 +184,7 @@ public sealed class MainViewModel : IDisposable
public void Dispose()
{
_quitActionProvider.Dispose();
_reloadActionProvider.Dispose();
_quitCommandProvider.Dispose();
_reloadCommandProvider.Dispose();
}
}

View File

@@ -11,6 +11,6 @@ public sealed class NoOpAction : InvokableCommand
{
public override ICommandResult Invoke()
{
return ActionResult.KeepOpen();
return CommandResult.KeepOpen();
}
}

View File

@@ -488,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; };
}
```
@@ -500,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
@@ -551,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; };
@@ -595,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
@@ -897,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; };
@@ -1289,6 +1298,7 @@ classDiagram
}
IPage --|> ICommand
class IPage {
String Title
Boolean Loading
}
@@ -1311,7 +1321,6 @@ classDiagram
IMarkdownPage --|> IPage
class IMarkdownPage {
String Title
String[] Bodies()
IDetails Details()
IContextItem[] Commands
@@ -1346,6 +1355,7 @@ classDiagram
%% IListItem --|> INotifyPropChanged
class IListItem {
IconDataType Icon
String Title
String Subtitle
ICommand Command

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

View File

@@ -4,7 +4,7 @@
namespace Microsoft.CmdPal.Extensions.Helpers;
public class Action : BaseObservable, ICommand
public class Command : BaseObservable, ICommand
{
private string _name = string.Empty;
private IconDataType _icon = new(string.Empty);

View File

@@ -4,7 +4,7 @@
namespace Microsoft.CmdPal.Extensions.Helpers;
public class ActionResult : ICommandResult
public class CommandResult : ICommandResult
{
// TODO: is Args needed?
private ICommandResultArgs? _args;
@@ -15,25 +15,25 @@ public class ActionResult : ICommandResult
public CommandResultKind Kind => _kind;
public static ActionResult Dismiss()
public static CommandResult Dismiss()
{
return new ActionResult()
return new CommandResult()
{
_kind = CommandResultKind.Dismiss
};
}
public static ActionResult GoHome()
public static CommandResult GoHome()
{
return new ActionResult()
return new CommandResult()
{
_kind = CommandResultKind.GoHome,
_args = null,
};
}
public static ActionResult KeepOpen()
public static CommandResult KeepOpen()
{
return new ActionResult()
return new CommandResult()
{
_kind = CommandResultKind.KeepOpen,
_args = null,

View File

@@ -4,19 +4,7 @@
namespace Microsoft.CmdPal.Extensions.Helpers;
public class FormPage : Action, IFormPage
public class FormPage : Page, IFormPage
{
private bool _loading;
public bool Loading
{
get => _loading;
set
{
_loading = value;
OnPropertyChanged(nameof(Loading));
}
}
public virtual IForm[] Forms() => throw new NotImplementedException();
}

View File

@@ -4,7 +4,7 @@
namespace Microsoft.CmdPal.Extensions.Helpers;
public class InvokableCommand : Action, IInvokableCommand
public class InvokableCommand : Command, IInvokableCommand
{
public virtual ICommandResult Invoke() => throw new NotImplementedException();
}

View File

@@ -8,6 +8,7 @@ namespace Microsoft.CmdPal.Extensions.Helpers;
public class ListItem : BaseObservable, IListItem
{
private IconDataType? _icon;
private string _title = string.Empty;
private string _subtitle = string.Empty;
private ITag[] _tags = [];
@@ -16,6 +17,16 @@ public class ListItem : BaseObservable, IListItem
private IContextItem[] _moreCommands = [];
private IFallbackHandler? _fallbackHandler;
public IconDataType? Icon
{
get => _icon ?? _command?.Icon;
set
{
_icon = value;
OnPropertyChanged(nameof(Icon));
}
}
public string Title
{
get

View File

@@ -1,11 +1,10 @@
namespace Microsoft.CmdPal.Extensions.Helpers;
public class ListPage : Action, IListPage
public class ListPage : Page, IListPage
{
private string _placeholderText = string.Empty;
private string _searchText = string.Empty;
private bool _showDetails;
private bool _loading;
private IFilters? _filters;
private IGridProperties? _gridProperties;
@@ -39,16 +38,6 @@ public class ListPage : Action, IListPage
}
}
public bool Loading
{
get => _loading;
set
{
_loading = value;
OnPropertyChanged(nameof(Loading));
}
}
public IFilters? Filters
{
get => _filters;

View File

@@ -4,31 +4,10 @@
namespace Microsoft.CmdPal.Extensions.Helpers;
public class MarkdownPage : Action, IMarkdownPage
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;

View File

@@ -1,6 +0,0 @@
namespace Microsoft.CmdPal.Extensions.Helpers;
public class NoOpAction : InvokableCommand
{
public override ICommandResult Invoke() => ActionResult.KeepOpen();
}

View File

@@ -0,0 +1,6 @@
namespace Microsoft.CmdPal.Extensions.Helpers;
public class NoOpCommand : InvokableCommand
{
public override ICommandResult Invoke() => CommandResult.KeepOpen();
}

View File

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

View File

@@ -60,7 +60,7 @@ public class Tag : BaseObservable, ITag
set
{
_command = value;
OnPropertyChanged(nameof(Action));
OnPropertyChanged(nameof(Command));
}
}

View File

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

View File

@@ -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<Object, PropChangedEventArgs> 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();
};
}