Ahora el cliente guarda la url del servidor en un fichero INI en vez de usar el registros de Windows.

git-svn-id: https://192.168.0.254/svn/Proyectos.LuisLeon_FactuGES/trunk@99 c93665c3-c93d-084d-9b98-7d5f4a9c3376
This commit is contained in:
David Arranz 2007-07-18 09:56:36 +00:00
parent 4ecdab79ea
commit 27ff4c32d3
5 changed files with 41 additions and 22 deletions

View File

@ -41,6 +41,7 @@ object fConfigurarConexion: TfConfigurarConexion
Top = 28
Width = 97
Height = 13
Margins.Bottom = 0
Caption = 'Nombre del servidor:'
end
object Label2: TLabel
@ -48,6 +49,7 @@ object fConfigurarConexion: TfConfigurarConexion
Top = 60
Width = 93
Height = 13
Margins.Bottom = 0
Caption = 'Puerto de escucha:'
end
object edtServer: TEdit

View File

@ -508,14 +508,6 @@ object dmBase: TdmBase
Left = 104
Top = 16
end
object JvAppRegistryStorage: TJvAppRegistryStorage
StorageOptions.BooleanStringTrueValues = 'TRUE, YES, Y'
StorageOptions.BooleanStringFalseValues = 'FALSE, NO, N'
Root = 'Software\%APPL_NAME%'
SubStorages = <>
Left = 224
Top = 80
end
object cxIntlPrintSys31: TcxIntlPrintSys3
Connected = True
Version = '3.0'

View File

@ -14,7 +14,6 @@ type
StyleManager: TJvNavPaneStyleManager;
TBXSwitcher: TTBXSwitcher;
cxIntl: TcxIntl;
JvAppRegistryStorage: TJvAppRegistryStorage;
cxIntlPrintSys31: TcxIntlPrintSys3;
procedure DAClientDataModuleCreate(Sender: TObject);
procedure DataModuleDestroy(Sender: TObject);
@ -83,7 +82,7 @@ end;
procedure TdmBase.LeerConfiguracion;
begin
dmConexion.TargetURL := JvAppRegistryStorage.ReadString('ServerURL', SERVER_URL);
dmConfiguracion.LeerConfiguracion;
end;
procedure TdmBase.OnTBXThemeChange(Sender: TObject);
@ -96,12 +95,7 @@ end;
procedure TdmBase.SalvarConfiguracion;
begin
JvAppRegistryStorage.BeginUpdate;
try
JvAppRegistryStorage.WriteString('ServerURL', dmConexion.TargetURL);
finally
JvAppRegistryStorage.EndUpdate;
end;
dmConfiguracion.SalvarConfiguracion;
end;
function TdmBase.DarVersion: String;

View File

@ -7,7 +7,7 @@ uses
uDABINAdapter, uROClient, uROBinMessage, uROWinInetHttpChannel;
const
SERVER_URL = 'http://localhost:8099/bin';
SERVER_URL = 'http://localhost:8099/bin'; // Dirección por defecto del servidor
type
TdmConexion = class(TDataModule)

View File

@ -4,7 +4,7 @@ interface
uses
SysUtils, Classes, uROServiceComponent, uRORemoteService, uDADataTable,
uDABINAdapter, uROClient, uROBinMessage, uROWinInetHttpChannel;
uDABINAdapter, uROClient, uROBinMessage, uROWinInetHttpChannel, IniFiles;
const
SERVER_URL = 'http://localhost:8099/bin';
@ -15,8 +15,14 @@ type
ROMessage: TROBinMessage;
DABINAdapter: TDABINAdapter;
RORemoteService: TRORemoteService;
private
FIniFile : TIniFile;
public
function darValor(const CODIGO: String): Variant;
function DarValor(const CODIGO: String): Variant;
procedure LeerConfiguracion;
procedure SalvarConfiguracion;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
end;
var
@ -26,14 +32,39 @@ implementation
{$R *.dfm}
uses FactuGES_Intf, Variants;
uses
Forms, FactuGES_Intf, Variants, uDataModuleConexion;
{ TdmConfiguracion }
function TdmConfiguracion.darValor(const CODIGO: String): Variant;
constructor TdmConfiguracion.Create(AOwner: TComponent);
begin
Result := (RORemoteService as IsrvConfiguracion).darValor(CODIGO);
inherited;
FIniFile := TIniFile.Create(ChangeFileExt(Application.ExeName, '.ini' ) );
end;
function TdmConfiguracion.DarValor(const CODIGO: String): Variant;
begin
Result := (RORemoteService as IsrvConfiguracion).DarValor(CODIGO);
end;
destructor TdmConfiguracion.Destroy;
begin
FreeAndNIL(FIniFile);
inherited;
end;
procedure TdmConfiguracion.LeerConfiguracion;
begin
with FIniFile do
dmConexion.TargetURL := ReadString('Server', 'URL', SERVER_URL);
end;
procedure TdmConfiguracion.SalvarConfiguracion;
begin
with FIniFile do
WriteString('Server', 'URL', dmConexion.TargetURL);
end;
end.