示例#1
0
        public void ApplyValue(RadObject element)
        {
            string propertyName = this.Name;

            if (this.PropertyMapper != null)
            {
                propertyName = this.PropertyMapper(propertyName, element);
            }
            if (this.property == null)
            {
                this.property = PropertySetting.FindProperty(element.GetType(), propertyName, true);
            }
            if (this.property != null && (!this.property.OwnerType.IsAssignableFrom(element.GetType()) || this.property.Name != propertyName))
            {
                this.property = PropertySetting.FindProperty(element.GetType(), propertyName, true);
            }
            if (this.property == null)
            {
                return;
            }
            if (this.endValue != null)
            {
                if (this.animatedSetting == null)
                {
                    this.animatedSetting            = new AnimatedPropertySetting();
                    this.animatedSetting.Property   = this.property;
                    this.animatedSetting.StartValue = this.value;
                    this.animatedSetting.EndValue   = this.endValue;
                }
                this.animatedSetting.IsStyleSetting = true;
                this.animatedSetting.Property       = this.property;
                this.animatedSetting.ApplyValue(element);
            }
            int num = (int)element.AddStylePropertySetting((IPropertySetting)this);
        }
示例#2
0
        public override IPropertySetting Deserialize()
        {
            AnimatedPropertySetting setting = new AnimatedPropertySetting();

            setting.Property = DeserializeProperty(this.Property);
            setting.StartValueIsCurrentValue = this.StartValueIsCurrentValue | this.Value == null;
            if (!this.StartValueIsCurrentValue)
            {
                setting.StartValue = base.GetConvertedValue(setting.Property, this.Value); //DeserializeValue(setting.Property, this.Value);
            }

            setting.Interval          = this.Interval;
            setting.NumFrames         = this.NumFrames;
            setting.AnimationType     = this.AnimationType;
            setting.AnimationLoopType = this.AnimationLoopType;
            setting.ApplyEasingType   = this.ApplyEasingType;
            setting.UnapplyEasingType = this.UnapplyEasingType;

            setting.EndValue = base.GetConvertedValue(setting.Property, this.EndValue); //DeserializeValue(setting.Property, this.EndValue);

            if (this.Step != null)
            {
                setting.Step = DeserializeStep(this.Step);
            }

            if (this.ReverseStep != null)
            {
                setting.ReverseStep = DeserializeStep(this.ReverseStep);
            }

            return(setting);
        }
示例#3
0
        public override object Clone()
        {
            AnimatedPropertySetting setting = new AnimatedPropertySetting();

            setting.animationLoopType      = this.animationLoopType;
            setting.animationType          = this.animationType;
            setting.animatorStyle          = this.animatorStyle;
            setting.applyDelay             = this.applyDelay;
            setting.applyEasingType        = this.applyEasingType;
            setting.calculator             = this.calculator;
            setting.delayTimerForElement   = this.delayTimerForElement;
            setting.endValueProviderHelper = this.endValueProviderHelper;
            setting.interval                 = this.interval;
            setting.isStyleSetting           = this.isStyleSetting;
            setting.nextPropertySetting      = this.nextPropertySetting;
            setting.numFrames                = this.numFrames;
            setting.removeAfterApply         = this.removeAfterApply;
            setting.Property                 = this.Property;
            setting.restoreValueAfterApply   = this.restoreValueAfterApply;
            setting.reverseStep              = this.reverseStep;
            setting.skipToEndValueOnReplace  = this.skipToEndValueOnReplace;
            setting.startValue               = this.startValue;
            setting.startValueProviderHelper = this.startValueProviderHelper;
            setting.unApplyEasingType        = this.unApplyEasingType;

            return(setting);
        }
示例#4
0
        internal ValueUpdateResult OnAnimationFinished(AnimatedPropertySetting setting)
        {
            //check whether we have registered animation setting for this element
            RadPropertyValue propVal = this.propertyValues.GetEntry(setting.Property, false);

            if (propVal == null)
            {
                return(ValueUpdateResult.NotUpdated);
            }
            //check whether this is StyleSetting or regular Animation
            object      propModifier;
            ValueSource source;

            if (setting.IsStyleSetting)
            {
                propModifier = setting;
                source       = ValueSource.Style;
            }
            else
            {
                propModifier = null;
                source       = ValueSource.Animation;
            }

            return(this.SetValueCore(propVal, propModifier, null, source));
        }
示例#5
0
 internal void Dispose()
 {
     ++this.lockComposeCount;
     ++this.lockValueUpdateCount;
     if (this.owner != null)
     {
         this.owner.RemoveBinding(this);
     }
     if (this.boundObjects != null)
     {
         for (int index = this.boundObjects.Count - 1; index >= 0; --index)
         {
             PropertyBoundObject boundObject = this.boundObjects[index];
             RadObject           radObject   = boundObject.Object;
             if (radObject != null && !radObject.IsDisposed && !radObject.IsDisposing)
             {
                 int num = (int)radObject.UnbindProperty(boundObject.Property);
             }
         }
         this.boundObjects.Clear();
     }
     this.property         = (RadProperty)null;
     this.metadata         = (RadPropertyMetadata)null;
     this.owner            = (RadObject)null;
     this.propertyBinding  = (PropertyBinding)null;
     this.animationSetting = (AnimatedPropertySetting)null;
     this.styleSetting     = (IPropertySetting)null;
 }
示例#6
0
        internal void RemoveAnimation(RadPropertyValue propVal)
        {
            AnimatedPropertySetting animation = this.GetCurrentAnimation(propVal);

            if (animation != null)
            {
                animation.RemovePreviousAnimation((RadElement)this, animation);
            }
        }
示例#7
0
 internal void SetAnimation(AnimatedPropertySetting animation)
 {
     if (animation == null)
     {
         this.animatedValue = this.animationSetting == null || this.animationSetting.RemoveAfterApply ? RadProperty.UnsetValue : this.animationSetting.GetCurrentValue(this.owner);
     }
     this.animationSetting = animation;
     this.valueSource      = ValueSource.Unknown;
 }
示例#8
0
        public static void ApplyColorBlendToGroups(PropertySettingGroupCollection groups, HslColor baseColor, string themeParameterName, IPropertiesProvider propertiesProvider)
        {
            foreach (PropertySettingGroup group in groups)
            {
                foreach (IPropertySetting setting in group.PropertySettings)
                {
                    RadProperty prop = setting.Property;
                    if (prop.PropertyType == typeof(Color))
                    {
                        if (setting is AnimatedPropertySetting)
                        {
                            AnimatedPropertySetting animatedSetting = (AnimatedPropertySetting)setting;

                            object value = animatedSetting.StartValue;
                            if (value != null)
                            {
                                Color color = (Color)value;
                                if (ShouldApplyBaseColor(baseColor, color))
                                {
                                    object relativeColorDef =
                                        GetRelativeColorDef(propertiesProvider, themeParameterName, baseColor, color,
                                                            animatedSetting.GetStartValueProvider());
                                    animatedSetting.StartValue = relativeColorDef;
                                }
                            }

                            object endValue = animatedSetting.EndValue;
                            if (endValue != null)
                            {
                                Color color = (Color)endValue;
                                if (ShouldApplyBaseColor(baseColor, color))
                                {
                                    animatedSetting.EndValue =
                                        GetRelativeColorDef(propertiesProvider, themeParameterName, baseColor, color,
                                                            animatedSetting.GetEndValueProvider());
                                }
                            }
                        }
                        else //actualSetting is PropertySetting
                        {
                            PropertySetting propertySetting = (PropertySetting)setting;
                            object          value           = propertySetting.Value;
                            if (value != null)
                            {
                                Color color = (Color)value;
                                if (ShouldApplyBaseColor(baseColor, color))
                                {
                                    propertySetting.Value =
                                        GetRelativeColorDef(propertiesProvider, themeParameterName, baseColor, color,
                                                            propertySetting.GetValueProvider());
                                }
                            }
                        }
                    }
                }
            }
        }
示例#9
0
        /// <summary>
        /// Gets notified for a change in an animated property.
        /// </summary>
        /// <param name="setting">The property which is currently animated.</param>
        internal ValueUpdateResult OnAnimatedPropertyValueChanged(AnimatedPropertySetting setting)
        {
            RadPropertyValue propVal = this.propertyValues.GetEntry(setting.Property, false);

            if (propVal == null)
            {
                return(ValueUpdateResult.NotUpdated);
            }
            return(this.UpdateValueCore(propVal));
        }
示例#10
0
        internal void OnElementDisposed()
        {
            //stop timer
            this.StopTimer();
            //ask the setting to remove the delay timer for the element
            this.setting.RemoveDelayTimer(element);

            //clear references
            this.setting = null;
            this.element = null;
        }
示例#11
0
        internal void RemovePreviousAnimation(RadElement element, AnimatedPropertySetting setting)
        {
            // Evtim: Added code to throw OnAnimationFinished when animation is changed with another one
            ElementValuesAnimator prevAnimator = setting != null?setting.GetExistingAnimator(element) : null;

            if (prevAnimator != null && prevAnimator.IsRunning)
            {
                setting.PropertySettingRemoving(element);
                setting.OnAnimationFinished(new AnimationStatusEventArgs(element, true, false));
            }
        }
示例#12
0
        internal ValueUpdateResult OnAnimationStarted(AnimatedPropertySetting setting)
        {
            RadPropertyValue entry = this.propertyValues.GetEntry(setting.Property, true);

            if (entry == null)
            {
                return(ValueUpdateResult.NotUpdated);
            }
            ValueSource source = setting.IsStyleSetting ? ValueSource.Style : ValueSource.Animation;

            return(this.SetValueCore(entry, (object)setting, (object)null, source));
        }
示例#13
0
 internal void Copy(RadPropertyValue source)
 {
     this.valueSource           = source.valueSource;
     this.localValue            = source.localValue;
     this.localValueFromBinding = source.localValueFromBinding;
     this.defaultValueOverride  = source.defaultValueOverride;
     this.currentValue          = source.currentValue;
     this.iscurrentValueCoerced = source.iscurrentValueCoerced;
     this.isSetAtDesignTime     = source.isSetAtDesignTime;
     this.animationSetting      = source.animationSetting;
     this.styleSetting          = source.styleSetting;
     this.propertyBinding       = source.propertyBinding;
     this.animatedValue         = source.animatedValue;
 }
示例#14
0
 public void Dispose()
 {
     if (this.running)
     {
         this.StopTimer();
     }
     if (this.animationTimer != null)
     {
         this.animationTimer.Tick -= new EventHandler(this.AnimationTimer_Tick);
         this.animationTimer       = (RadControlAnimationTimer)null;
     }
     this.setting = (AnimatedPropertySetting)null;
     this.element = (RadObject)null;
 }
        public override IPropertySetting Deserialize()
        {
            AnimatedPropertySetting animatedPropertySetting = new AnimatedPropertySetting();

            animatedPropertySetting.Property = XmlPropertySetting.DeserializeProperty(this.Property);
            if (!this.StartValueIsCurrentValue)
            {
                animatedPropertySetting.StartValue = this.GetConvertedValue(animatedPropertySetting.Property, this.Value);
            }
            animatedPropertySetting.Interval        = this.Interval;
            animatedPropertySetting.NumFrames       = this.NumFrames;
            animatedPropertySetting.ApplyEasingType = this.ApplyEasingType;
            animatedPropertySetting.EndValue        = this.GetConvertedValue(animatedPropertySetting.Property, this.EndValue);
            return((IPropertySetting)animatedPropertySetting);
        }
示例#16
0
        internal ValueUpdateResult OnAnimationFinished(AnimatedPropertySetting setting)
        {
            RadPropertyValue entry = this.propertyValues.GetEntry(setting.Property, false);

            if (entry == null)
            {
                return(ValueUpdateResult.NotUpdated);
            }
            object      propModifier;
            ValueSource source;

            if (setting.IsStyleSetting)
            {
                propModifier = (object)setting;
                source       = ValueSource.Style;
            }
            else
            {
                propModifier = (object)null;
                source       = ValueSource.Animation;
            }
            if (setting.RemoveAfterApply && setting.IsStyleSetting)
            {
                IStylableNode stylableNode = this as IStylableNode;
                if (stylableNode != null && stylableNode.Style != null)
                {
                    foreach (PropertySettingGroup propertySettingGroup in stylableNode.Style.PropertySettingGroups)
                    {
                        foreach (PropertySetting propertySetting in propertySettingGroup.PropertySettings)
                        {
                            if (propertySetting.AnimatedSetting == setting)
                            {
                                propertySettingGroup.PropertySettings.Remove(propertySetting);
                                break;
                            }
                        }
                    }
                }
                PropertySetting propertySetting1 = new PropertySetting(setting.Property, setting.EndValue);
                return(this.SetValueCore(entry, (object)propertySetting1, propertySetting1.Value, source));
            }
            if (!setting.RemoveAfterApply)
            {
                return(ValueUpdateResult.UpdatedNotChanged);
            }
            return(this.SetValueCore(entry, propModifier, (object)null, source));
        }
        private void RemovePreviousAnimation(RadObject element)
        {
            AnimatedPropertySetting currentAnimation = element.GetCurrentAnimation(this.Property);

            if (currentAnimation == null)
            {
                return;
            }
            ElementValuesAnimator valuesAnimator = element.ValuesAnimators[(object)currentAnimation.GetHashCode()] as ElementValuesAnimator;

            if (valuesAnimator == null || !valuesAnimator.IsRunning)
            {
                return;
            }
            valuesAnimator.Stop();
            currentAnimation.OnAnimationFinished(new AnimationStatusEventArgs(element, true, false));
        }
示例#18
0
        internal ValueUpdateResult OnAnimationStarted(AnimatedPropertySetting setting)
        {
            RadPropertyValue propVal = this.propertyValues.GetEntry(setting.Property, true);

            if (propVal == null)
            {
                return(ValueUpdateResult.NotUpdated);
            }
            //register the setting with the specified property
            //the setting may have two meanings:
            //1. If it comes from a StyleSheet it will be treated as a Style setting
            //2. Otherwise it will be treated as Animation and will have highest precendence
            //   when composing associated property's value.
            ValueSource source = setting.IsStyleSetting ? ValueSource.Style : ValueSource.Animation;

            return(this.SetValueCore(propVal, setting, null, source));
        }
示例#19
0
        internal void SetIsFromStyleSheet()
        {
            if (this.isStyleSettingApplied)
            {
                return;
            }

            foreach (IPropertySetting setting in this.propertySettings)
            {
                AnimatedPropertySetting animation = setting as AnimatedPropertySetting;
                if (animation != null)
                {
                    animation.IsStyleSetting = true;
                }
            }

            this.isStyleSettingApplied = true;
        }
示例#20
0
 /// <summary>
 /// Applies the specified animation and forces current value re-evaluation.
 /// </summary>
 /// <param name="animation"></param>
 internal void SetAnimation(AnimatedPropertySetting animation)
 {
     //check whether we need to keep the animated value
     if (animation == null)
     {
         if (this.animationSetting != null && !this.animationSetting.RemoveAfterApply)
         {
             this.animatedValue = this.animationSetting.GetCurrentValue(this.owner);
         }
         else
         {
             this.animatedValue = RadProperty.UnsetValue;
         }
     }
     this.animationSetting = animation;
     //clear current value source
     this.valueSource = ValueSource.Unknown;
 }
示例#21
0
 public PropertySetting(PropertySetting setting)
 {
     this.property = setting.property;
     this.name     = setting.name;
     this.fullName = setting.fullName;
     this.value    = setting.value;
     this.endValue = setting.endValue;
     if (setting.animatedSetting == null)
     {
         return;
     }
     this.animatedSetting                  = new AnimatedPropertySetting();
     this.animatedSetting.StartValue       = setting.animatedSetting.EndValue;
     this.animatedSetting.EndValue         = setting.animatedSetting.EndValue;
     this.animatedSetting.ApplyDelay       = setting.animatedSetting.ApplyDelay;
     this.animatedSetting.RemoveAfterApply = setting.animatedSetting.RemoveAfterApply;
     this.animatedSetting.Step             = setting.animatedSetting.Step;
     this.animatedSetting.NumFrames        = setting.animatedSetting.NumFrames;
     this.animatedSetting.Interval         = setting.animatedSetting.Interval;
     this.animatedSetting.RandomDelay      = setting.animatedSetting.RandomDelay;
 }
示例#22
0
 public ElementValuesAnimator(RadElement element, AnimatedPropertySetting setting)
 {
     this.element = element;
     this.setting = setting;
     this.currentAnimatorState = new ValuesAnimatorNotRunningState(this);
 }
示例#23
0
 public ElementValuesAnimator(RadObject element, AnimatedPropertySetting setting)
 {
     this.element = element;
     this.setting = setting;
 }