-
Notifications
You must be signed in to change notification settings - Fork 358
/
Copy pathIExtensionWrapper.cs
112 lines (93 loc) · 3.76 KB
/
IExtensionWrapper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Windows.DevHome.SDK;
using Windows.ApplicationModel;
namespace DevHome.Common.Services;
public interface IExtensionWrapper
{
/// <summary>
/// Gets the DisplayName of the package as mentioned in the manifest
/// </summary>
string PackageDisplayName { get; }
/// <summary>
/// Gets DisplayName of the extension as mentioned in the manifest
/// </summary>
string ExtensionDisplayName { get; }
/// <summary>
/// Gets PackageFullName of the extension
/// </summary>
string PackageFullName { get; }
/// <summary>
/// Gets PackageFamilyName of the extension
/// </summary>
string PackageFamilyName { get; }
/// <summary>
/// Gets Publisher of the extension
/// </summary>
string Publisher { get; }
/// <summary>
/// Gets class id (GUID) of the extension class (which implements IExtension) as mentioned in the manifest
/// </summary>
string ExtensionClassId { get; }
/// <summary>
/// Gets the date on which the application package was installed or last updated.
/// </summary>
DateTimeOffset InstalledDate { get; }
/// <summary>
/// Gets the PackageVersion of the extension
/// </summary>
PackageVersion Version { get; }
/// <summary>
/// Gets the Unique Id for the extension
/// </summary>
public string ExtensionUniqueId { get; }
/// <summary>
/// Checks whether we have a reference to the extension process and we are able to call methods on the interface.
/// </summary>
/// <returns>Whether we have a reference to the extension process and we are able to call methods on the interface.</returns>
bool IsRunning();
/// <summary>
/// Starts the extension if not running
/// </summary>
/// <returns>An awaitable task</returns>
Task StartExtensionAsync();
/// <summary>
/// Signals the extension to dispose itself and removes the reference to the extension com object
/// </summary>
void SignalDispose();
/// <summary>
/// Gets the underlying instance of IExtension
/// </summary>
/// <returns>Instance of IExtension</returns>
IExtension? GetExtensionObject();
/// <summary>
/// Tells the wrapper that the extension implements the given provider
/// </summary>
/// <param name="providerType">The type of provider to be added</param>
void AddProviderType(ProviderType providerType);
/// <summary>
/// Checks whether the given provider was added through `AddProviderType` method
/// </summary>
/// <param name="providerType">The type of the provider to be checked for</param>
/// <returns>Whether the given provider was added through `AddProviderType` method</returns>
bool HasProviderType(ProviderType providerType);
/// <summary>
/// Starts the extension if not running and gets the provider from the underlying IExtension object
/// Can be null if not found
/// </summary>
/// <typeparam name="T">The type of provider</typeparam>
/// <returns>Nullable instance of the provider</returns>
Task<T?> GetProviderAsync<T>()
where T : class;
/// <summary>
/// Starts the extension if not running and gets a list of providers of type T from the underlying IExtension object.
/// If no providers are found, returns an empty list.
/// </summary>
/// <typeparam name="T">The type of provider</typeparam>
/// <returns>Nullable instance of the provider</returns>
Task<IEnumerable<T>> GetListOfProvidersAsync<T>()
where T : class;
}