BudgetAnalyser.Mobile.UploadMobileDataController.AttemptUploadAsync C# (CSharp) Method

AttemptUploadAsync() private method

private AttemptUploadAsync ( ) : System.Threading.Tasks.Task
return System.Threading.Tasks.Task
        private async Task AttemptUploadAsync()
        {
            try
            {
                this.widget.LockWhileUploading(true);
                var budget = this.widget.BudgetCollection.CurrentActiveBudget;
                var export = this.dataExporter.CreateExportObject(this.widget.StatementModel, budget, this.widget.LedgerBook, this.widget.Filter);

                await Task.Run(() => this.dataExporter.SaveCopyAsync(export));

                await Task.Run(() => this.uploader.UploadDataFileAsync(this.dataExporter.Serialise(export), AccessKeyId, AccessKeySecret, AmazonRegion));

                this.messageBoxService.Show("Mobile summary data exported successfully.");
            }
            catch (SecurityException ex)
            {
                this.logger.LogError(ex, l => "A Security Exception occured attempting to upload Mobile Summary Data.");
                this.messageBoxService.Show(ex.Message, "Invalid Credentials");
            }
            catch (Exception ex)
            {
                this.logger.LogError(ex, l => "An unexpected Exception occured attempting to upload Mobile Summary Data.");
                this.messageBoxService.Show(ex.Message, "Upload Failed");
            }
            finally
            {
                this.widget.LockWhileUploading(false);
            }
        }