Browse Source

Improve integration of DownloadArchivesToExtract: no flicker anymore + proper silent mode support.

BTW, I noticed this can call [Code]'s CurPageChanged multiple times for wpPreparing but this was already the case: once from PrepareToInstall if there's a [Code] event and then again from NextButtonClick.
Martijn Laan 2 months ago
parent
commit
b6c8727099
1 changed files with 18 additions and 8 deletions
  1. 18 8
      Projects/Src/Setup.WizardForm.pas

+ 18 - 8
Projects/Src/Setup.WizardForm.pas

@@ -1931,6 +1931,17 @@ function TWizardForm.PrepareToInstall(const WizardComponents, WizardTasks: TStri
     end;
   end;
 
+  procedure ShowPreparing;
+  begin
+    SetCurPage(wpPreparing);
+    BackButton.Visible := False;
+    NextButton.Visible := False;
+    CancelButton.Enabled := False;
+    if InstallMode = imSilent then
+      WizardForm.Visible := True;
+    WizardForm.Update;
+  end;
+
 var
   CodeNeedsRestart: Boolean;
   Y: Integer;
@@ -1944,7 +1955,12 @@ begin
   PreparingMemo.Visible := False;
 
   try
-    DownloadArchivesToExtract(WizardComponents, WizardTasks);
+    ShowPreparing;
+    try
+      DownloadArchivesToExtract(WizardComponents, WizardTasks);
+    finally
+      UpdateCurPageButtonState;
+    end;
   except
     Result := GetExceptMessage;
   end;
@@ -1954,13 +1970,7 @@ begin
       Result := ExpandSetupMessage(msgPreviousInstallNotCompleted);
       PrepareToInstallNeedsRestart := True;
     end else if (CodeRunner <> nil) and CodeRunner.FunctionExists('PrepareToInstall', True) then begin
-      SetCurPage(wpPreparing);
-      BackButton.Visible := False;
-      NextButton.Visible := False;
-      CancelButton.Enabled := False;
-      if InstallMode = imSilent then
-        WizardForm.Visible := True;
-      WizardForm.Update;
+      ShowPreparing;
       try
         DownloadTemporaryFileOrExtractArchiveProcessMessages := True;
         CodeNeedsRestart := False;