收藏本站 收藏本站
积木网首页 - 软件测试 - 常用手册 - 站长工具 - 技术社区
积木学院 > 程序开发 > C# > 正文

将Delphi作为ASP.NET的脚本语言(2)

来源:互联摘选 日期:2006-03-09 15:59
     //------------------------------------------------------------------------------
  // <autogenerated>
  // 本代码由一个工具生成
  // 运行版本:1.0.3705.209
  //
  // 修改本文件将导致异常行为并丢失生成的代码。
  // </autogenerated>
  //------------------------------------------------------------------------------
  
  unit ASP;
  
  interface
  
  uses System.Collections, System.Collections.Specialized, System.Configuration,
   System.Text, System.Text.RegularExpressions, System.Web, System.Web.Caching,
   System.Web.SessionState, System.Web.Security, System.Web.UI, System.Web.UI.WebControls,
   System.Web.UI.HtmlControls, System.Globalization;
  
  var
   editdemo_aspx___autoHandlers: Integer;
   editdemo_aspx___intialized: Boolean = False;
   editdemo_aspx___fileDependencies: System.Collections.ArrayList;
  type
   editdemo_aspx = class(System.Web.UI.Page, System.Web.SessionState.IRequiresSessionState)
   protected
   Edit1: System.Web.UI.WebControls.TextBox;
   __control3: System.Web.UI.WebControls.Button;
   __control2: System.Web.UI.HtmlControls.HtmlForm;
   Message: System.Web.UI.WebControls.Label;
   procedure ButtonClick(Sender: System.Object; E: EventArgs);
   public
   constructor Create;
   function get_AutoHandlers: Integer; override;
   function get_ApplicationInstance: System.Web.HttpApplication; virtual;
   function get_TemplateSourceDirectory: System.String; override;
   procedure set_AutoHandlers(Value: Integer); override;
   protected
   property AutoHandlers: Integer read get_AutoHandlers write set_AutoHandlers;
   property ApplicationInstance: System.Web.HttpApplication read get_ApplicationInstance;
   public
   property TemplateSourceDirectory: System.String read get_TemplateSourceDirectory;
   private
   function __BuildControlEdit1: System.Web.UI.Control;
   function __BuildControl__control3: System.Web.UI.Control;
   function __BuildControl__control2: System.Web.UI.Control;
   function __BuildControlMessage: System.Web.UI.Control;
   procedure __BuildControlTree(__ctrl: System.Web.UI.Control);
   protected
   procedure FrameworkInitialize; override;
   public
   function GetTypeHashCode: Integer; override;
   end;
  
  implementation
  
  
   procedure editdemo_aspx.ButtonClick(Sender: System.Object; E: EventArgs);
   begin
   Message.Text := Edit1.Text;
   end;
   constructor editdemo_aspx.Create;
  var
   dependencies: System.Collections.ArrayList;
  begin
   inherited Create;
  
   if (ASP.editdemo_aspx___intialized = False) then
   begin
   dependencies := System.Collections.ArrayList.Create;
   dependencies.Add('d:\vslive\editdemo.aspx');
   ASP.editdemo_aspx___fileDependencies := dependencies;
   ASP.editdemo_aspx___intialized := True;
   end;
   Self.Server.ScriptTimeout := 30000000;
  end;
  
  function editdemo_aspx.get_AutoHandlers: Integer;
  begin
   Result := ASP.editdemo_aspx___autoHandlers;
  end;
  
  function editdemo_aspx.get_ApplicationInstance: System.Web.HttpApplication;
  begin
   Result := Self.Context.ApplicationInstance as System.Web.HttpApplication;
  end;
  
  function editdemo_aspx.get_TemplateSourceDirectory: System.String;
  begin
   Result := '/vslive';
  end;
  
  procedure editdemo_aspx.set_AutoHandlers(Value: Integer);
  begin
   ASP.editdemo_aspx___autoHandlers := Value;
  end;
  
  function editdemo_aspx.__BuildControlEdit1: System.Web.UI.Control;
  var
   __ctrl: System.Web.UI.WebControls.TextBox;
  begin
  
   __ctrl := System.Web.UI.WebControls.TextBox.Create;
   Self.Edit1 := __ctrl;
   __ctrl.ID := 'Edit1';
   __ctrl.Width := System.Web.UI.WebControls.Unit.Parse('300px', System.Globalization.CultureInfo.InvariantCulture);
   Result := __ctrl;
  end;
  
  function editdemo_aspx.__BuildControl__control3: System.Web.UI.Control;
  var
   __ctrl: System.Web.UI.WebControls.Button;
  begin
  
   __ctrl := System.Web.UI.WebControls.Button.Create;
   Self.__control3 := __ctrl;
   __ctrl.Text := 'Click Me!';
   __ctrl.add_Click(Self.ButtonClick);
   Result := __ctrl;
  end;
  
  function editdemo_aspx.__BuildControl__control2: System.Web.UI.Control;
  var
   __parser: System.Web.UI.IParserAccessor;
   __ctrl: System.Web.UI.HtmlControls.HtmlForm;
  begin
  
   __ctrl := System.Web.UI.HtmlControls.HtmlForm.Create;
   Self.__control2 := __ctrl;
   __parser := __ctrl as System.Web.UI.IParserAccessor;
   __parser.AddParsedSubObject(System.Web.UI.LiteralControl.Create(''#13#10' '));
   Self.__BuildControlEdit1;
   __parser.AddParsedSubObject(Self.Edit1);
   __parser.AddParsedSubObject(System.Web.UI.LiteralControl.Create(''#13#10' '));
   Self.__BuildControl__control3;
   __parser.AddParsedSubObject(Self.__control3);
   __parser.AddParsedSubObject(System.Web.UI.LiteralControl.Create(''#13#10' '));
   Result := __ctrl;
  end;
  
  function editdemo_aspx.__BuildControlMessage: System.Web.UI.Control;
  var
   __ctrl: System.Web.UI.WebControls.Label;
  begin
  
   __ctrl := System.Web.UI.WebControls.Label.Create;
   Self.Message := __ctrl;
   __ctrl.ID := 'Message';
   Result := __ctrl;
  end;
  
  procedure editdemo_aspx.__BuildControlTree(__ctrl: System.Web.UI.Control);
  var
   __parser: System.Web.UI.IParserAccessor;
  begin
   __parser := __ctrl as System.Web.UI.IParserAccessor;
   __parser.AddParsedSubObject(System.Web.UI.LiteralControl.Create('<html>'#13#10' '));
   __parser.AddParsedSubObject(System.Web.UI.LiteralControl.Create(''#13#10' <body>'#13#10' '));
   Self.__BuildControl__control2;
   __parser.AddParsedSubObject(Self.__control2);
   __parser.AddParsedSubObject(System.Web.UI.LiteralControl.Create(''#13#10' <p><b>'));
   Self.__BuildControlMessage;
   __parser.AddParsedSubObject(Self.Message);
   __parser.AddParsedSubObject(System.Web.UI.LiteralControl.Create('</b></p>'#13#10' </body>'#13#10'</html>'#13#10));
  end;
  
  procedure editdemo_aspx.FrameworkInitialize;
  begin
   Self.__BuildControlTree(Self);
   Self.FileDependencies := ASP.editdemo_aspx___fileDependencies;
   Self.EnableViewStateMac := True;
  end;
  
  function editdemo_aspx.GetTypeHashCode: Integer;
  begin
   Result := -764444463;
  end;
  
  end.
  
  注意:这里介绍的是Delphi的.NET编译器功能的预览。正式发布的Delphi 7生成的代码与上面将有显著不同。本文仅是示例说明如何在ASP.NET中使用Delphi及其功能。
  
  
  
  

推荐阅读

 

热点信息

 
强悍的草根IT技术社区,这里应该有您想要的!
Copyright © 2010 Gimoo.Net. All Rights Rreserved  京ICP备05050695号