79 lines
1.9 KiB
ObjectPascal
79 lines
1.9 KiB
ObjectPascal
|
|
unit uConfigurarConexion;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, StdCtrls, uROClient, uROWinInetHttpChannel, uRODynamicRequest,
|
|||
|
|
uROServiceComponent, uRORemoteService, uROBinMessage;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfConfigurarConexion = class(TForm)
|
|||
|
|
bProbar: TButton;
|
|||
|
|
GroupBox1: TGroupBox;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
edtServer: TEdit;
|
|||
|
|
edtPort: TEdit;
|
|||
|
|
bAceptar: TButton;
|
|||
|
|
bCancelar: TButton;
|
|||
|
|
HTTPChannel: TROWinInetHTTPChannel;
|
|||
|
|
ROBinMessage: TROBinMessage;
|
|||
|
|
CoService: TRORemoteService;
|
|||
|
|
procedure bProbarClick(Sender: TObject);
|
|||
|
|
procedure FormCreate(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
function GetTargetURL: String;
|
|||
|
|
procedure SetTargetURL(const Value: String);
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
property TargetURL : String read GetTargetURL write SetTargetURL;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
fConfigurarConexion: TfConfigurarConexion;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
StrUtils, JclStrings, FactuGES_Intf, uDataModuleBase;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
{ TfConfigurarConexion }
|
|||
|
|
|
|||
|
|
function TfConfigurarConexion.GetTargetURL: String;
|
|||
|
|
begin
|
|||
|
|
Result := 'http://' + edtServer.Text + ':' + edtPort.Text + '/bin';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfConfigurarConexion.SetTargetURL(const Value: String);
|
|||
|
|
var
|
|||
|
|
s : String;
|
|||
|
|
begin
|
|||
|
|
s := StrAfter('http://', Value);
|
|||
|
|
s := StrBefore(':', s);
|
|||
|
|
edtServer.Text := s;
|
|||
|
|
|
|||
|
|
s := StrAfter(edtServer.Text + ':', Value);
|
|||
|
|
s := StrBefore('/bin', s);
|
|||
|
|
edtPort.Text := s;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfConfigurarConexion.bProbarClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
HTTPChannel.TargetURL := TargetURL;
|
|||
|
|
(CoService as IsrvLogin).Ping;
|
|||
|
|
Application.MessageBox('Conexi<78>n v<>lida con el servidor.', 'FactuGES', MB_OK);
|
|||
|
|
finally
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfConfigurarConexion.FormCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
HTTPChannel.OnFailure := dmBase.ROChannelFailure;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|