- Recompilación en Delphi10 de todos los paquetes de RO para generar las DCU's en Lib\D10 - Recompilación en Delphi10 de todos los paquetes de DA para generar las DCU's en Lib\D10 git-svn-id: https://192.168.0.254/svn/Componentes.Terceros.RemObjects@9 b6239004-a887-0f4b-9937-50029ccdca16
108 lines
2.8 KiB
ObjectPascal
108 lines
2.8 KiB
ObjectPascal
unit DynamicRequestClientMain;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, uRODynamicRequest,
|
|
uROWinInetHttpChannel, uROClient, uROBINMessage, StdCtrls,
|
|
uROPoweredByRemObjectsButton, uRORemoteService;
|
|
|
|
type
|
|
TDynamicRequestClientMainForm = class(TForm)
|
|
DynamicRequestSum: TRODynamicRequest;
|
|
bSum: TButton;
|
|
bGetServerTime: TButton;
|
|
EmptyDynamicRequest: TRODynamicRequest;
|
|
bEchoPerson: TButton;
|
|
DynamicRequestEchoPerson: TRODynamicRequest;
|
|
ROWinInetHTTPChannel1: TROWinInetHTTPChannel;
|
|
ROBinMessage1: TROBinMessage;
|
|
ROPoweredByRemObjectsButton1: TROPoweredByRemObjectsButton;
|
|
RemoteService: TRORemoteService;
|
|
Memo: TMemo;
|
|
procedure bSumClick(Sender: TObject);
|
|
procedure bGetServerTimeClick(Sender: TObject);
|
|
procedure bEchoPersonClick(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
procedure Log(str: string);
|
|
public
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
DynamicRequestClientMainForm: TDynamicRequestClientMainForm;
|
|
|
|
implementation
|
|
|
|
uses DynamicRequestLibrary_Intf;
|
|
|
|
{$R *.dfm}
|
|
|
|
procedure TDynamicRequestClientMainForm.bSumClick(Sender: TObject);
|
|
begin
|
|
with DynamicRequestSum do begin
|
|
ParamByName('A').AsInteger := 1;
|
|
ParamByName('B').AsInteger := 2;
|
|
Log('Sum');
|
|
Log('--------');
|
|
Log('sending:' + #9 + ParamByName('A').AsString + ' ' + ParamByName('B').AsString);
|
|
Execute;
|
|
Log('received:' + #9 + ParamByName('result').AsString);
|
|
Log('');
|
|
end;
|
|
end;
|
|
|
|
procedure TDynamicRequestClientMainForm.bGetServerTimeClick(Sender: TObject);
|
|
begin
|
|
with EmptyDynamicRequest do begin
|
|
MethodName := 'GetServerTime';
|
|
Params.Refresh;
|
|
|
|
Execute;
|
|
Log('GetServerTime');
|
|
Log('------------------------');
|
|
Log('received:' + #9 + ParamByName('result').AsString);
|
|
Log('');
|
|
end;
|
|
end;
|
|
|
|
procedure TDynamicRequestClientMainForm.bEchoPersonClick(Sender: TObject);
|
|
var
|
|
aperson, anotherperson: TPerson;
|
|
begin
|
|
aperson := TPerson.Create;
|
|
with DynamicRequestEchoPerson do try
|
|
aperson.FirstName := 'John';
|
|
aperson.LastName := 'Smith';
|
|
|
|
Log('EchoPerson');
|
|
Log('-------------------');
|
|
|
|
with aperson do
|
|
Log('sending:' + #9 + Firstname + ' ' + LastName);
|
|
|
|
ParamByName('aPerson').AsComplexType := aperson;
|
|
Execute;
|
|
anotherperson := ParamByName('anotherPerson').AsComplexType as TPerson;
|
|
if Assigned(anotherperson) then try
|
|
Log('received:' + #9 + anotherperson.Firstname + ' ' + anotherperson.LastName);
|
|
finally
|
|
FreeAndNIL(anotherperson);
|
|
end;
|
|
ParamByName('anotherPerson').AsComplexType := nil;
|
|
Log('');
|
|
finally
|
|
FreeAndNIL(aperson);
|
|
end;
|
|
end;
|
|
|
|
procedure TDynamicRequestClientMainForm.Log(str: string);
|
|
begin
|
|
Memo.Lines.Add(str);
|
|
end;
|
|
|
|
end.
|
|
|