-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVoicemeeterPlugin.cs
66 lines (55 loc) · 1.89 KB
/
VoicemeeterPlugin.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
using SuchByte.MacroDeck.Plugins;
using PW.VoicemeeterPlugin.Actions;
using System;
using VoicemeeterControl = PW.VoicemeeterPlugin.Services.Voicemeeter.Control;
using PW.VoicemeeterPlugin.Services;
namespace PW.VoicemeeterPlugin;
internal static class PluginInstance
{
public static MacroDeckPlugin Plugin { get; set; }
public static VoicemeeterControl VoicemeeterControl { get; set; }
}
public class VoicemeeterPlugin : MacroDeckPlugin
{
public override bool CanConfigure => true;
/// <summary>
/// Gets called when Macro Deck enables the plugin
/// </summary>
public override void Enable()
{
//optimized initialization
new System.Threading.Tasks.Task(() => PluginInstance.VoicemeeterControl = new()).Start();
Actions = new()
{
new DeviceToggleAction(),
new DeviceSliderAction(),
new CommandAction(),
new AdvancedAction(),
new MacroButtonAction(),
};
}
/// <summary>
/// Gets called when the user wants to configure the plugin
/// </summary>
public override void OpenConfigurator()
{
//using var config = new Views.VoicemeeterGlobalConfigView(this);
using var config = new Views.AddAdditionalVariablesConfigView();
config.ShowDialog();
}
public VoicemeeterPlugin()
{
PluginInstance.Plugin = this;
LocalizationManager.CreateInstance();
SuchByte.MacroDeck.MacroDeck.OnMainWindowLoad += MacroDeck_OnMainWindowLoad;
}
private ViewModels.StatusButtonViewModel? _statusButton;
private void MacroDeck_OnMainWindowLoad(object? sender, EventArgs e)
{
if (sender is SuchByte.MacroDeck.GUI.MainWindow mainWindow)
{
_statusButton = new ViewModels.StatusButtonViewModel();
mainWindow.contentButtonPanel.Controls.Add(_statusButton.StatusButton);
}
}
}