-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTemplatePlugin.cs
More file actions
62 lines (50 loc) · 1.85 KB
/
TemplatePlugin.cs
File metadata and controls
62 lines (50 loc) · 1.85 KB
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
using System.Windows.Input;
using Microsoft.Extensions.Logging;
using SipLine.Plugin.Sdk;
using SipLine.Plugin.Sdk.Enums;
namespace SipLine.Plugin.Template;
public class TemplatePlugin : ISipLinePlugin
{
public string Id => "test-user";
public string Name => "Test User Plugin";
public string Description => "Plugin installé par l'utilisateur pour tester";
public Version Version => new(1, 0, 0);
public string Author => "Utilisateur";
public string? WebsiteUrl => null;
// Nouvelle API
public PluginIcon? Icon => PluginIcon.Contact;
public string? IconPathData => null;
public bool HasSettingsUI => false;
private IPluginContext? _context;
public Task InitializeAsync(IPluginContext context)
{
_context = context;
_context.Logger.LogInformation("Test User Plugin initialisé!");
_context.AddLog("Test User Plugin chargé depuis AppData", "Info");
_context.RegisterToolbarButton(new PluginToolbarButton
{
Id = "test-btn",
Tooltip = "Plugin utilisateur",
Icon = PluginIcon.Contact,
Order = 150,
Command = new SimpleCommand(() =>
_context?.ShowSnackbar("Plugin installé par l'utilisateur!", SnackbarSeverity.Info))
});
return Task.CompletedTask;
}
public object? GetSettingsUI() => null;
public Task ShutdownAsync()
{
_context?.UnregisterToolbarButton("test-btn");
return Task.CompletedTask;
}
public void Dispose() { }
}
internal class SimpleCommand : ICommand
{
private readonly Action _execute;
public SimpleCommand(Action execute) => _execute = execute;
public event EventHandler? CanExecuteChanged { add { } remove { } }
public bool CanExecute(object? parameter) => true;
public void Execute(object? parameter) => _execute();
}