昨天我自己引用了一个国外的网页,是关于MVC的,也是给大家做参考的,其实他所理解的MVC我不完全赞成,现将我的MVC 实现公布
下面是C控制层的代码!!!
{*******************************************************} { unit name: Controller } { class: TProgramController } { descripate: 此Class为MVC中的控制层, } { 担任着程序流程的调度工作 } { blog : http://blog.csdn.net/zhuam } { author: zhuam } { date : 2004/10/25 } { Copyright (c) 1.0 } {*******************************************************}
unit Controller;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Mask, ExtCtrls, Model;
{----------------------------------- descripate: 用于分发程序的业务流程 ------------------------------------} type TProgramController=class(TObject) private TempModelClass:IProgramModel; //业务逻辑Class <Base Model> public procedure portal(FView:TForm;sOperator:string);
end;
implementation
uses Util, UnitMVCExample;
{ TProgramController }
procedure TProgramController.portal(FView: TForm;sOperator: string); var ClassTemp:TComponentClass; SListRead:TSListReader; XMLRead:TXMLReader; sModel:string; begin try SListRead:=TSListReader.Create; XMLRead:=TXMLReader.Create; sModel:=SListRead.getSListDataToModelString(XMLRead.getXMLDataToList,FView.Name,sOperator); if Trim(sModel)<>'''''''' then begin ClassTemp:=TComponentClass(getClass(sModel)); //类似java中的反射,根据名称产生Class实例 TempModelClass:=(ClassTemp.Create(nil) as IProgramModel); TempModelClass.Execute(FView); end; except //raise end; end;
initialization
RegisterClass(TForm1Model);
end.
[系统软件]InstallShield Express for delphi制作安装程序定… [常用软件]InstallShield Express制作Delphi数据库安装程序 [Delphi程序]为什么选择Delphi.Net ? [Delphi程序]《关于VisiBroker For Delphi的使用》(4) [Delphi程序]Delphi 程序员代码编写标准指南 [Delphi程序]转贴:Conversion to Delphi 6: Missing unit Pro… [Delphi程序]Borland Delphi 9 的新特性 [Delphi程序]Delphi 键盘码表 [Delphi程序]Chuck Jazdzewski的离开意味着Delphi的终结吗? [Delphi程序]Delphi Access violations 问题的解决之道
|