I'm trying to call the async function getLatestTag in a synchronous one, but I can't get the program to finish for it to execute before continuing.
public static void checkInstalled()
{
var t = new Task(getLatestTag);
t.Start();
if (623 == tagOutput)
{
MessageBox.Show("succes");
}
else
{
MessageBox.Show("fail");
}
}
private static async void getLatestTag()
{
var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://api.github.com/repos/Futminer/miner-download/releases/latest");
var productValue = new ProductInfoHeaderValue("FutMiner", "1.0");
request.Headers.UserAgent.Add(productValue);
var resp = await httpClient.SendAsync(request);
HttpContent content = resp.Content;
string data = await content.ReadAsStringAsync();
dynamic obj = JsonConvert.DeserializeObject(data);
tagOutput = Convert.ToInt32(obj["tag_name"]);
}