⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mothermdl.pas

📁 Delphi利用MVC开发的典型例子
💻 PAS
字号:
unit MotherMdl;

interface
uses Classes, forms, SysUtils, patterns;

type
  TModelMother = class(TObservable)
  public
    constructor Create;
    destructor Destroy; override;
    procedure response(cmd: string; const args: TCommand = nil; sargs: string = '');
  end;


implementation
uses commandlist, indexDef;

procedure TModelMother.response(cmd: string; const args: TCommand = nil; sargs: string = '');
var
  p: PResponseInfo;
begin
  //you can add very complex logic code here
  new(p);
  p.CMD := cmd;

  if cmd = CMD_NODE_SELECT then
  begin
    p.response := 'I was selected!';
  end
  else if cmd = CMD_DAD_PLAYGAME then
  begin
    p.Response := 'Sorry!';
    p.ActualMean := 'Oh, come on,be a mature man,stop playing the stupid game!';
  end
  else if cmd = CMD_DAD_PLAYGAME then
  begin
    p.Response := 'Sorry!';
    p.ActualMean := 'Oh, come on,be a mature man,stop playing the stupid game!';
  end
  else if (cmd = CMD_BABY_CHOCOLATE) then
  begin
    p.Response := 'Sorry,honey.No more today.';
    p.ActualMean := '';
  end
  else if (cmd = CMD_BABY_CARTOON) then
  begin
    p.Response := 'No,honey,it''s too late,go to sleep.';
    p.ActualMean := '';
  end;

  //release p when command released
  self.Notify(TCommand.create(cmd, p));
end;

constructor TModelMother.Create;
begin
end;

destructor TModelMother.Destroy;
begin
  inherited;
end;


end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -