TsgcWSPClient_Files › Events › OnFileReceivedFragment
Fires every time a new fragment of an incoming file has been written to disk; ideal for progress indicators.
property OnFileReceivedFragment: TsgcWSFileFragmentEvent;
// TsgcWSFileFragmentEvent = procedure(Connection: TsgcWSConnection; const aMessage: TsgcWSMessageFile; var Cancel: Boolean) of object
—
aMessage.FilePosition reports how many bytes have been stored so far and aMessage.FileSize the total expected size. Set Cancel to True to abort the download; the local stream is deleted and the sender is notified with an error.
procedure TForm1.oProtocolFileReceivedFragment(Connection: TsgcWSConnection;
const aMessage: TsgcWSMessageFile; var Cancel: Boolean);
begin
ProgressBar1.Position := Round(aMessage.FilePosition / aMessage.FileSize * 100);
end;