private void Write(LocoIOConnectorConfigurationControl connector, Button cmdWrite) { Busy = true; var settings = connector.CreateConfig(); connector.Enabled = false; cmdWrite.Enabled = false; lb.BeginRequest( x => programmer.Write(x, settings), x => { connector.Enabled = true; cmdWrite.Enabled = true; Busy = false; if (x.HasError) { MessageBox.Show(x.Error.Message); } else { WriteSucceeded.Fire(this); } }); }