microsoft / TemplateStudio

Template Studio accelerates the creation of new WinUI 3, WPF, and UWP apps using a wizard-based experience.
Other
2.69k stars 459 forks source link

AppExtensionHost Feature Template Request #1426

Open cc-cortes opened 6 years ago

cc-cortes commented 6 years ago

Create a new feature template that allows an app to specify itself as an AppExtensionHost. If a developer wants to enable a plug-in model for their app, they need to describe their app as an Extension Host. Apps like Edge, Paint.Net, digital audio workstations, graphical work stations and many other productivity apps use plugin models to enhance the functionality of their apps by allowing third parties to write components for unique workflows. The Feature template could populate the manifest with the correct extension information, as well as provide the code to automatically Load all trusted extensions at launch.

https://docs.microsoft.com/en-us/windows/uwp/launch-resume/extend-your-app-with-services-extensions-packages

mvegaca commented 6 years ago

Working on a PoC

mvegaca commented 6 years ago

I've uploaded a PoC on this branch.

From this PoC I think that we could add two different features in a new features category named App services and extensions.

App Extension Host

Add the infrastructure to allow an application to host extensions from other developers, creating an extensibility model.

New files

Modified files

Dependencies

Other things

We also include a markdown documentation to show how to invoke the extensions.

extension.Enable();
var request = new ExtensionRequest();
await request.AddParameterAsync("Parameter01", "Hello World");
await request.AddParameterAsync("Parameter02", 2018);
await request.AddParameterAsync("Parameter03", new DateTime(2018, 3, 19));

var response = await extension.InvokeAsync(request);
var response01 = await response.GetValueAsync<string>("Response01");
var response02 = await response.GetValueAsync<int>("Response02");
var response03 = await response.GetValueAsync<DateTime>("Response03");

We also need to add comments to the developer to let him understand that is necessary to define a documentation to explain to external users how to define the extensions to be consumed from the host app.

App Extension

Add the infrastructure to allow an application to be an extension of another existing app.

New files

Modified files

Dependencies

Other things

We also include a markdown documentation to show how to composite the requested information from the app host.

var parameter01 = await request.GetParameterAsync<string>("Parameter01");
var parameter02 = await request.GetParameterAsync<int>("Parameter02");
var parameter03 = await request.GetParameterAsync<DateTime>("Parameter03");

var response = new ExtensionResponse();
await response.AddValueAsync("Response01", $"{parameter01} from Extension");
await response.AddValueAsync("Response02", parameter02 + 1);
await response.AddValueAsync("Response03", parameter03.AddDays(1));
return response;

@crutkas @mrlacey Any comments or improvements on the PoC and the new features approaches?