forked from Pyxxil/EcogyPlugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlugins.cs
More file actions
57 lines (49 loc) · 2.1 KB
/
Plugins.cs
File metadata and controls
57 lines (49 loc) · 2.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
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
// This line is not mandatory, but improves loading performances
[assembly: ExtensionApplication(typeof(Ecogy.Plugins))]
namespace Ecogy
{
// This class is instantiated by AutoCAD once and kept alive for the
// duration of the session. If you don't do any one time initialization
// then you should remove this class.
public class Plugins : IExtensionApplication
{
void IExtensionApplication.Initialize()
{
// Add one time initialization here
// One common scenario is to setup a callback function here that
// unmanaged code can call.
// To do this:
// 1. Export a function from unmanaged code that takes a function
// pointer and stores the passed in value in a global variable.
// 2. Call this exported function in this function passing delegate.
// 3. When unmanaged code needs the services of this managed module
// you simply call acrxLoadApp() and by the time acrxLoadApp
// returns global function pointer is initialized to point to
// the C# delegate.
// For more info see:
// http://msdn2.microsoft.com/en-US/library/5zwkzwf4(VS.80).aspx
// http://msdn2.microsoft.com/en-us/library/44ey4b32(VS.80).aspx
// http://msdn2.microsoft.com/en-US/library/7esfatk4.aspx
// as well as some of the existing AutoCAD managed apps.
// Initialize your plug-in application here
Application.EnterModal += Application_EnterModal;
}
private void Application_EnterModal(object sender, System.EventArgs e)
{
try
{
Commands.GoogleDrive();
}
finally
{
// Basically ignore this for now, as it's most likely they just haven't run the command
}
}
void IExtensionApplication.Terminate()
{
// Do plug-in application clean up here
}
}
}