public void ReadFromDevice() { 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); ParentForm.ShowIncompatableFirmwareWarning(m_Settings); if (allValuesSucceeded == true) { return; } if (allValuesFailed == true) { messageString = "Failed to read all settings."; } else { messageString = "Failed to read the following settings:" + messageString; } ParentForm.InvokeShowError(messageString); }; try { m_Settings.ReadAync(reporter, Options.Timeout, Options.MaximumNumberOfRetries); } catch { } }
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 { } }