async void btnCount_Click2(object sender, System.EventArgs e) { try { var cosmos = new CosmosDataStore(); var count = await cosmos.MeetingCount(); lblCount.Text = "Meeting Count: " + count; } catch (Exception ex) { lblCount.Text = "An error occurred: " + ex.Message; } }
void btnCount_Click(object sender, System.EventArgs e) { try { var cosmos = new CosmosDataStore(); Task <long> task = cosmos.MeetingCount(); task.Wait(); long count = task.Result; lblCount.Text = "Meeting Count: " + count; } catch (Exception ex) { lblCount.Text = "An error occurred: " + ex.Message; } }