-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGuideViewModel.cs
More file actions
77 lines (67 loc) · 3.1 KB
/
GuideViewModel.cs
File metadata and controls
77 lines (67 loc) · 3.1 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System.Windows.Input;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Microsoft.Extensions.Logging;
using SipLine.Plugin.Sdk;
using SipLine.Plugin.HelloWorld.Resources;
namespace SipLine.Plugin.HelloWorld
{
public class GuideViewModel : INotifyPropertyChanged
{
private readonly IPluginContext _context;
public event PropertyChangedEventHandler? PropertyChanged;
public string Title => Strings.GuideTitle;
public string WelcomeMessage => Strings.GuideSubtitle;
public string WhatIsPlugin => Strings.WhatIsPlugin;
public string WhatIsPluginDesc => Strings.WhatIsPluginDesc;
public string Capabilities => Strings.Capabilities;
public string CapCallControl => Strings.CapCallControl;
public string CapCallControlDesc => Strings.CapCallControlDesc;
public string CapUiExtensions => Strings.CapUiExtensions;
public string CapUiExtensionsDesc => Strings.CapUiExtensionsDesc;
public string CapEvents => Strings.CapEvents;
public string CapEventsDesc => Strings.CapEventsDesc;
public string CapStorage => Strings.CapStorage;
public string CapStorageDesc => Strings.CapStorageDesc;
public string QuickStart => Strings.QuickStart;
public string QuickStartStep1 => Strings.QuickStartStep1;
public string QuickStartStep2 => Strings.QuickStartStep2;
public string QuickStartStep3 => Strings.QuickStartStep3;
public string ViewOnGithub => Strings.ViewOnGithub;
public string ReadDocs => Strings.ReadDocs;
public string SdkCardDesc => Strings.SdkCardDesc;
public string DocsCardDesc => Strings.DocsCardDesc;
public ICommand OpenSdkGithubCommand { get; }
public ICommand OpenDocumentationCommand { get; }
public GuideViewModel(IPluginContext context)
{
_context = context;
OpenSdkGithubCommand = new SimpleCommand(() => OpenUrl("https://github.com/feelautom/SipLine.Plugin.Sdk"));
OpenDocumentationCommand = new SimpleCommand(() => OpenUrl("https://sipline.feelautom.fr/docs/sdk"));
}
public void RefreshStrings()
{
OnPropertyChanged(string.Empty); // Notifie que TOUTES les propriétés ont changé
}
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private void OpenUrl(string url)
{
try
{
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
{
FileName = url,
UseShellExecute = true
});
}
catch (Exception ex)
{
_context.Logger.LogError(ex, "Impossible d'ouvrir l'URL : {Url}", url);
_context.ShowSnackbar(Strings.ErrorOpeningLink, SnackbarSeverity.Error);
}
}
}
}