MrUploader.FileUpload.SetFileStatus C# (CSharp) Method

SetFileStatus() private method

private SetFileStatus ( ) : void
return void
        private void SetFileStatus()
        {
            if (cancel)
            {
                Status = FileUploadStatus.Canceled;
            }
            else if (ErrorCode != Constants.NoError)
            {
                chunkRetries--;
                if (chunkRetries > 0)
                {
                    Status = FileUploadStatus.Retry;
                }
                else
                {
                    Status = FileUploadStatus.Failed;
                }
            }
            else
            {
                CalcNextChunkRanges();
                if (UploadProgressChanged != null)
                {
                    UploadProgressChangedEventArgs args = new UploadProgressChangedEventArgs(BytesUploaded, FileLength);
                    this.Dispatcher.BeginInvoke(delegate()
                    {
                        UploadProgressChanged(this, args);
                    });
                }
                if (BytesUploaded < FileLength)
                {
                    new UserStorage().AddOrUpdateFileInfo(this);
                    chunkRetries = Constants.MaxChunkRetries;
                    Status = FileUploadStatus.Continue;
                }
                else
                {
                    new UserStorage().DeleteFileInfo(this);
                    Status = FileUploadStatus.Complete;
                }
            }
        }