X01.TestViewContent: plug-in test and browser plug-in Test
Developing the SharpDevelop plug-in system is essential for learning.
1. First download the source code on github to ensure that the compilation and running are correct.
2. add the SharpDevelop plug-in project x01.TestViewContent under AddIns/Misc, and then add ICSharpCode. core and ICSharpCode. sharpDevelop reference, set the Local Copy of the two references to false; select the compilation output as ".. \.. \.. \.. \ AddIns \ Misc \ TestViewContent \ ", refer to other plug-ins. Set the Local copy attribute of TestViewContent. addin to Always.
3. Add TestViewContent. cs as follows:
1/*** TestViewContent. cs (c) 2015 by x01 3 */4 using System; 5 using System. windows. forms; 6 using ICSharpCode. sharpDevelop. gui; 7 8 namespace x01.TestViewContent 9 {10 /// <summary> 11 // Description of TestViewContent.12 // </summary> 13 public class TestViewContent: AbstractViewContent14 {15 Control control; 16 17 public override Control {18 get {19 return control; 20} 21} 22 23 pub Lic TestViewContent (): base ("Test") 24 {25 Panel panel = new Panel (); 26 panel. dock = DockStyle. fill; 27 28 TextBox textbox = new TextBox (); 29 textbox. text = "Hello world! "; 30 textbox. dock = DockStyle. fill; 31 textbox. multiline = true; 32 textbox. height = 500; 33 34 panel. controls. add (textbox); 35 36 this. control = panel; 37} 38} 39}TestViewContent
4. Add the class TestCommand. cs. The content is as follows:
1/** 2 * TestCommand. cs (c) 2015 by x01 3 */4 using System; 5 using ICSharpCode. sharpDevelop; 6 using ICSharpCode. sharpDevelop. gui; 7 8 namespace x01.TestViewContent 9 {10 /// <summary> 11 /// Description of TestCommand.12 /// </summary> 13 public class TestCommand: abstractMenuCommand14 {15 public override void Run () 16 {17 WorkbenchSingleton. workbench. showView (new TestViewContent (); 18} 19} 20}TestCommand
5. The content after TestViewContent. addin is modified is as follows:
1 <AddIn name = "x01.TestViewContent" 2 author = "Administrator" 3 url = "" 4 description = "TODO: Put description here"> 5 6 <Runtime> 7 <Import assembly = "x01.TestViewContent.dll"/> 8 </Runtime> 9 10 <!-- Extend the SharpDevelop AddIn-Tree like this:11 <Path name = ...>12 <.../>13 </Path>14 -->15 <Path name="/Workspace/Autostart">16 <Class id="TestCommand"17 class="x01.TestViewContent.TestCommand" />18 </Path>19 </AddIn>
The key part is 15-18 rows.
6. compile and generate the plug-in project. OK! At this time, you will be surprised to find that the plug-in is available without re-compiling the entire Solution and directly entering the bin directory to run SharpDevelop.exe. As follows: