private async void UpdateButton_Click(object sender, RoutedEventArgs e) { LineDisplayAttributes attributes = lineDisplay.GetAttributes(); if (lineDisplay.Capabilities.CanChangeBlinkRate) { attributes.BlinkRate = TimeSpan.FromMilliseconds(BlinkRateSlider.Value); } if (lineDisplay.Capabilities.IsBrightnessSupported) { attributes.Brightness = (int)BrightnessSlider.Value; } if (lineDisplay.Capabilities.CanChangeScreenSize) { attributes.ScreenSizeInCharacters = Helpers.GetSelectedItemTag <Size>(SupportedScreenSizesComboBox); } if (lineDisplay.Capabilities.CanMapCharacterSets) { attributes.IsCharacterSetMappingEnabled = CharacterSetMappingEnabledCheckbox.IsChecked.Value; } if (await lineDisplay.TryUpdateAttributesAsync(attributes)) { rootPage.NotifyUser("Attributes updated successfully.", NotifyType.StatusMessage); // The resulting attributes may not match our request. // For example, the Line Display will choose the closest available blink rate. // Update the controls to show what the Line Display actually used. SetValuesFromLineDisplay(); } else { // We probably lost our claim. rootPage.NotifyUser("Failed to update attributes.", NotifyType.ErrorMessage); } }