Does Calling an async function( which is also calling an async function ) synchrously blocks UI in Win Forms

  • Thread starter Thread starter LearnersWay
  • Start date Start date
L

LearnersWay

Guest
I had a Win Form with different controls for collecting info from user and a button on it. On button click I am doing different validation before saving and in the end calling an async function depending on some condition (Like this):


button_CLick(object sender,EventArgs e)
{
validations()
if(conditiontrue) Then
Result() // Will this
call block UI
else
savinglogic()
end if
}

Private Async Sub Result()
Dim result = Await Show()
If result = String.Empty Or result Is Nothing Then
Return
ElseIf (Await PostAsync(txtData(0).Text, txtData(1).Text, result)) Then
LogChangesForAudit()
Else
Return
End If
End Sub

Private Async Function Show() as Threading.Tasks.Task(of String)
Dim response = await CalltoWebAPIAsynchronouslyAndShowDataToUser()
return UserInputString
End Function

Private Async Function PostAsync(txtData(0).Text, txtData(1).Text, result)) as Threading.Tasks.Task(of Boolean)
Dim flag as Boolean=false
if savingdatafetchedfromSHow() then
flag=
true
End if
return flag
End Function



Continue reading...
 
Back
Top