TemplateStudio
TemplateStudio copied to clipboard
AppExtensionHost Feature Template Request
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
Working on a PoC
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
- App Extension
App Extension Host
Add the infrastructure to allow an application to host extensions from other developers, creating an extensibility model.
New files
- Services/ExtensionsManager.cs
- Services/ExtensionRequest.cs
- Services/ExtensionResponse.cs
- Services/Extension.cs
Modified files
- App.xaml.cs
- Package.appxmanifest
- Services/ActivationService.cs
Dependencies
- SettingStorage feature needs to be added to allow serialize models in extensions communication channel.
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
- Services/AppExtensionService.cs
- Services/ExtensionRequest.cs
- Services/ExtensionResponse.cs
Modified files
- App.xaml.cs
- Package.appxmanifest
- Services/ActivationService.cs
Dependencies
- SettingStorage feature needs to be added to allow serialize models in extensions communication channel.
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?