Home TAdvCircularProgress is blocked
Reply: 0

TAdvCircularProgress is blocked

Nevermore
1#
Nevermore Published in 2018-01-10 12:42:52Z

I am using TAdvCircularProgress to show process is continuing. But when the start download file from server using SaveToFile, TAdvCircularProgress freeze until download finish.

Note: my advcircularprogress object name is pnlSpinnerSWM

I tried to add Application.ProcessMessage but it isnt work, may be i added wrong line, idk.

Here is my process :

procedure TFormMain.popupRightClickStartAnalysisSWMClick(
  Sender: TObject);
var
  sharingId       : String;
  currentStatusId : String;
  currentCase     : TAkasShareShares;
  i               : Integer;
begin
  if gridSWM.Cells[7, gridSWM.Row] <> '1' then
    Exit;

  pnlSpinnerSWM.Visible:= true;
  spinnerSWM.Enabled:= true;
  spinnerSWM.Visible:= true;
  Application.ProcessMessages;

  sharingId:= gridSWM.Cells[6, gridSWM.Row];
  currentStatusId:= gridSWM.Cells[7, gridSWM.Row];
  currentCase:= obAkasShareApiAdapter.GetCase(sharingId);

  if obAkasShareApiAdapter.DownloadToAnalyze(currentCase) then
  begin
    TZipFile.ExtractZipFile(obPath.CaseTmpPath + '\' + currentCase.patientCase + '.zip', obPath.CaseTmpPath + '\' + currentCase.patientCase);
    DeleteFile(obPath.CaseTmpPath + '\' + currentCase.patientCase + '.zip');
  end;

  obContextIO.CList.LoadFromFile(obPath.CaseTmpPath + '\' + currentCase.patientCase + '\Info_' + currentCase.patientCase + '.cxt');  // cxt iceriginden case olu┼čturma
  if not DataModule4.CaseExist(obContextIO.ValStr['I_fCaseID']) then
  begin
    MoveDir(obPath.CaseTmpPath + '\' + currentCase.patientCase, obPath.ServerData);
    DataModule4.AddCase(obContextIO.CList);
    ExtractFilesFromDir(ListBox1.Items, obPath.ServerData + currentCase.patientCase, '.adf');
    for i:= 0 to ListBox1.Items.Count-1 do // case altindaki cell ler
    begin
      Application.ProcessMessages;

      if not FileExists(ListBox1.Items[i]) then
        Continue;

      obContextIO.LoadFromFile(ListBox1.Items[i]);
      DataModule4.ImportCell(obContextIO, ChangeFileExt(ListBox1.Items[i], ''));
    end;

    ShowMessage(SAnalizIcinAkasaGonderildi);
    obAkasShareApiAdapter.StatusNext(sharingId, currentStatusId);
    CaseListShared;
  end
  else
    ShowMessage(SCaseIdSistemdeVar);

  pnlSpinnerSWM.Visible:= false;
  spinnerSWM.Enabled:= false;
  spinnerSWM.Visible:= false;
  Application.ProcessMessages;
end;

Circular progress is freezing at this line :

if obAkasShareApiAdapter.DownloadToAnalyze(currentCase) then

and here is the downloadToAnalyze method :

function TAkasShareApiAdapter.DownloadToAnalyze(Share: TAkasShareShares): Boolean;
var
  Stream: TMemoryStream;
begin
  Result:= false;
  Stream := TMemoryStream.Create;
  try
    IdHTTP1.Get(Share.rawFile, Stream);
    Stream.SaveToFile(obPath.CaseTmpPath + '\' + Share.patientCase + '.zip');
  finally
    Result:= true;
    Stream.Free;
  end;
end;
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.399167 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO