Backstop.Samples.RestReports.MainWindow.Submit C# (CSharp) Method

Submit() private method

private Submit ( object sender, RoutedEventArgs e ) : void
sender object
e System.Windows.RoutedEventArgs
return void
        private async void Submit(object sender, RoutedEventArgs e)
        {
            buttonSubmit.IsEnabled = false;
            IsTestingConnection = true;
            var stopWatch = new Stopwatch();
            try
            {
                stopWatch.Start();
                var client = new ReportClient()
                {
                    BackstopUrl = new Uri(this.BackstopUrl),
                    Username = this.Username,
                    Password = this.txtPassword.Password,
                    ReportRestMethod = this.SelectedMethod.Uri,
                    QueryDefinition = this.QueryDefinition,
                    RestrictionExpression = this.RestrictionExpression,
                    AsOfDate = this.AsOfDate,
                    Grouping = this.Grouping
                };

                this.Result = await client.InvokeAsync();
                this.DataTable = ReportParser.CreateDataTable(this.Result);
            }
            catch(Exception ex)
            {
                this.Result = ex.ToString();
            }
            finally
            {
                buttonSubmit.IsEnabled = true;
                IsTestingConnection = false;
                stopWatch.Stop();
                ProcessTime.Text = $"Processing Time: {(stopWatch.ElapsedMilliseconds/1000).ToString()} seconds.";
            }
        }