zoukankan      html  css  js  c++  java
  • x01.TestViewContent: 插件测试

    开发神器 SharpDevelop 的插件系统,很有学习的必要。

    1.首先在 github 上下载源代码,确保编译运行无误。

    2.在 AddIns/Misc 下添加 SharpDevelop 插件项目 x01.TestViewContent,然后添加 ICSharpCode.Core 和 ICSharpCode.SharpDevelop 引用,设置这两个引用的 Local Copy 为 false;在项目属性上选编译输出为  “........AddInsAddInsMiscTestViewContent”,可参考其他插件。设置 TestViewContent.addin 的文件属性 Local copy 为 Always。

    3.添加类 TestViewContent.cs, 内容如下:

     1 /**
     2  * 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 : AbstractViewContent
    14     {
    15         Control control;        
    16         
    17         public override Control Control {
    18             get {
    19                 return control;
    20             }
    21         }
    22         
    23         public 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.添加类 TestCommand.cs,内容如下:

     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 : AbstractMenuCommand
    14     {
    15         public override void Run()
    16         {
    17             WorkbenchSingleton.Workbench.ShowView(new TestViewContent());
    18         }
    19     }
    20 }
    TestCommand

    5.修改 TestViewContent.addin 后的内容如下:

     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>

    关键部分是 15-18行。

    6.编译生成该插件项目。OK!这时,你会惊奇的发现,不需重新编译整个 Solution,直接进入 bin 目录运行 SharpDevelop.exe 时,该插件已然可用。效果图如下:

  • 相关阅读:
    JS实现继承的几种方式
    跨平台APP----对Cordova,APPCan,DCloud,APICloud四大平台的分析
    cordova生成的android项目导入到Android studio 2.X 中遇到的问题解决方案
    链操作相关命令(包括启动,重启,删除)
    冷钱包和热钱包有什么区别?
    常用命令之git/linux
    centos安装git,go,shasum,okexchain环境
    iterm2的下载安装与配置
    使用jsdoc-to-markdown提前js文件的文档
    基于sphinx的文档(一)将md转为rst
  • 原文地址:https://www.cnblogs.com/china_x01/p/4958137.html
Copyright © 2011-2022 走看看