-2

so im creating this Application for calculating Profits in a Game and I'm trying to curl something before the UI is shown. It would be really nice if you could help me with the await GetRequest();

I dont know how to do it because i need this to be done before the user can use the App. GetRequest return a JSON string from which i need to populate objects. If this false I will need to throw an Error to the User(but that is just for the explanation).

public partial class MainWindow : Window
{
    public MainWindow()
    {
        string json = await GetRequest();
        var jsonObjects = JSONDeserialize(json);
        InitializeComponent();
    }
Bassie
  • 9,529
  • 8
  • 68
  • 159
ItsOswin
  • 11
  • 3

1 Answers1

0

You can use Task.WhenAll Method while waiting for the async to complete See the following answer. That should resolve the issue https://stackoverflow.com/a/9343733/14882929

Tech-leo
  • 62
  • 5