zoukankan      html  css  js  c++  java
  • 首次的Rainbow 模块Hello World

    首次开发rainbow的模块,其实很简单,就是webcontrol.ascx控件。按照How to build a Private Module Assembly in Rainbow.doc过程一点一点的来。(按照本人的理解和原文翻译,加上自己的实际操作)
    首先建立一个解决方案,然后添加工程,使用web。制作好web共享目录,然后再工程中添加用户控件。再里面工程自动建立的webform1.aspx文件不要删除,用它作调试用。将他设置为起始页。首先我们看看建立的工程是否正常。在添加的用户控件中写上hello world。然后打开webform1.aspx 文件,将用户控件(helloworld.ascx)托拽到webform1中。使用f5运行这是启动ie中可以正常显示。好的这样我们便可以进行开发了。
    要开发rainbow的模块必然我们要使用它的dll所以要引用他的dll.一般使用log4net.dll,rainbow.dll还有Esperantus.dll。下面我们打开helloworld.ascx.cs添加
    using Rainbow.UI;
    using Rainbow.UI.WebControls;

    这样便可以正常引用rainbow的一般控件了。
    下面我们将 

    public class helloworld : System.Web.UI.UserControl
    改成
     public class helloworld : PortalModuleControl

    可以更改
    override protected void OnInit(EventArgs e)
    { InitializeComponent();
     DesktopModuleTitle minttitle= new DesktopModuleTitle();

       Controls.AddAt(0, minttitle);
     base.OnInit(e); }
    这样可以在标题兰显示出模块的名称
    最后我们要得到他的guid
      public override Guid GuidID
      {
       get
       {
        return new Guid("{3D1DA2CD-1879-48fd-B4DB-8C9FABE6D16A}");
       }
      }

    再工具,创建guid然后将新的值替换即可。
    然后我们先不要运行,因为 public class helloworld : PortalModuleControl这个市编译不成功的。我们将webform1.aspx从项目中排除然后再f5运行。成功!
    最后一步我们要将helloworld这个模块放到rainbow中。
    我们要将bin目录的rainbowprj.dll,和rainbow.pdb文件靠到rianbow的bin中。在DesktopModules文件夹内建立helloworld然后将helloworld.ascx文件拷贝进去。我们可以制作install.xml文件进行自动安装。格式为:
    <?xml version="1.0" encoding="utf-8" ?>
    <Modules>
     <Module>
      <FriendlyName>Helloworld</FriendlyName>
      <DesktopSource>DesktopModules/helloworld/helloworld.ascx</DesktopSource>
      <MobileSource></MobileSource>
     </Module>
    </Modules>

    使用管理员登陆rainbow然后再模块界面添加模块
    输入Installer file:的相对路径,然后确定。或者install manully.输入相关参数,在站点中打勾。
    这样便可以使用了。
    有的时候不知道什么原因无法安装。我们可以人工输入到sql中。
    rb_GeneralModuleDefinitions
    rb_ModuleDefinitions
    里面大家一看就明白怎么添加
    下面写出源代码。using Rainbow.UI;
    using Rainbow.UI.WebControls;

    namespace rainbowprj
    {
        
    using System;
        
    using System.Data;
        
    using System.Drawing;
        
    using System.Web;
        
    using System.Web.UI.WebControls;
        
    using System.Web.UI.HtmlControls;

        
    /// <summary>
        
    ///        helloworld 的摘要说明。
        
    /// </summary>

        //public class helloworld : System.Web.UI.UserControl
        public class helloworld : PortalModuleControl
        
    {
            
    protected System.Web.UI.WebControls.Label Label1;
            
    protected System.Web.UI.WebControls.Button Button1;

            
    private void Page_Load(object sender, System.EventArgs e)
            
    {
                
    // 在此处放置用户代码以初始化页面
            }


            
    Web 窗体设计器生成的代码

            
    private void Button1_Click(object sender, System.EventArgs e)
            
    {
                
    this.Label1.Text="Rainbow";
            }


            
    public override Guid GuidID 
            
    {
                
    get
                
    {
                    
    return new Guid("{3D1DA2CD-1879-48fd-B4DB-8C9FABE6D16A}");
                }

            }


        }

    }

    <%@ Control Language="c#" AutoEventWireup="false" Codebehind="helloworld.ascx.cs" Inherits="rainbowprj.helloworld" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
    <FONT face="宋体">Hello World</FONT>
    <asp:Button id="Button1" Text="Button" runat="server"></asp:Button>
    <asp:Label id="Label1" runat="server" Width="136px">asp:Label>

    就是这么简单阿,希望能给第一次开发的人提供一个帮助,也希望高手提出宝贵意见。

  • 相关阅读:
    思念
    空白
    curl json string with variable All In One
    virtual scroll list All In One
    corejs & RegExp error All In One
    socket.io All In One
    vue camelCase vs PascalCase vs kebabcase All In One
    element ui 表单校验,非必填字段校验 All In One
    github 定时任务 UTC 时间不准确 bug All In One
    input range & color picker All In One
  • 原文地址:https://www.cnblogs.com/Mint/p/300914.html
Copyright © 2011-2022 走看看