delphimvcframework/ideexpert/DMVC.Expert.Forms.NewProjectWizard.pas
danieleteti 68743b90f0 Added the following parameters and features to the IDEExpert:
ActionFiltersMethods
ConfigurationBlock
ServerPort
Minor Fixes
2016-02-24 22:37:13 +01:00

139 lines
3.6 KiB
ObjectPascal

unit DMVC.Expert.Forms.NewProjectWizard;
interface
uses
WinAPI.Windows,
WinAPI.Messages,
System.SysUtils,
System.Variants,
System.Classes,
VCL.Graphics,
VCL.Controls,
VCL.Forms,
VCL.Dialogs,
VCL.StdCtrls;
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;
chkCreateActionFiltersMethods: TCheckBox;
edtServerPort: TEdit;
Label2: TLabel;
procedure chkCreateControllerUnitClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
function GetAddToProjectGroup: boolean;
function GetCreateIndexMethod: boolean;
function GetCreateControllerUnit: boolean;
function GetControllerClassName: string;
function GetWebModuleClassName: string;
function GetCreateActionFiltersMethods: boolean;
function GetServerPort: Integer;
public
{ Public declarations }
// Read Only Properties to extract values without having to know control values.
property ControllerClassName: string read GetControllerClassName;
property CreateControllerUnit: boolean read GetCreateControllerUnit;
property AddToProjectGroup: boolean read GetAddToProjectGroup;
property CreateIndexMethod: boolean read GetCreateIndexMethod;
property CreateActionFiltersMethods: boolean
read GetCreateActionFiltersMethods;
property WebModuleClassName: string read GetWebModuleClassName;
property ServerPort: Integer read GetServerPort;
end;
var
frmDMVCNewProject: TfrmDMVCNewProject;
implementation
uses
DMVC.Expert.CodeGen.Templates;
{$R *.dfm}
procedure TfrmDMVCNewProject.chkCreateControllerUnitClick(Sender: TObject);
begin
gbControllerUnitOptions.Enabled := chkCreateIndexMethod.Checked;
chkCreateIndexMethod.Enabled := chkCreateControllerUnit.Checked;
edtClassName.Enabled := chkCreateControllerUnit.Checked;
end;
procedure TfrmDMVCNewProject.FormCreate(Sender: TObject);
begin
edtClassName.TextHint := sDefaultControllerName;
edtWebModuleName.TextHint := sDefaultWebModuleName;
edtServerPort.TextHint := sDefaultServerPort;
end;
function TfrmDMVCNewProject.GetAddToProjectGroup: boolean;
begin
Result := chkAddToProjectGroup.Checked;
end;
function TfrmDMVCNewProject.GetCreateIndexMethod: boolean;
begin
Result := chkCreateIndexMethod.Checked;
end;
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;
function TfrmDMVCNewProject.GetWebModuleClassName: string;
begin
if Trim(edtWebModuleName.Text) = '' then
begin
Result := sDefaultWebModuleName
end
else
begin
Result := Trim(edtWebModuleName.Text);
end;
end;
function TfrmDMVCNewProject.GetCreateActionFiltersMethods: boolean;
begin
Result := chkCreateActionFiltersMethods.Checked;
end;
function TfrmDMVCNewProject.GetCreateControllerUnit: boolean;
begin
Result := chkCreateControllerUnit.Checked;
end;
function TfrmDMVCNewProject.GetControllerClassName: string;
begin
if Trim(edtClassName.Text) = '' then
begin
Result := sDefaultControllerName
end
else
begin
Result := Trim(edtClassName.Text);
end;
end;
end.