Ich habe hier noch eine ausführliche Beschreibung der Vorgangsweise meines Programs:
Also zuerst wird ein Splash-Screen angezeit.
Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18:
| begin StartScreen := TStartScreen.Create(Application); try StartScreen.Show; //1.Fenster: Splash Application.Initialize; StartScreen.Update; Sleep(2000); Application.CreateForm(TMainWindow, MainWindow); //2.Fenster: Hauptfenster Application.CreateForm(TConnectionModule, ConnectionModule); //3.Fenster: Download Application.CreateForm(TForm1, Form1); //restliche Fenster werden erstellt Application.CreateForm(TForm2, Form2); Application.CreateForm(TForm3, Form3); StartScreen.Hide; finally StartScreen.Free; end; Application.Run; end. |
Danach erscheint das Hauptfenster der Anwendung, in dem das Fenster mit dem Downloadvorgang in OnShow hervorgerufen wird.
Quelltext
1: 2: 3: 4:
| procedure TForm1.Page_ConnectShow(Sender: TObject); begin ConnectionModule.ShowModal; end; |
Das Download-Fenster erscheint allerdings erst nach dem Beenden aller Downloads. Genau das ist das Problem, es soll ja davor angezeigt werden.
Der folgende Code wird im OnShow des Download-Fensters ausgeführt:
Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29:
| procedure TConnectionModule.Connect; var i:Integer; DlList: array[0..4] of String; responseStream:TFileStream; begin try //4 Dateien sollen heruntergeladen werden Dllist[0]:='routes'; Dllist[1]:='trains'; Dllist[2]:='utilies'; Dllist[3]:='others'; Dllist[4]:='users';
//Anzeige des Downloadvorganges ConnectionStatus.Caption:='Aktualisiere lokale Datenbanken...'; ConnectionBar.Max:=4; ConnectionBar.Position:=0;
for i:=0 to 4 do begin ConnectionBar.Position:=i; //Download der Datei mit IdHttp responsestream:=TFileStream.Create(Form1.ActDir+'database\'+DlList[i]+'.bed', fmCreate); IdHttp1.Get('http://bveexchange.bve-tools.com/program/database/'+DlList[i]+'.bed',responseStream); responsestream.Free; end; except raise; end; end; |