private string GetPropertyName(string categoryName) { string propName = categoryName.Replace(" ", string.Empty); Model.StyleOption styleOption = _styleOptions[StylesVariationListSelectedId.Number]; if ((styleOption.IsUseFrostedGlassBannerStyle && categoryName.Contains(PictureSlidesLabText.BannerHasEffect)) || (styleOption.IsUseFrostedGlassTextBoxStyle && categoryName.Contains(PictureSlidesLabText.TextBoxHasEffect))) { propName = propName.Insert(0, "FrostedGlass"); } return(propName); }
private void BindSliderValueToStyle(int value) { if (!IsAbleToBindProperty()) { return; } Model.StyleOption styleOption = _styleOptions[StylesVariationListSelectedId.Number]; string currentCategory = CurrentVariantCategory.Text; string propName = GetPropertyName(currentCategory); PropHandlerFactory.GetSliderPropHandler(propName).BindStyleOption(styleOption, value); }
private void BindFontToStyle(string font) { if (!IsAbleToBindProperty()) { return; } Model.StyleOption styleOption = _styleOptions[StylesVariationListSelectedId.Number]; string currentCategory = CurrentVariantCategory.Text; if (currentCategory == PictureSlidesLabText.VariantCategoryFontFamily) { styleOption.OptionName = "Customized"; styleOption.FontFamily = font; } }
public void BindStyleToSlider() { if (!IsAbleToBindProperty()) { return; } Model.StyleOption styleOption = _styleOptions[StylesVariationListSelectedId.Number]; string currentCategory = CurrentVariantCategory.Text; string propName = GetPropertyName(currentCategory); SliderPropHandler.Interface.ISliderPropHandler propHandler = PropHandlerFactory.GetSliderPropHandler(propName); SliderPropHandler.Factory.SliderPropHandlerFactory.SliderProperties sliderProperties = propHandler.GetSliderProperties(styleOption); SelectedSliderValue.Number = sliderProperties.Value; SelectedSliderMaximum.Number = sliderProperties.Maximum; SelectedSliderTickFrequency.Number = sliderProperties.TickFrequency; }
private void BindColorToStyle(Color color) { if (!IsAbleToBindProperty()) { return; } Model.StyleOption styleOption = _styleOptions[StylesVariationListSelectedId.Number]; string currentCategory = CurrentVariantCategory.Text; string targetColor = StringUtil.GetHexValue(color); if (currentCategory.Contains(PictureSlidesLabText.ColorHasEffect)) { styleOption.OptionName = "Customized"; string propName = GetPropertyName(currentCategory); System.Type type = styleOption.GetType(); System.Reflection.PropertyInfo prop = type.GetProperty(propName); prop.SetValue(styleOption, targetColor, null); } }
public void BindStyleToFontPanel() { if (!IsAbleToBindProperty()) { return; } Model.StyleOption styleOption = _styleOptions[StylesVariationListSelectedId.Number]; string styleFontFamily = styleOption.GetFontFamily(); int targetIndex = -1; for (int i = 0; i < FontFamilies.Count; i++) { if (styleFontFamily == FontFamilies[i]) { targetIndex = i; break; } } SelectedFontId.Number = targetIndex; }
/////////////////////////////////////////////////////////////// // Implemented variation stage controls' binding in ViewModel /////////////////////////////////////////////////////////////// // TODO add new variation stage control Slide to adjust brightness/blurriness/transparency #region Binding funcs for color panel public void BindStyleToColorPanel() { if (!IsAbleToBindProperty()) { return; } Model.StyleOption styleOption = _styleOptions[StylesVariationListSelectedId.Number]; string currentCategory = CurrentVariantCategory.Text; BrushConverter bc = new BrushConverter(); if (currentCategory.Contains(PictureSlidesLabText.ColorHasEffect)) { string propName = GetPropertyName(currentCategory); System.Type type = styleOption.GetType(); System.Reflection.PropertyInfo prop = type.GetProperty(propName); object optValue = prop.GetValue(styleOption, null); if (!string.IsNullOrEmpty(optValue as string)) { View.SetVariantsColorPanelBackground((Brush)bc.ConvertFrom(optValue)); } } }