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

📄 controllercreatorfile.pas

📁 delphi框架
💻 PAS
字号:
unit ControllerCreatorFile;

//
//   Implements the IOTAFile for TFormCreatorModule, TDataModuleCreatorModule,
// and the TFrameCreatorDataModule.
//
//   Notice the use of the parameters in the source code to allow the IDE
// to select the default identifierd for the files, classes and ancestor classes
//

//
// GExperts is necessary to run the Debug Window output.  Simply define
// GXDEBUG in the Project > Options > Directories/Conditionals under
// "Conditional Defines"
//

interface

uses
  Windows, SysUtils,
  ToolsApi;

const

  ControllerCode =
    'unit %ModuleIdent;                                        ' + #10#13 +
    '                                                          ' + #10#13 +
    '// This code was generated by the EasyMVC OTA Wizard      ' + #10#13 +
    '// www.eazisoft.com                                       ' + #10#13 +
    '                                                          ' + #10#13 +
    'interface                                                 ' + #10#13 +
    'uses                                                      ' + #10#13 +
    '  Windows, Messages, SysUtils, Variants, Classes,         ' + #10#13 +
    '  Graphics, Controls, Forms, patterns;                    ' + #10#13 +
    '                                                          ' + #10#13 +
    'type                                                      ' + #10#13 +
    '  T%FormIdent = class(T%AncestorIdent,IObserver)          ' + #10#13 +
    '  private                                                 ' + #10#13 +
    '    { Private declarations }                              ' + #10#13 +
    '    procedure UpdateController(o: TObject);//from IObserver     ' + #10#13 +
    '  public                                                  ' + #10#13 +
    '    { Public declarations }                               ' + #10#13 +
    '  end;                                                    ' + #10#13 +
    '                                                          ' + #10#13 +
    'var                                                       ' + #10#13 +
    '  %FormIdent: T%FormIdent;                                ' + #10#13 +
    '                                                          ' + #10#13 +
    'implementation                                            ' + #10#13 +
    '                                                          ' + #10#13 +
    '{$R *.dfm}                                                ' + #10#13 +
    '                                                          ' + #10#13 +
    'procedure T%FormIdent.UpdateController(o: TObject);             ' + #10#13 +
    'begin                                                     ' + #10#13 +
    '  {write your code here}                                  ' + #10#13 +
    'end;                                                      ' + #10#13 +
    'end.                                                      ' + #10#13;


type
  TControllerCreatorFile = class(TInterfacedObject, IOTAFile)
  private
    FAge: TDateTime;
    FModuleIdent,
      FFormIdent,
      FAncestorIdent: string;
  public
    constructor Create(const ModuleIdent, FormIdent, AncestorIdent: string);
    function GetSource: string;
    function GetAge: TDateTime;
  end;

implementation

{ TControllerCreatorFile }

constructor TControllerCreatorFile.Create(const ModuleIdent, FormIdent, AncestorIdent: string);
begin
  FAge := -1; // Flag age as New File
  FModuleIdent := ModuleIdent;
  FFormIdent := FormIdent;
  FAncestorIdent := AncestorIdent;
end;

function TControllerCreatorFile.GetAge: TDateTime;
begin
  Result := FAge;
end;

function TControllerCreatorFile.GetSource: string;
begin
  Result := ControllerCode;
  // Parameterize the code with the current Identifiers
  if FModuleIdent <> '' then
    Result := StringReplace(Result, '%ModuleIdent', FModuleIdent, [rfReplaceAll, rfIgnoreCase]);
  if FFormIdent <> '' then
    Result := StringReplace(Result, '%FormIdent', FFormIdent, [rfReplaceAll, rfIgnoreCase]);
  if FAncestorIdent <> '' then
    Result := StringReplace(Result, '%AncestorIdent', FAncestorIdent, [rfReplaceAll, rfIgnoreCase]);

end;

end.

⌨️ 快捷键说明

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