BioCore  5.0.0
A Windows .NET microscopy library and application for viewing, editing, and annotating images.
Loading...
Searching...
No Matches
BioCore.Plugins Class Reference

Static Public Member Functions

static void Initialize ()
 
static void KeyUpEvent (object o, KeyEventArgs e)
 
static void KeyDownEvent (object o, KeyEventArgs e)
 
static void KeyPressEvent (object o, KeyPressEventArgs e)
 
static void ScrollEvent (object o, MouseEventArgs args)
 
static void Paint (object o, PaintEventArgs e)
 
static void Render (object o, PaintEventArgs e)
 
static void MouseMove (object o, PointD e, MouseEventArgs buts)
 
static void MouseUp (object o, PointD e, MouseEventArgs buts)
 
static void MouseDown (object o, PointD e, MouseEventArgs buts)
 

Detailed Description

Definition at line 36 of file Plugin.cs.

Member Function Documentation

◆ Initialize()

static void BioCore.Plugins.Initialize ( )
static

Definition at line 38 of file Plugin.cs.

39 {
40 Directory.CreateDirectory("Plugins");
41 foreach (string s in Directory.GetFiles("Plugins"))
42 {
43 if (!s.EndsWith(".dll") || Plugin.Plugins.ContainsKey(Path.GetFileName(s)))
44 continue;
45 // Load the plugin assembly
46 Assembly pluginAssembly = Assembly.LoadFile(Environment.CurrentDirectory + "/" + s);
47 // Find the type which implements the IPlugin interface
48 var pluginType = pluginAssembly.GetTypes().FirstOrDefault(t => typeof(IPlugin).IsAssignableFrom(t) && !t.IsInterface);
49 if (pluginType != null)
50 {
51 // Create an instance of this type
52 IPlugin pluginInstance = Activator.CreateInstance(pluginType) as IPlugin;
53 Plugin.Plugins.Add(Path.GetFileName(s), pluginInstance);
54 if (pluginInstance.ContextMenu)
55 App.AddContextMenu(pluginInstance.MenuPath);
56 else
57 App.AddMenu(pluginInstance.MenuPath);
58 }
59 else
60 {
61 Console.WriteLine("No plugin found in the assembly: " + s);
62 }
63 }
64 }
static void AddMenu(string menu)
Definition App.cs:207
static void AddContextMenu(string menu)
Definition App.cs:215
static Dictionary< string, IPlugin > Plugins
Definition Plugin.cs:17

◆ KeyDownEvent()

static void BioCore.Plugins.KeyDownEvent ( object o,
KeyEventArgs e )
static

Definition at line 72 of file Plugin.cs.

73 {
74 foreach (IPlugin p in Plugin.Plugins.Values)
75 {
76 p.KeyDownEvent(o, e);
77 }
78 }

◆ KeyPressEvent()

static void BioCore.Plugins.KeyPressEvent ( object o,
KeyPressEventArgs e )
static

Definition at line 79 of file Plugin.cs.

80 {
81 foreach (IPlugin p in Plugin.Plugins.Values)
82 {
83 p.KeyPressEvent(o, e);
84 }
85 }

◆ KeyUpEvent()

static void BioCore.Plugins.KeyUpEvent ( object o,
KeyEventArgs e )
static

Definition at line 65 of file Plugin.cs.

66 {
67 foreach (IPlugin p in Plugin.Plugins.Values)
68 {
69 p.KeyUpEvent(o, e);
70 }
71 }

◆ MouseDown()

static void BioCore.Plugins.MouseDown ( object o,
PointD e,
MouseEventArgs buts )
static

Definition at line 121 of file Plugin.cs.

122 {
123 foreach (IPlugin p in Plugin.Plugins.Values)
124 {
125 p.MouseDown(o, e, buts);
126 }
127 }

◆ MouseMove()

static void BioCore.Plugins.MouseMove ( object o,
PointD e,
MouseEventArgs buts )
static

Definition at line 107 of file Plugin.cs.

108 {
109 foreach (IPlugin p in Plugin.Plugins.Values)
110 {
111 p.MouseMove(o, e, buts);
112 }
113 }

◆ MouseUp()

static void BioCore.Plugins.MouseUp ( object o,
PointD e,
MouseEventArgs buts )
static

Definition at line 114 of file Plugin.cs.

115 {
116 foreach (IPlugin p in Plugin.Plugins.Values)
117 {
118 p.MouseUp(o, e, buts);
119 }
120 }

◆ Paint()

static void BioCore.Plugins.Paint ( object o,
PaintEventArgs e )
static

Definition at line 93 of file Plugin.cs.

94 {
95 foreach (IPlugin p in Plugin.Plugins.Values)
96 {
97 p.Paint(o, e);
98 }
99 }

◆ Render()

static void BioCore.Plugins.Render ( object o,
PaintEventArgs e )
static

Definition at line 100 of file Plugin.cs.

101 {
102 foreach (IPlugin p in Plugin.Plugins.Values)
103 {
104 p.Render(o, e);
105 }
106 }

◆ ScrollEvent()

static void BioCore.Plugins.ScrollEvent ( object o,
MouseEventArgs args )
static

Definition at line 86 of file Plugin.cs.

87 {
88 foreach (IPlugin p in Plugin.Plugins.Values)
89 {
90 p.ScrollEvent(o, args);
91 }
92 }

The documentation for this class was generated from the following file: