But I am not able to click on the cancel button, i dont get the access to click it.Once the process is completed i am able to click the button to generate the event.
Does any one know how this can be done in C#(Windows application)
Sample code is :
Code:
while (bytesRead > 0)
{
if (iteration == 1)
this._startTime = DateTime.Now;
bytesWritten = this._workFlowProxy.UploadChunk(this._taskId, buffer, sentBytes, bytesRead);
if (iteration == LoadManagerConstants.AverageSample + 1) //AverageSample = 5
{
timeForInitialChunks = (long)DateTime.Now.Subtract(this._startTime).TotalMilliseconds;
averageChunkTime = System.Math.Max
(1, timeForInitialChunks / LoadManagerConstants.AverageSample);
//Maximum size that can be uploaded at a time cannot be more than 4KB
chunkSize = (int)System.Math.Min(LoadManagerConstants.MaxFileSize,
chunkSize * preferredTransferDuration / averageChunkTime);
buffer = new byte[chunkSize];
}
sentBytes += bytesRead;
percentageOfTotalSize = (int)(((decimal)sentBytes / (decimal)fileSize) * 100);
this.SetProgressStatus(percentageOfTotalSize);
bytesRead = fileToUpLoad.Read(buffer, LoadManagerConstants.Offset, chunkSize);
iteration++;
}

