ActiveXPowUpload 1.2.0.5
Diagrams
  Home page
Contact support

Upload events diagram

This diagram shows events that are fired during upload process.

upload events diagram

Just after the upload action has started the OnUploadClicked, OnUploadBegin events are fired. Before that we perform only basic check that another upload or download is not running. Upload process consists in sequential processing all files in the upload list. Before uploading each file the OnUploadFileBegin event is fired, after uploading the file the OnUploadFileCompleted event is fired. While uploading a file multiple OnUploadProgress events may be fired. After all files have been upload and if no error had happened, the OnUploadFinishedBeforeReply event is fired. Then if the server replies that data were successfully received, we fire the OnUploadCompletedSuccessfully event, that means that upload succeeded. That is the end of the story.

Upload can fail because of a number of reasons. If upload has failed, the OnUploadCompletedError event is fired. We can distinguish two special kinds of fails: upload was cancelled by the user, the server reports it can't accept our request. If upload was cancelled, the OnUploadCancelled event is fired. If the server reject the request, the OnServerError event is fired, additional information can be found through GetServerStatusCode, GetServerStatusText and, maybe, GetServerReply methods. The last event fired after upload has failed is the OnError event. That event is a notification about an error, it is not specific to upload process. It is fired in many different cases when some action has failed, and it is always the last event of some action.

The order of events on upload fail is as follows: 1) a special error event, if any, OnServerError or OnUploadCancelled, 2) OnUploadCompletedError, indicating the upload has failed, 3) OnError, indicating the action has failed.

Concering the upload process in general, we must know that once the OnUploadBegin event has been fired, either OnUploadCompletedSuccessfully or OnUploadCompletedError will be fired later, indicating the upload will have finished.

How to read the diagram

A few notes on how to the read the diagram for those unfamiliar with UML.

This UML diagram discribles upload process as a sequence of actions generating ActiveXPowUpload events. The process starts in the black dot at the top of the diagram and ends in the solid circle with a ring around it at the bottom. A rectangle with rounded corners represents an actions that fires an event, for example, the OnUploadClicked rectangle that you can see just after the black dot in the picture fires the OnUploadClicked event. Arrows connect actions specifing the order they are executed, for example, OnUploadClicked, then OnUploadBegin, and so on. A diamond is the point where the order of execution branches. The diamon after OnUploadBegin is the first branch we meet on the path, depending on whether we have more file to upload or not we go either right (if yes) or down (if no). A rectangle with rounded corners and dashed border groups a number of actions together. It is titled "Upload in progress". If an error occures, the normal order of execution breaks and the control jumps to an action connected to the dashed rectangle: OnServerError, or OnUploadCancelled, or OnUploadCompletedError.

Upload states

This diagram shows states of the ActiveXPowUpload control related to upload process.

upload states diagram

There are four states of the ActiveXPowUpload control related to the upload process. They are:

Initial
Upload is not running. That is the initail state of the control.
Before upload
Upload process is running, but data are not yet being uploaded, preparing for upload.
Upload in progress
Upload process is running, data are being uploaded.
After upload
Upload process is running, data were uploaded or upload failed, performing cleanup.

The most important thing about upload states is what actions are allowed to do in that state. By action here we mean an act of reading/changing component property or invoking interface method.

In the Initial state all actions are allowed (to be precise, the upload process does not impose any restrictions on the actions you can do, but other processes can do, the download process, for example). You can read/write every property and invoke every method of the control.

In the Before upload state you can do almost everything like in the Initial state, but you are not allowed to start upload process and download.

In the Upload in process state you are not allowed to change properties related upload or download and invoke method that can change internal state of the upload or download. For example, you can't change the Server property because it is related to the upload subsystem, you can't call RemoveFile or AddFormItem method, for the same reason. You may read all properties, for example, the Server property, you may change other properties not related to the upload or download, for example, you can change the ShowUploadProgressWindow property that is related to GUI.

The After upload state imposes the same restriction as the Before upload state.

The next important thing about upload states is how to know what state the control is now in? That's easy. If upload is not running, the state is Initial. If upload is running, the state is predefined for the most events. For example, the OnUploadBegin event is fired in the Before upload state, the OnUploadFileBegin event is fired in the Upload in progress state. See notes on the right of an upload state on the diagram.

Download events diagram

This diagram shows events that are fired during download process.

download event diagram

The download process starts with the OnDownloadBegin event. The download process travels along the list of files trying to download each file in turn. If a file fails to download, we move to next one in the list, not interrupting the whole process. Files are downloaded in the order of their indexes starting from 0. Download terminates with the OnDownloadEnd event. Downloading each file starts with the OnDownloadFileBegin event. Download of a file ends with OnDownloadFileSuccess if downloading the file succeeds and with OnDownloadFileError otherwise. While downloading a file the OnDownloadProgress event is fired at regular intervals.

Download can be cancelled at any moment invoking the StopDownload method or executing an equivalent action with GUI. After download was cancelled the following sequence of events is fired: OnDownloadCancelled, OnDownloadEnd, OnError. If the cancel request was found while downloading a file, the sequence starts with the OnDownloadFileError event. Other case when the cancel request was found after completing one file and before starting another.

Note that download always ends with the OnDownloadEnd event either download was cancelled or not.

Download states

This diagram shows states of the ActiveXPowUpload control related to download process.

download states diagram

There are four states of the ActiveXPowUpload control related to the upload process. They are:

Initial
Download is not running. That is the initail state of the control.
Before download
Download process is running, but data are not yet being downloaded, preparing for download.
Download in progress
Download process is running, data are being downloaded.
After download
Download process is running, data were downloaded, performing cleanup.

Download process states are like Upload states. A note on the right of the state on the pictures tells what events are fired in that state.