-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContextformPlugin.cs
More file actions
67 lines (55 loc) · 1.85 KB
/
Copy pathContextformPlugin.cs
File metadata and controls
67 lines (55 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
63
64
65
66
67
using System;
using Rhino;
using Rhino.PlugIns;
using Rhino.UI;
using Contextform.UI;
using Contextform.Capture;
namespace Contextform
{
[System.Runtime.InteropServices.Guid("3f85ca5d-7b5b-4c0e-9f2a-1d6e8c4b9a2e")]
public class ContextformPlugin : PlugIn
{
private static ContextformPlugin _instance;
private CommandCapture _commandCapture;
private MemoryManager _memoryManager;
public static ContextformPlugin Instance => _instance;
public CommandCapture CommandCapture => _commandCapture;
public MemoryManager MemoryManager => _memoryManager;
public ContextformPlugin()
{
_instance = this;
}
protected override LoadReturnCode OnLoad(ref string errorMessage)
{
try
{
_memoryManager = new MemoryManager();
_commandCapture = new CommandCapture(_memoryManager);
// Register the panel
Panels.RegisterPanel(this, typeof(ContextformPanel), "Contextform", null);
RhinoApp.WriteLine("Contextform plugin loaded successfully.");
return LoadReturnCode.Success;
}
catch (Exception ex)
{
errorMessage = $"Failed to load Contextform plugin: {ex.Message}";
return LoadReturnCode.ErrorShowDialog;
}
}
protected override void OnShutdown()
{
_commandCapture?.Dispose();
base.OnShutdown();
}
public override PlugInLoadTime LoadTime => PlugInLoadTime.AtStartup;
public void StartCapture()
{
_commandCapture?.Start();
}
public void StopCapture()
{
_commandCapture?.Stop();
}
public bool IsCapturing => _commandCapture?.IsCapturing ?? false;
}
}