2
0
Эх сурвалжийг харах

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 сар өмнө
parent
commit
b6c8727099

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

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