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.";
}
}