private async void GenRep_Click(object sender, EventArgs e) { //UI jirainfo.Clear(); Progress.Value = 0; PTLabel.Text = "Preparing process..."; PTLabel.Refresh(); GenRep.Enabled = false; checkOptions(); Progress.Increment(20); //pass the name of the run, to be used in the email thread string name = RunsList.SelectedItem.ToString(); //index of the run int runs_index = RunsList.SelectedIndex; //pass the sorting index int sort_index = testrail_sorting.SelectedIndex; //start the task of creating the report //AllTheShinies runReport = new AllTheShinies(); await Task.Run(() => masterObject.RunReport(name, runs_index, sort_index, JiraValueTestrail.Text)); //UI for (int i = 0; i < 4; i++) { Progress.Increment(20); } PTLabel.Text = "Done "; PTLabel.Refresh(); GenRep.Enabled = true; }
private async void GenRepPlan_Click(object sender, EventArgs e) { checkOptions(); //affects UI behavior jirainfo.Clear(); Progress.Value = 0; PTLabel.Text = "Preparing process..."; PTLabel.Refresh(); Progress.Increment(20); //pass the name of the testplan to argument name string name = TestplanList.SelectedItem.ToString(); //pass the index of the testplan int index = TestplanList.SelectedIndex; //make sure the button is disabled GenRepPlan.Enabled = false; //pass the index for sorting int sort_index = testrail_sorting.SelectedIndex; //AllTheShinies runReport = new AllTheShinies(); //start a thread in which all the calls and processing is performed await Task.Run(() => masterObject.PlanReport(name, index, sort_index, JiraValueTestrail.Text)); //UI - behavior for (int i = 0; i < 4; i++) { Progress.Increment(20); } GenRepPlan.Enabled = true; PTLabel.Text = "Done "; PTLabel.Refresh(); }