2016-02-23 01:41:13 +01:00
|
|
|
unit DMVC.Expert.Forms.NewProjectWizard;
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
|
|
|
WinAPI.Windows,
|
|
|
|
WinAPI.Messages,
|
2016-11-24 20:07:45 +01:00
|
|
|
WinAPI.ShellAPI,
|
2016-02-23 01:41:13 +01:00
|
|
|
System.SysUtils,
|
|
|
|
System.Variants,
|
|
|
|
System.Classes,
|
|
|
|
VCL.Graphics,
|
|
|
|
VCL.Controls,
|
|
|
|
VCL.Forms,
|
|
|
|
VCL.Dialogs,
|
2016-11-24 20:07:45 +01:00
|
|
|
VCL.StdCtrls,
|
|
|
|
VCL.Imaging.pngimage, VCL.ExtCtrls;
|
2016-02-23 01:41:13 +01:00
|
|
|
|
|
|
|
type
|
|
|
|
TfrmDMVCNewProject = class(TForm)
|
|
|
|
gbControllerUnitOptions: TGroupBox;
|
|
|
|
btnOK: TButton;
|
|
|
|
btnCancel: TButton;
|
|
|
|
chkCreateIndexMethod: TCheckBox;
|
|
|
|
chkCreateControllerUnit: TCheckBox;
|
|
|
|
chkAddToProjectGroup: TCheckBox;
|
|
|
|
edtClassName: TEdit;
|
|
|
|
lblClassName: TLabel;
|
|
|
|
edtWebModuleName: TEdit;
|
|
|
|
Label1: TLabel;
|
|
|
|
lblWbModule: TLabel;
|
2016-02-24 22:37:13 +01:00
|
|
|
chkCreateActionFiltersMethods: TCheckBox;
|
|
|
|
edtServerPort: TEdit;
|
|
|
|
Label2: TLabel;
|
2016-11-24 20:07:45 +01:00
|
|
|
Image1: TImage;
|
2017-05-09 10:49:28 +02:00
|
|
|
lblFrameworkVersion: TLabel;
|
2017-05-17 22:32:45 +02:00
|
|
|
chkCreateCRUDMethods: TCheckBox;
|
2016-02-23 01:41:13 +01:00
|
|
|
procedure chkCreateControllerUnitClick(Sender: TObject);
|
|
|
|
procedure FormCreate(Sender: TObject);
|
2016-11-24 20:07:45 +01:00
|
|
|
procedure Image1Click(Sender: TObject);
|
2016-02-23 01:41:13 +01:00
|
|
|
private
|
|
|
|
{ Private declarations }
|
|
|
|
function GetAddToProjectGroup: boolean;
|
|
|
|
function GetCreateIndexMethod: boolean;
|
|
|
|
function GetCreateControllerUnit: boolean;
|
|
|
|
function GetControllerClassName: string;
|
|
|
|
function GetWebModuleClassName: string;
|
2016-02-24 22:37:13 +01:00
|
|
|
function GetCreateActionFiltersMethods: boolean;
|
|
|
|
function GetServerPort: Integer;
|
2017-05-17 22:32:45 +02:00
|
|
|
function GetCreateCRUDMethods: boolean;
|
2016-02-23 01:41:13 +01:00
|
|
|
public
|
|
|
|
{ Public declarations }
|
|
|
|
// Read Only Properties to extract values without having to know control values.
|
|
|
|
property ControllerClassName: string read GetControllerClassName;
|
2016-02-24 22:37:13 +01:00
|
|
|
property CreateControllerUnit: boolean read GetCreateControllerUnit;
|
|
|
|
property AddToProjectGroup: boolean read GetAddToProjectGroup;
|
|
|
|
property CreateIndexMethod: boolean read GetCreateIndexMethod;
|
2017-05-17 22:32:45 +02:00
|
|
|
property CreateCRUDMethods: boolean read GetCreateCRUDMethods;
|
2016-02-24 22:37:13 +01:00
|
|
|
property CreateActionFiltersMethods: boolean
|
|
|
|
read GetCreateActionFiltersMethods;
|
2016-02-23 01:41:13 +01:00
|
|
|
property WebModuleClassName: string read GetWebModuleClassName;
|
2016-02-24 22:37:13 +01:00
|
|
|
property ServerPort: Integer read GetServerPort;
|
2016-02-23 01:41:13 +01:00
|
|
|
end;
|
|
|
|
|
|
|
|
var
|
|
|
|
frmDMVCNewProject: TfrmDMVCNewProject;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
uses
|
2017-05-09 10:49:28 +02:00
|
|
|
DMVC.Expert.CodeGen.Templates,
|
|
|
|
MVCFramework.Commons;
|
2016-02-23 01:41:13 +01:00
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
procedure TfrmDMVCNewProject.chkCreateControllerUnitClick(Sender: TObject);
|
|
|
|
begin
|
|
|
|
gbControllerUnitOptions.Enabled := chkCreateIndexMethod.Checked;
|
|
|
|
chkCreateIndexMethod.Enabled := chkCreateControllerUnit.Checked;
|
2016-10-10 16:09:43 +02:00
|
|
|
chkCreateActionFiltersMethods.Enabled := chkCreateControllerUnit.Checked;
|
2016-02-23 01:41:13 +01:00
|
|
|
edtClassName.Enabled := chkCreateControllerUnit.Checked;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TfrmDMVCNewProject.FormCreate(Sender: TObject);
|
|
|
|
begin
|
|
|
|
edtClassName.TextHint := sDefaultControllerName;
|
|
|
|
edtWebModuleName.TextHint := sDefaultWebModuleName;
|
2016-02-24 22:37:13 +01:00
|
|
|
edtServerPort.TextHint := sDefaultServerPort;
|
2017-05-09 10:49:28 +02:00
|
|
|
lblFrameworkVersion.Caption := DMVCFRAMEWORK_VERSION;
|
2016-02-23 01:41:13 +01:00
|
|
|
end;
|
|
|
|
|
|
|
|
function TfrmDMVCNewProject.GetAddToProjectGroup: boolean;
|
|
|
|
begin
|
|
|
|
Result := chkAddToProjectGroup.Checked;
|
|
|
|
end;
|
|
|
|
|
|
|
|
function TfrmDMVCNewProject.GetCreateIndexMethod: boolean;
|
|
|
|
begin
|
|
|
|
Result := chkCreateIndexMethod.Checked;
|
|
|
|
end;
|
|
|
|
|
2016-02-24 22:37:13 +01:00
|
|
|
function TfrmDMVCNewProject.GetServerPort: Integer;
|
|
|
|
var
|
|
|
|
lServerPort: Integer;
|
|
|
|
begin
|
|
|
|
Result := StrToInt(sDefaultServerPort);
|
|
|
|
if (Trim(edtServerPort.Text) <> '') and TryStrToInt(edtServerPort.Text,
|
|
|
|
lServerPort) then
|
|
|
|
begin
|
|
|
|
if (lServerPort > 0) and (lServerPort < 65535) then
|
|
|
|
Result := lServerPort;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
2016-02-23 01:41:13 +01:00
|
|
|
function TfrmDMVCNewProject.GetWebModuleClassName: string;
|
|
|
|
begin
|
|
|
|
if Trim(edtWebModuleName.Text) = '' then
|
|
|
|
begin
|
|
|
|
Result := sDefaultWebModuleName
|
2016-02-24 22:37:13 +01:00
|
|
|
end
|
|
|
|
else
|
2016-02-23 01:41:13 +01:00
|
|
|
begin
|
|
|
|
Result := Trim(edtWebModuleName.Text);
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
2016-11-24 20:07:45 +01:00
|
|
|
procedure TfrmDMVCNewProject.Image1Click(Sender: TObject);
|
|
|
|
begin
|
|
|
|
ShellExecute(0, PChar('open'),
|
|
|
|
PChar('https://www.gitbook.com/book/danieleteti/delphimvcframework/details'),
|
|
|
|
nil, nil, SW_SHOW);
|
|
|
|
end;
|
|
|
|
|
2016-02-24 22:37:13 +01:00
|
|
|
function TfrmDMVCNewProject.GetCreateActionFiltersMethods: boolean;
|
|
|
|
begin
|
|
|
|
Result := chkCreateActionFiltersMethods.Checked;
|
|
|
|
end;
|
|
|
|
|
2016-02-23 01:41:13 +01:00
|
|
|
function TfrmDMVCNewProject.GetCreateControllerUnit: boolean;
|
|
|
|
begin
|
|
|
|
Result := chkCreateControllerUnit.Checked;
|
|
|
|
end;
|
|
|
|
|
2017-05-17 22:32:45 +02:00
|
|
|
function TfrmDMVCNewProject.GetCreateCRUDMethods: boolean;
|
|
|
|
begin
|
|
|
|
Result := chkCreateCRUDMethods.Checked;
|
|
|
|
end;
|
|
|
|
|
2016-02-23 01:41:13 +01:00
|
|
|
function TfrmDMVCNewProject.GetControllerClassName: string;
|
|
|
|
begin
|
|
|
|
if Trim(edtClassName.Text) = '' then
|
|
|
|
begin
|
|
|
|
Result := sDefaultControllerName
|
2016-02-24 22:37:13 +01:00
|
|
|
end
|
|
|
|
else
|
2016-02-23 01:41:13 +01:00
|
|
|
begin
|
|
|
|
Result := Trim(edtClassName.Text);
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
end.
|