private void WriteFailure(object sender, HexFileController.HexFileControllerStates state, byte error, int line) { }
private void startButton_Click(object sender, EventArgs e) { connectButton.Enabled = false; startButton.Enabled = false; selectFileButton.Enabled = false; HexFileController hfc = new HexFileController(mec, selectedFilePath.Text); hfc.Failure += (s, state, error, line) => { BeginInvoke((MethodInvoker)delegate { this.logBox.AppendText(String.Format("Failed in state {0}, with error {1}, on line {2}", state, error, line)); }); }; hfc.Progress += (s, progress) => { BeginInvoke((MethodInvoker)delegate { progressBar.Value = progress; }); }; hfc.Finished += (s) => { BeginInvoke((MethodInvoker)delegate { logBox.AppendText("Finished\n"); connectButton.Enabled = true; startButton.Enabled = true; selectFileButton.Enabled = true; }); }; hfc.StartWriting(); }