/// <summary> /// Respond to the user 'clicking' on a color scheme button / command by: /// 1. Update the caller's 'ColorScheme' object's public properties with the chosen colors. /// 2. Update the caller's 'ColorScheme' object's with brushes created from the chosen colors. /// 3. Close this window - we're done. /// </summary> public void ExecuteSaveScheme(object sender, ExecutedRoutedEventArgs e) { try { // Reference the chosen temporary 'Offer Color Scheme' object. int colorSchemeIndex = (int)e.Parameter - 1; OfferColorScheme offerScheme = mColorSchemes[colorSchemeIndex]; // Copy the colors into the caller's object. mCallersColorScheme.Background1 = offerScheme.tempColorScheme.Background1; mCallersColorScheme.Background2 = offerScheme.tempColorScheme.Background2; mCallersColorScheme.Foreground1 = offerScheme.tempColorScheme.Foreground1; mCallersColorScheme.Foreground2 = offerScheme.tempColorScheme.Foreground2; mCallersColorScheme.MouseOverColor = offerScheme.tempColorScheme.MouseOverColor; // Create the brushes in the caller's object too. mCallersColorScheme.CreateBrushes(); this.Close(); } catch (Exception ex) { // Log error, show user-friendly error message, and close. string errorMessage = ErrorHandler.Log(ex); MessageBox.Show(errorMessage, mRM.GetString("Error"), MessageBoxButton.OK, MessageBoxImage.Error); this.Close(); } }