protected void OnPropertyChange(object src, AutomationPropertyChangedEventArgs e) { AutomationElement sourceElement = src as AutomationElement; Debug.WriteLine($"OnPropertyChange Element: {sourceElement.Current.Name}; {sourceElement.Current.ControlType.ProgrammaticName}"); Debug.WriteLine($"OnPropertyChange Property: {e.Property.ProgrammaticName}"); Debug.WriteLine($"OnPropertyChange Value: {e.NewValue}"); if (e.Property == ValuePattern.ValueProperty) { var newVal = (string)e.NewValue; var color = GetColorForUrl(newVal); if (color != null) { var eventArgs = new ColorChangedEventArgs(color.Value); ColorChanged?.Invoke(this, eventArgs); } } else { // TODO: Handle other property-changed events. } }
private static void ColorChanged(object sender, ColorChangedEventArgs e) { var success = LogitechGSDK.LogiLedSetLighting(e.Color.Red, e.Color.Green, e.Color.Blue); Debug.WriteLine($"LogiLedSetLighting success: {success}"); }