📄 servercontroller.pas
字号:
unit ServerController;
interface
uses
SysUtils, Classes, IWServerControllerBase, IWBaseForm, UserSessionUnit, IWApplication,
IWAppForm;
type
TIWServerController = class(TIWServerControllerBase)
procedure IWServerControllerBaseNewSession(ASession: TIWApplication;
var VMainForm: TIWBaseForm);
procedure IWServerControllerBaseBackButton(ASubmittedSequence,
ACurrentSequence: Integer; AFormName: string; var VHandled,
VExecute: Boolean);
private
public
end;
function UserSession: TIWUserSession;
function IWServerController: TIWServerController;
procedure Move(AFormClass: TIWAppFormClass);
implementation
{$R *.dfm}
uses
IWInit, IWGlobal;
function UserSession: TIWUserSession;
begin
Result := TIWUserSession(WebApplication.Data);
end;
function IWServerController: TIWServerController;
begin
Result := TIWServerController(GServerController);
end;
procedure TIWServerController.IWServerControllerBaseNewSession(
ASession: TIWApplication; var VMainForm: TIWBaseForm);
begin
ASession.Data := TIWUserSession.Create(nil);
end;
procedure TIWServerController.IWServerControllerBaseBackButton(
ASubmittedSequence, ACurrentSequence: Integer; AFormName: string;
var VHandled, VExecute: Boolean);
const
DefaultFormName = 'formMain';
type
TIWFormClass = class of TIWAppForm;
var
LForm: TIWAppForm;
begin
VHandled := True;
VExecute := True;
if AFormName = '' then
AFormName := DefaultFormName;
if WebApplication.FindComponent(AFormName) <> nil then
begin
WebApplication.SetActiveForm(WebApplication.FindComponent(AFormName) as TIWAppForm);
end else
begin
try
LForm := TIWFormClass(FindClass('T' + AFormName)).Create(WebApplication);
WebApplication.SetActiveForm(LForm);
except
VHandled := False;
end;
end;
end;
procedure Move(AFormClass: TIWAppFormClass);
begin
TIWAppForm(WebApplication.ActiveForm).Release;
AFormClass.Create(WebApplication).Show;
end;
initialization
TIWServerController.SetServerControllerClass;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -