Jump to content

Message to the session - HELP


herculanojs

Recommended Posts

Hello friends,
I'm trying to notify the session on its closure.
But the message is not displayed
This function is for this reason, or is there some other way to communicate the session that it will be closed.
 
 
 unisession.ShowAlert('A sessão será finalizada dentro de cinco minutos para atualização do sistema');
 unisession.TerminateAfterSecs(60);
 
 
          try
             AServerUpdating := true;
             S := UniServerModule.SessionManager.Sessions;
             S.Lock;
             for I := 0 to S.SessionList.Count - 1  do
             begin
                  USession := S.SessionList;
                  USession.ShowAlert('Sua sessão será finalizada em 5 (cinco) minutos para atualização do sistema.');
                  USession.TerminateAfterSecs(60);
             end;
          finally
              S.Unlock;
          end;

 

Link to comment
Share on other sites

Hi,

 

I think for your issue, you can use uniTimer with an interval a few minutes..

 

1. UniServerModule:  

  public
    { Public declarations }
    globalTerminate: Boolean;
  end;

2.

procedure TMainForm.UniTimer1Timer(Sender: TObject);
begin
  // UniTimer->Interval = 60000
  if UniServerModule.globalTerminate then
  begin
    (Sender as TUniTimer).Enabled := False;
    ShowMessage('Sua sessão será finalizada em 5 (cinco) minutos para atualização do sistema.');
  end;
end;

3.

try
  UniServerModule.globalTerminate := true; //<---
  AServerUpdating := true;
  S := UniServerModule.SessionManager.Sessions;
  S.Lock;
  for I := 0 to S.SessionList.Count - 1  do
  begin
    USession := S.SessionList[I];
    //USession.ShowAlert('Sua sessão será finalizada em 5 (cinco) minutos para atualização do sistema.');
    USession.TerminateAfterSecs(120);
  end;
finally
  S.Unlock;
end;

Best regards.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...