-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReadme.html
More file actions
551 lines (464 loc) · 18.6 KB
/
Readme.html
File metadata and controls
551 lines (464 loc) · 18.6 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
<!DOCTYPE html>
<html>
<head>
<title>Readme</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
/* GitHub stylesheet for MarkdownPad (http://markdownpad.com) */
/* Author: Nicolas Hery - http://nicolashery.com */
/* Version: b13fe65ca28d2e568c6ed5d7f06581183df8f2ff */
/* Source: https://github.com/nicolahery/markdownpad-github */
/* RESET
=============================================================================*/
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
}
/* BODY
=============================================================================*/
body {
font-family: Helvetica, arial, freesans, clean, sans-serif;
font-size: 14px;
line-height: 1.6;
color: #333;
background-color: #fff;
padding: 20px;
max-width: 960px;
margin: 0 auto;
}
body>*:first-child {
margin-top: 0 !important;
}
body>*:last-child {
margin-bottom: 0 !important;
}
/* BLOCKS
=============================================================================*/
p, blockquote, ul, ol, dl, table, pre {
margin: 15px 0;
}
/* HEADERS
=============================================================================*/
h1, h2, h3, h4, h5, h6 {
margin: 20px 0 10px;
padding: 0;
font-weight: bold;
-webkit-font-smoothing: antialiased;
}
h1 tt, h1 code, h2 tt, h2 code, h3 tt, h3 code, h4 tt, h4 code, h5 tt, h5 code, h6 tt, h6 code {
font-size: inherit;
}
h1 {
font-size: 28px;
color: #000;
}
h2 {
font-size: 24px;
border-bottom: 1px solid #ccc;
color: #000;
}
h3 {
font-size: 18px;
}
h4 {
font-size: 16px;
}
h5 {
font-size: 14px;
}
h6 {
color: #777;
font-size: 14px;
}
body>h2:first-child, body>h1:first-child, body>h1:first-child+h2, body>h3:first-child, body>h4:first-child, body>h5:first-child, body>h6:first-child {
margin-top: 0;
padding-top: 0;
}
a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 {
margin-top: 0;
padding-top: 0;
}
h1+p, h2+p, h3+p, h4+p, h5+p, h6+p {
margin-top: 10px;
}
/* LINKS
=============================================================================*/
a {
color: #4183C4;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
/* LISTS
=============================================================================*/
ul, ol {
padding-left: 30px;
}
ul li > :first-child,
ol li > :first-child,
ul li ul:first-of-type,
ol li ol:first-of-type,
ul li ol:first-of-type,
ol li ul:first-of-type {
margin-top: 0px;
}
ul ul, ul ol, ol ol, ol ul {
margin-bottom: 0;
}
dl {
padding: 0;
}
dl dt {
font-size: 14px;
font-weight: bold;
font-style: italic;
padding: 0;
margin: 15px 0 5px;
}
dl dt:first-child {
padding: 0;
}
dl dt>:first-child {
margin-top: 0px;
}
dl dt>:last-child {
margin-bottom: 0px;
}
dl dd {
margin: 0 0 15px;
padding: 0 15px;
}
dl dd>:first-child {
margin-top: 0px;
}
dl dd>:last-child {
margin-bottom: 0px;
}
/* CODE
=============================================================================*/
pre, code, tt {
font-size: 12px;
font-family: Consolas, "Liberation Mono", Courier, monospace;
}
code, tt {
margin: 0 0px;
padding: 0px 0px;
white-space: nowrap;
border: 1px solid #eaeaea;
background-color: #f8f8f8;
border-radius: 3px;
}
pre>code {
margin: 0;
padding: 0;
white-space: pre;
border: none;
background: transparent;
}
pre {
background-color: #f8f8f8;
border: 1px solid #ccc;
font-size: 13px;
line-height: 19px;
overflow: auto;
padding: 6px 10px;
border-radius: 3px;
}
pre code, pre tt {
background-color: transparent;
border: none;
}
kbd {
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
-moz-border-right-colors: none;
-moz-border-top-colors: none;
background-color: #DDDDDD;
background-image: linear-gradient(#F1F1F1, #DDDDDD);
background-repeat: repeat-x;
border-color: #DDDDDD #CCCCCC #CCCCCC #DDDDDD;
border-image: none;
border-radius: 2px 2px 2px 2px;
border-style: solid;
border-width: 1px;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
line-height: 10px;
padding: 1px 4px;
}
/* QUOTES
=============================================================================*/
blockquote {
border-left: 4px solid #DDD;
padding: 0 15px;
color: #777;
}
blockquote>:first-child {
margin-top: 0px;
}
blockquote>:last-child {
margin-bottom: 0px;
}
/* HORIZONTAL RULES
=============================================================================*/
hr {
clear: both;
margin: 15px 0;
height: 0px;
overflow: hidden;
border: none;
background: transparent;
border-bottom: 4px solid #ddd;
padding: 0;
}
/* TABLES
=============================================================================*/
table th {
font-weight: bold;
}
table th, table td {
border: 1px solid #ccc;
padding: 6px 13px;
}
table tr {
border-top: 1px solid #ccc;
background-color: #fff;
}
table tr:nth-child(2n) {
background-color: #f8f8f8;
}
/* IMAGES
=============================================================================*/
img {
max-width: 100%
}
</style>
</head>
<body>
<h1>Implementing Extensible Application Framework Plugins</h1>
<p>This document contains instructions on how to create, debug and deploy plugins
for the Extensible Application Framework.</p>
<h2>Create and Configure Project</h2>
<h3>Project References</h3>
<p>Plugins are class libraries (.DLL files) whose member classes inherit classes
from the <code>ExtensibleFramework.Core</code> namespace. This requires, therefore, that
you add a reference to the <code>ExtensibleFramework.Core.dll</code> file in your
project.</p>
<p>Follow the process of adding a reference to a project in Visual Studio for the
language you are developing in to add a reference to the
<code>ExtensibleFramework.Core.dll</code> file.<br />
Optionally, set the <em>Copy To Local</em> of the reference to <strong>False</strong>. Though the
Extensible Framework program is designed to load libraries only when required,
doing this will greatly improve the performance of the application.</p>
<h3>The INFO.TXT File</h3>
<p>In order to determine which class libraries are plugins, the extensible
framework application scans all directories for files whose names match the
expression *.info.txt (e.g. <em>myFirstPlugin.info.txt</em>). </p>
<p>Each line of this INFO.TXT file should contain the file name of a plugin
relative to the directory in which the INFO.TXT file is located but preferably
in the same directory as the plugin's .DLL file.</p>
<h4>Creating the INFO.TXT File</h4>
<p>Though it is fairly easy to create the INFO.TXT file manually, an easier and
more robust way of doing this is to have Visual Studio generate the file when
building the project using build events.</p>
<ol>
<li>Right click on the project in Solution Explorer and click on Properties.</li>
<li>Go to the <em>Compile</em> tab and then click on the <em>Build Events</em> button.</li>
<li>
Enter the following in the Post-build event command line text box:<br />
<code>CMD.EXE /C ECHO "$(TargetFileName)" > "$(TargetDir)$(TargetName).info.txt"</code>
</li>
<li>Click on OK to save the configuration.</li>
</ol>
<p>With this, an INFO.TXT file with the same name as your output file in the build
output directory. The INFO.TXT file will also be automatically populated with
the file name of the build output (the DLL file containing the plugin).</p>
<h2>Creating the Plugin</h2>
<p>All of the classes required to create a fully-functional plugin are in the
<code>ExtensibleFramework.Core</code> namespace. Creating a plugin is just a matter of
inheriting these classes and modifying the inherited methods to suit your needs.</p>
<h3>The plugin descriptor class</h3>
<p>The plugin descriptor class serves as the hub of all interaction with your
plugin. Ideally, each plugin assembly will have only one plugin descriptor
class. However, it is possible to put multiple plugin descriptor classes, and by
extension, multiple plugins in one assembly.</p>
<p>Each plugin descriptor must inherit the <code>ExtensibleFramework.Core.Plugin</code>
class and implement properties and methods that specify among other things, the
name, ID and activities present within the plugin.</p>
<h4>Creating a plugin descriptor class</h4>
<ol>
<li>Click on <code>Project > Add Class...</code> and add a new class to your project.</li>
<li>
Add the following line after the class definition line to inherit the base
plugin descriptor class.<br />
<code>Inherits ExtensibleFramework.Core.Plugin</code>
</li>
<li>Complete the code that was automatically generated when you inherited the
<code>Plugin</code> class.<br />
Optionally, you can override additional methods and properties to fine-tune
the way your plugin descriptor (and hence your plugin) works.</li>
</ol>
<p>The sample implementation of a plugin descriptor class is as shown below.</p>
<pre><code>Imports ExtensibleFramework.Core
Public Class DemoPlugin
Inherits ExtensibleFramework.Core.Plugin
Dim launchers() As ActivityLauncher
''' <summary>Gets the description of the plugin.</summary>
Public Overrides ReadOnly Property Description As String
Get
Return "Sample Extensible Application Framework plugin"
End Get
End Property
''' <summary>Gets the name of the plugin.</summary>
Public Overrides ReadOnly Property Name As String
Get
Return "Demo Plugin"
End Get
End Property
''' <summary>Gets the launchers for launching activities directly for this plugin.</summary>
Public Overrides ReadOnly Property ActivityLaunchers As IEnumerable(Of ActivityLauncher)
Get
If launchers.Length = 0 Then
' create two launchers for the two main activities in the plugin
Dim launchers(2) As ActivityLauncher
launchers(0) = New ActivityLauncher("Demo.Plugin.NotepadActivity",
"Notepad", My.Resources.TextEditor)
launchers(1) = New ActivityLauncher("Demo.Plugin.TimerActivity",
"Timer", My.Resources.Clock)
End If
Return launchers
End Get
End Property
''' <summary>
''' Creates the activity associated with the specified <paramref name="activityID" />.
''' </summary>
''' <param name="activityID">The activity ID of the activity to be created.</param>
''' <returns>An instance of <seealso cref="ActivityControl" />.</returns>
Public Overrides Function CreateActivity(activityID As String) As ActivityControl
' create an instance of the activity control whose ID is specified
Select Case activityID
Case "Demo.Plugin.TimerActivity"
Return New TimerActivity()
Case "Demo.Plugin.NotepadActivity"
Return New TextEditorActivity()
Case Else
Return Nothing
End Select
End Function
''' <summary>
''' Gets the ID of the <see cref="ActivityControl" /> to use for executing the specified command.
''' </summary>
''' <param name="command">The command to be evaluated.</param>
''' <returns>
''' The ID of the <see cref="ActivityControl" /> to use for executing <paramref name="command" />.
''' </returns><remarks>
''' The <paramref name="command" /> parameter will be will be passed to the
''' <see cref="Plugin.RunCommand" /> method if a <c>null</c> or empty string is returned.
''' </remarks>
Public Overrides Function GetActivityForCommand(command As String) As String
' try to determine if a given command can be run
If command.StartsWith("run-timer") Then
Return "Demo.Plugin.TimerActivity"
ElseIf command.StartsWith("edit-text") Then
Return "Demo.Plugin.NotepadActivity"
Else
Return ""
End If
End Function
''' <summary>Runs the specified command.</summary>
''' <param name="command">The command to be run.</param>
''' <returns>The result produced from running the command.</returns>
Public Overrides Function RunCommand(command As String) As Object
' no commands are run outside activities so return Nothing for every command that is passed.
Return Nothing
End Function
''' <summary>
''' Gets a value indicating whether the plugin supports the specified command.
''' </summary>
''' <param name="command">The command to be evaluated.</param>
''' <returns>
''' <c>true</c> if the plugin supports the specified command; else <c>false</c>.
''' </returns>
Public Overrides Function SupportsCommand(command As String) As Boolean
' shell off to the GetActivityForCommand() method to determine
' whether the plugin supports the given command.
Return Not String.IsNullOrEmpty(Me.GetActivityForCommand(command))
End Function
End Class
</code></pre>
<h3>Activities</h3>
<p>An activity is a container control hosting one or more controls to perform a
specific task. </p>
<p>Activities inherit the <code>ExtensibleFramework.Core.ActivityControl</code> class.
This base class implements a set of events and properties that can be used to
interact with the user, other activities in the plugin, as well as activities in
other plugins.</p>
<h4>Creating an Activity</h4>
<ol>
<li>Click on <code>Project > Add New Item...</code>. </li>
<li>Select <strong>Inherited User Control</strong> (Installed > Common Items > Windows Forms),
enter the name of the activity and click on <strong>Add</strong>.</li>
<li>In the Inheritance Picker dialog box that opens, select <strong>ActivityControl</strong>
component (namespace <strong>ExtensibleFramework.Core</strong>) and then click on <strong>OK</strong>.</li>
<li>Add controls in the design view to suit your purpose.</li>
<li>Switch to the code view and handle the events you want.</li>
</ol>
<p>The code below outlines the basic events that can be implemented by an activity
in order to interact with the Extensible Application Framework program.</p>
<pre><code>Public Class TimerActivity
Inherits ExtensibleFramework.Core.ActivityControl
Private Sub TimerActivity_Initializing(sender As Object, e As ExtensibleFramework.Core.InitializingEventArgs) Handles Me.Initializing
' the Initializing event is raised when the control is being prepared to be displayed.
' it is recommended to load and set default values of controls here.
' resource intensive operations should be reserved for the ActivityControl.Started event
' initialize the activity text in code;
' it cannot be set in design mode
Me.Text = "Sample Activity"
End Sub
Private Sub TimerActivity_Paused(sender As Object, e As EventArgs) Handles Me.Paused
' the Paused event is raised when the control's window is minimized or loses focus
' pause activities such as rendering and screen updates here
' since the user is not likely to see or interact with them
End Sub
Private Sub TimerActivity_Restart(sender As Object, e As ExtensibleFramework.Core.RestartEventArgs) Handles Me.Restart
' The Restart event is raised when the activity is started after being previously stopped.
' The most likely way this event will be raised is when the user navigates backwards to
' ActivityControl.Stopped event will be returned in the RestartedEventArgs.State property.
' You can use this to restore the state of your activity.
End Sub
Private Sub TimerActivity_Resumed(sender As Object, e As EventArgs) Handles Me.Resumed
' the Resumed event is raised when the control's window regains focus
' or is restored after being minimized
' Resume rendering and screen updates here for user interaction
End Sub
Private Sub TimerActivity_Started(sender As Object, e As EventArgs) Handles Me.Started
' The Started event is raised when the control has been initialized and is displayed to the
' user for interaction.
End Sub
Private Sub TimerActivity_Stopped(sender As Object, e As ExtensibleFramework.Core.StoppedEventArgs) Handles Me.Stopped
' This event is raised when this activity has been stopped and removed from the window.
' A stopped activity may or may not be resumed so it is recommended to save volatile values
' here. You should also stop all processing in anticipation of termination.
' The state of some controls such as caret position, scroll position and focused controls
' can be persisted in the StoppedEventArgs.State property in the event of a restart.
' The StoppedEventArgs.CleanUp property indicates whether large objects should be disposed of
' or not. It is set to True when the user navigates backwards and may not return to this
' activity.
' save the timer's running state
e.State = stopwatch.IsRunning
stopwatch.Stop()
tmrUpdate.Stop()
Me.Settings.SetValue("timer.Ticks", oldTime.Add(stopwatch.Elapsed).Ticks)
End Sub
Private Sub TimerActivity_Stopping(sender As Object, e As ExtensibleFramework.Core.StoppingEventArgs) Handles Me.Stopping
' Raised just before the activity is stopped. It allows you to prompt user to save open documents, etc.
' Setting the StoppingEventArgs.Cancel property to True prevents the activity from being stopped.
End Sub
' this activity.
' Values that were persisted in the StoppedEventArgs.State property during the
End Class
</code></pre>
</body>
</html>
<!-- This document was created with MarkdownPad, the Markdown editor for Windows (http://markdownpad.com) -->