/// <summary> /// Sets the contrast scheme to the given value. /// </summary> /// <param name="contrastScheme">The contrast scheme to use.</param> public override void SetContrast(ContrastLevel contrastScheme) { try { HtmlPage.Window.CreateInstance("SetContrastClass", contrastScheme.ToString()); } catch(Exception) { } }
/// <summary> /// Changes the contrast level of the surface. Typically this is a matter of /// changing the background and foreground colours. This could be acheived by /// setting CSS classes on the DivContainer. /// </summary> /// <param name="contrast">The contrast level to set on the surface.</param> public override void SetContrast(ContrastLevel level) { Container.CssClass = level.ToString(); }
/// <summary> /// Constructor for the ContrastSchemeEventArgs, this EventArgs will be used to pass /// the contrast scheme. /// </summary> /// <param name="contrastScheme"></param> public ContrastSchemeEventArgs(ContrastLevel contrastScheme) { ContrastScheme = contrastScheme; }
// Public Methods (9) /// <summary> /// Applies the contrast setting to the entire interface. /// </summary> /// <param name="contrastScheme">The contrast scheme.</param> public void ApplyContrastSetting(ContrastLevel contrastScheme) { _displayAttributes.HighlightBackground = DisplayAttributes.YellowBrush; _displayAttributes.HighlightForeground = DisplayAttributes.BlackBrush; switch(contrastScheme) { case ContrastLevel.WhiteTextOnBlue: { _displayAttributes.DefaultBackground = DisplayAttributes.DarkBlueBrush; _displayAttributes.DefaultForeground = DisplayAttributes.LightWhiteBrush; _displayAttributes.ControlSectionBackground = DisplayAttributes.DarkBlueBrush; _displayAttributes.SelectionBackground = DisplayAttributes.YellowBrush; _displayAttributes.SelectionBorderBrush = DisplayAttributes.YellowBrush; _displayAttributes.SelectionForeground = DisplayAttributes.BlackBrush; break; } case ContrastLevel.BlackTextOnWhite: { _displayAttributes.DefaultBackground = DisplayAttributes.LightWhiteBrush; _displayAttributes.DefaultForeground = DisplayAttributes.BlackBrush; _displayAttributes.ControlSectionBackground = DisplayAttributes.LightWhiteBrush; _displayAttributes.SelectionBackground = DisplayAttributes.BlackBrush; _displayAttributes.SelectionBorderBrush = DisplayAttributes.YellowBrush; _displayAttributes.SelectionForeground = DisplayAttributes.YellowBrush; break; } case ContrastLevel.YellowTextOnBlack: { _displayAttributes.DefaultBackground = DisplayAttributes.BlackBrush; _displayAttributes.DefaultForeground = DisplayAttributes.YellowBrush; _displayAttributes.ControlSectionBackground = DisplayAttributes.BlackBrush; _displayAttributes.SelectionBackground = DisplayAttributes.YellowBrush; _displayAttributes.SelectionBorderBrush = DisplayAttributes.LightWhiteBrush; _displayAttributes.SelectionForeground = DisplayAttributes.BlackBrush; break; } } DisplaySurface.SetContrast(contrastScheme); navigation.RefreshContrast(); }
/// <summary> /// Applies the given contrast scheme to the UI. /// </summary> /// <param name="contrastScheme">The contrast scheme to be applied.</param> private void ApplyContrastScheme(ContrastLevel contrastScheme) { View.ApplyContrastSetting(contrastScheme); }
// Public Methods (2) /// <summary> /// Updates the reported contrast scheme in the display settings. Called by the Presenter. /// </summary> /// <param name="contrastScheme">The contrast scheme.</param> public void UpdateContrastScheme(ContrastLevel contrastScheme) { ListBoxItem selectedItem = (ListBoxItem)contrastSchemeSelector.Items.FirstOrDefault( currentItem => ((ListBoxItem)currentItem).Tag.ToString() == contrastScheme.ToString()); //Don't want the event to fire to re-update this in the Model. contrastSchemeSelector.SelectionChanged -= contrastSchemeSelectionChanged; if(selectedItem != null) { contrastSchemeSelector.SelectedItem = selectedItem; } contrastSchemeSelector.SelectionChanged += contrastSchemeSelectionChanged; }