title: Xamarin - Task wait for input from custom dialog
body: <p>I have a downloading Task which downloads data from web in 4 steps, which are defined as async Tasks and runs one by one. Now due to some change I need to capture a user input from a custom dialog in between task 2 and 3. I have written a function to capture input from AlertDialog. The problem is dialog displays in between but it just dont wait and halt processing and process continues without taking user input. The code is something like this:</p>
  
  <pre><code>async void button_click(......){
  await function1();
  await function2();
  await function3();
  await function4();
  ....do the data processing after that.
  }
  
  async Task&lt;datatype&gt; function1(){ ...processing step 1 }
  async Task&lt;datatype&gt; function2(){
  
  new AlertDialog.Builder(this)
                .SetPositiveButton("OK", (sender, args) =&gt;
                {
                    string inputText = txtInput.Text;
                })
                .SetView(customView)
                .Show();
  
  .... some more processing
  }
  </code></pre>
  
  <p>Is there any way I can stop processing untill user input is received from AlertDialog OR any other way of doing the same?</p>