private void btnLEDControl_Click(object sender, RoutedEventArgs e) { try { bool result = SDK.EnableLedControl(!Data.LEDControl, Data.Device); if (result) { Data.LEDControl = !Data.LEDControl; btnLEDControl.Content = Data.LEDControl ? "Disable" : "Enable"; } else { MessageBox.Show("Operation failed, please try again", "Error", MessageBoxButton.OK, MessageBoxImage.Warning); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }