public void WriteToDevice() { ReporterWrapper reporter = new ReporterWrapper(m_Reporter); reporter.Completed += (sender, e) => { bool allValuesFailed; bool allValuesSucceeded; string messageString = Settings.GetCommunicationFailureString(m_Settings.Values, 20, out allValuesFailed, out allValuesSucceeded); if (allValuesSucceeded == true) { return; } if (allValuesFailed == true) { messageString = "Failed to confirm write of all settings."; } else { messageString = "Failed to confirm write of following settings:" + messageString; } ParentForm.InvokeShowError(messageString); }; try { m_Settings.WriteAync(reporter, Options.Timeout, Options.MaximumNumberOfRetries); m_Settings.Connection?.SendCommand(Command.Apply); } catch { } }