Ejemplo n.º 1
0
            public PartiallyLoadedStyleSheetHelper(PartiallyLoadableStyleSheet plSS, Theme theme, HslColor baseColor, string themeParameterName)
            {
                this.theme              = theme;
                this.baseColor          = baseColor;
                this.themeParameterName = themeParameterName;

                plSS.LoadedCompletely += plSS_LoadedCompletely;
            }
Ejemplo n.º 2
0
        private void RemoveColorBlendInternal(string themeParameterName)
        {
            foreach (StyleBuilderRegistration registration in this.GetRegisteredStyleBuilders())
            {
                PartiallyLoadableStyleSheet partiallyLoaded =
                    ((DefaultStyleBuilder)registration.Builder).Style as PartiallyLoadableStyleSheet;

                //Partially loaded stylesheets support
                if (partiallyLoaded != null && !partiallyLoaded.IsLoadedCompletely)
                {
                    PartiallyLoadedStyleSheetHelper helper = this.partiallyLoadedHelpers[partiallyLoaded];
                    if (helper != null)
                    {
                        helper.UnsubscribeFromLoadedEvent(partiallyLoaded);
                    }
                    continue;
                }

                foreach (
                    PropertySettingGroup group in
                    ((DefaultStyleBuilder)registration.Builder).Style.PropertySettingGroups)
                {
                    foreach (IPropertySetting setting in group.PropertySettings)
                    {
                        RadProperty prop = setting.Property;
                        if (prop.PropertyType == typeof(Color))
                        {
                            if (setting is AnimatedPropertySetting)
                            {
                                ColorBlendExtension startValueExtension =
                                    ((AnimatedPropertySetting)setting).GetStartValueProvider() as ColorBlendExtension;
                                if (startValueExtension != null && startValueExtension.ThemePropertyName == themeParameterName)
                                {
                                    ((AnimatedPropertySetting)setting).StartValue = startValueExtension.OriginalColor;
                                }

                                ColorBlendExtension endValueExtension =
                                    ((AnimatedPropertySetting)setting).GetEndValueProvider() as ColorBlendExtension;
                                if (endValueExtension != null && endValueExtension.ThemePropertyName == themeParameterName)
                                {
                                    ((AnimatedPropertySetting)setting).EndValue = endValueExtension.OriginalColor;
                                }
                            }
                            else //actualSetting is PropertySetting
                            {
                                ColorBlendExtension valueExtension =
                                    ((PropertySetting)setting).GetValueProvider() as ColorBlendExtension;
                                if (valueExtension != null && valueExtension.ThemePropertyName == themeParameterName)
                                {
                                    ((PropertySetting)setting).Value = valueExtension.OriginalColor;
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
            void plSS_LoadedCompletely(object sender, EventArgs e)
            {
                PartiallyLoadableStyleSheet plSS = (PartiallyLoadableStyleSheet)sender;

                plSS.LoadedCompletely -= plSS_LoadedCompletely;

                this.theme.partiallyLoadedHelpers.Remove(plSS);

                theme.ApplyColorBlendToGroups(plSS.PropertySettingGroups, baseColor, themeParameterName);
            }
Ejemplo n.º 4
0
        private void ApplyColorBlendToStyle(string themeParameterName, HslColor baseColor, StyleBuilderRegistration registration)
        {
            PartiallyLoadableStyleSheet partiallyLoaded = ((DefaultStyleBuilder)registration.Builder).Style as PartiallyLoadableStyleSheet;

            //delay applying of color blend, to the moment stylesheet is requested by a control
            if (partiallyLoaded != null && !partiallyLoaded.IsLoadedCompletely)
            {
                PartiallyLoadedStyleSheetHelper helper =
                    new PartiallyLoadedStyleSheetHelper(partiallyLoaded, this, baseColor, themeParameterName);

                this.partiallyLoadedHelpers[partiallyLoaded] = helper;

                return;
            }

            StyleSheet style = ((DefaultStyleBuilder)registration.Builder).Style;

            ApplyColorBlendToStyleSheet(baseColor, themeParameterName, this, style);
        }
Ejemplo n.º 5
0
 public void UnsubscribeFromLoadedEvent(PartiallyLoadableStyleSheet partiallyLoaded)
 {
     partiallyLoaded.LoadedCompletely -= plSS_LoadedCompletely;
 }