Conexión automática sin pantalla de login Sólo aparece si hay algún error de conexión.

git-svn-id: https://192.168.0.254/svn/Proyectos.FarmaciaPH_Etiquetas/trunk@10 7b0b1a58-4aa1-b946-8089-8453ede31e50
This commit is contained in:
roberto 2011-11-18 10:33:15 +00:00
parent 7fc42f2e85
commit f8d2253dfd
2 changed files with 23 additions and 10 deletions

View File

@ -154,7 +154,7 @@ implementation
uses
Windows, Dialogs, JSDialog, JSDialogs, uDialogUtils, cxControls, uUsuariosViewRegister,
uEmpresasViewRegister, uAppInfoUtils, uDMBase;
uEmpresasViewRegister, uAppInfoUtils, uDMBase, uDataModuleConexion, Controls;
procedure TAppFactuGES.CambiarEmpresa(const AIDEmpresa: Integer);
var
@ -338,8 +338,22 @@ begin
end;
procedure TAppFactuGES.Run;
var
ALogin : Boolean;
AResult : TModalResult;
begin
if UsuariosController.StartLogin then
while not dmConexion.HayConexion do
begin
AResult := dmConexion.ConfigurarConexion;
if AResult <> mrOK then
Exit;
end;
ALogin := UsuariosController.ComprobarUsuario('admin', '1');
if not ALogin then
ALogin := UsuariosController.StartLogin;
if ALogin then
begin
ShowHourglassCursor;
ShowSplashForm;

View File

@ -4,7 +4,7 @@ interface
uses
SysUtils, Classes, uRORemoteService, uDADataTable,
uDABINAdapter, uROClient, uROBinMessage,
uDABINAdapter, uROClient, uROBinMessage, Dialogs, Controls,
uDADataStreamer, uROWinInetHttpChannel;
const
@ -27,7 +27,7 @@ type
public
function HayConexion : Boolean;
function ProbarConexion(const ATargetURL : String): Boolean;
procedure ConfigurarConexion;
function ConfigurarConexion: TModalResult;
property TargetURL : String read GetTargetURL write SetTargetURL;
property Channel: TROTransportChannel read GetChannel;
property Message: TROBinMessage read GetMessage;
@ -41,7 +41,7 @@ implementation
{$R *.dfm}
uses
uROEncryption, Windows, WinInet, cxControls, uConfigurarConexion, Dialogs, Controls,
uROEncryption, Windows, WinInet, cxControls, uConfigurarConexion,
uDMBase, Etiquetas_Intf, uDialogUtils;
const
@ -59,20 +59,19 @@ begin
Result := ROChannel.Connected;
end;
procedure TdmConexion.ConfigurarConexion;
function TdmConexion.ConfigurarConexion: TModalResult;
begin
with TfConfigurarConexion.Create(NIL) do
try
TargetURL := ROChannel.TargetURL;
if ShowModal = mrOk then
Result := ShowModal;
if Result = mrOk then
begin
ROChannel.TargetURL := TargetURL;
ROChannel.Connected := False;
ROChannel.Connected := True;
dmBase.SalvarConfiguracion;
end;
finally
Free;
Release;
end;
end;