void CloseTimer_Tick(object sender, EventArgs e) { MyBackgroundWorker.Invoke(delegate { CloseCountDown--; if (CloseCountDown == 0) { if (RequestClose != null) { RequestClose(this, new EventArgs()); } } else { CloseButtonText = "Close [" + CloseCountDown + "s]"; } }); }
void texProcess_Exited(object sender, EventArgs e) { MyBackgroundWorker.Invoke(new Action(delegate() { CloseButtonText = "Close"; ProgressBarVisible = false; if (texProcess.ExitCode == 0) { AddStatusLine("htlatex returned with exit code 0"); bool success1 = CopyOutputFiles(); bool success2 = CleanUp(); // if successful, start autoclose timer if (success1)// && success2) { SuccessLabelVisible = true; CloseButtonText = "Close [" + CloseCountDown + "s]"; CloseTimer.Start(); } else { //lblFailed.Text = "Error: export failed"; CloseButtonText = "Close"; FailedLabelVisible = true; } } else { AddStatusLine("Error: compilation failed"); CloseButtonText = "Close"; FailedLabelVisible = true; CleanUp(); } })); }