SHARE
TWEET

Untitled

a guest Mar 20th, 2016 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Minha classe de callback
  2. TTesteCallback = class(TDBXCallback)
  3. public
  4.   function Execute(const Arg: TJSONValue): TJSONValue; override;
  5. end;
  6.  
  7. function TTesteCallback.Execute(const Arg: TJSONValue): TJSONValue;
  8. begin
  9.   // não faço nada, apenas para teste
  10.   Result := TJSONTrue.Create;
  11. end;
  12.  
  13. // código do botão de teste
  14. var
  15.   xCallBack,
  16.   xSession : string;
  17. begin
  18.  
  19.   if SQLConnection1.Connected then SQLConnection1.Close;
  20.   SQLConnection1.Open;
  21.  
  22.   FCallbackManager := TDSClientCallbackChannelManager.Create(Self);
  23.   FCallbackManager.DSHostname := 'localhost';
  24.   FCallbackManager.DSPort := '211';
  25.   FCallbackManager.UserName := '';
  26.   FCallbackManager.Password := '';
  27.   FCallbackManager.CommunicationProtocol := 'tcp/ip';
  28.  
  29.   xCallBack := TDSSessionHelper.GenerateSessionId;;
  30.   xSession := TDSSessionHelper.GenerateSessionId;
  31.  
  32.   FCallBackClient := TTesteCallback.Create;
  33.  
  34.   {Guardando a Identificação do CallBack}
  35.   FCallbackManager.CloseClientChannel;
  36.   FCallbackManager.ManagerId := xSession;
  37.   FCallbackManager.RegisterCallback(xCallBack,FCallBackClient);
  38.  
  39.   // FCallbackManager.UnregisterCallback(xCallBack);
  40.   FCallbackManager.CloseClientChannel;
  41.  
  42.   // ao tentar executar a linha abaixo, da accessviolation
  43.   FreeAndNil(FCallBackClient);
  44.   FreeAndNil(FCallbackManager);
  45.  
  46.   Close;
  47.  
  48. end;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top