private async void hwLoadPrepro_Click(object sender, EventArgs e) { if (hwOpenFilePrepro.ShowDialog(this) == DialogResult.OK) { hwProgress.Visible = true; var output = await Task.Factory.StartNew(() => { var ppOutput = new ParsedPreprocessorOutput(); bool success = ppOutput.ParseFromFile(hwOpenFilePrepro.FileName); return(success ? ppOutput : null); }); if (output == null) { MessageBox.Show(this, "Failed to parse: " + hwOpenFilePrepro.FileName, "Parse Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } hwProgress.Visible = false; var ppForm = new PreproForm(output); ppForm.Text = hwOpenFilePrepro.FileName; ppForm.Show(this); } }
private async void hwLoadPrepro_Click(object sender, EventArgs e) { if ( hwOpenFilePrepro.ShowDialog() == DialogResult.OK ) { hwProgress.Visible = true; ParsedPreprocessorOutput ppOutput = new ParsedPreprocessorOutput(); await Task.Run(() => ppOutput.ParseFromFile(hwOpenFilePrepro.FileName)); hwProgress.Visible = false; PreproForm ppForm = new PreproForm(ppOutput); ppForm.Text = hwOpenFilePrepro.FileName; ppForm.Show(); } }