Setter

Namespace: Uno.UI
We found 10 examples in language CSharp for this search. You will see 38 fragments of code.
            internal static MemberGetterSetter ForBoolean(MemberGetterSetter<Boolean>.GetterFunction getter, MemberGetterSetter<Boolean>.SetterFunction setter) => new BooleanGetterSetter(getter, setter);
                internal override void Deserialize(TInheritor inheritor, BinaryReader reader) => Setter(inheritor, reader.ReadBoolean());

            internal static MemberGetterSetter ForByte(MemberGetterSetter<Byte>.GetterFunction getter, MemberGetterSetter<Byte>.SetterFunction setter) => new ByteGetterSetter(getter, setter);
                internal override void Deserialize(TInheritor inheritor, BinaryReader reader) => Setter(inheritor, reader.ReadByte());

            internal static MemberGetterSetter ForChar(MemberGetterSetter<Char>.GetterFunction getter, MemberGetterSetter<Char>.SetterFunction setter) => new CharGetterSetter(getter, setter);
                internal override void Deserialize(TInheritor inheritor, BinaryReader reader) => Setter(inheritor, reader.ReadChar());


    internal override void LoadCore(IInteractivityRoot root)
    {
      base.LoadCore(root);

      if (IsApplied == false) 
	      return;

      foreach (var setter in this)
        setter.Apply();
    }

    private void LoadSetter(SetterBase setter)
    {
      if (IsLoaded)
        setter.Load();

      if (IsApplied)
        setter.Apply();
    }

//#if !SILVERLIGHT
//		protected override void MoveItem(int oldIndex, int newIndex)
//		{
//			base.MoveItem(oldIndex, newIndex);

//			FixIndices(Math.Min(oldIndex, newIndex), false);
//		}
//#endif

    protected override void ClearCore()
    {
      foreach (var setter in this)
        UnloadSetter(setter);

      base.ClearCore();
    }

    private void UnloadSetter(SetterBase setter)
    {
      if (setter.IsApplied)
        setter.Undo();

      if (setter.IsLoaded)
        setter.Unload();
    }


        private void DrawGUIForDunes(TCCommonParametersSetter setter)
        {
            setter.dunesParams.x = EditorGUILayout.Slider("dunesMagn ", setter.dunesParams.x, 0.0f, 100.0f);
            setter.dunesParams.y = EditorGUILayout.Slider("dunesFreq ", setter.dunesParams.y, 0.0f, 1000.0f);
            setter.dunesParams.z = EditorGUILayout.Slider("dunesFraction ", setter.dunesParams.z, 0.0f, 1.0f);
        }

        private void DrawGUIForCanyons(TCCommonParametersSetter setter)
        {
            setter.canyonsParams.x = EditorGUILayout.Slider("canyonsMagn ", setter.canyonsParams.x, 0.0f, 100.0f);
            setter.canyonsParams.y = EditorGUILayout.Slider("canyonsFreq ", setter.canyonsParams.y, 0.0f, 1000.0f);
            setter.canyonsParams.z = EditorGUILayout.Slider("canyonsFraction ", setter.canyonsParams.z, 0.0f, 1.0f);
        }

        private void DrawGUIForCracks(TCCommonParametersSetter setter)
        {
            setter.cracksParams.x = EditorGUILayout.Slider("cracksMagn ", setter.cracksParams.x, 0.0f, 100.0f);
            setter.cracksParams.y = EditorGUILayout.Slider("cracksFreq ", setter.cracksParams.y, 0.0f, 1000.0f);
            setter.cracksParams.z = (float)Mathf.RoundToInt(EditorGUILayout.Slider("cracksOctaves ", setter.cracksParams.z, 0.0f, 15.0f));
        }

        private void DrawGUIForMare(TCCommonParametersSetter setter)
        {
            setter.mareParams.y = EditorGUILayout.Slider("mareFreq ", setter.mareParams.y, 0.0f, 1000.0f);
            setter.mareParams.z = EditorGUILayout.Slider("mareSqrtDensity ", setter.mareParams.z, 0.0f, 2.0f);
        }

        private void DrawGUIForVenus(TCCommonParametersSetter setter)
        {
            setter.textureParams.z = EditorGUILayout.Slider("venusMagn ", setter.textureParams.z, -1.0f, 1.0f);
            setter.textureParams.w = EditorGUILayout.Slider("venusFreq ", setter.textureParams.w, 0.0f, 1000.0f);
        }


        public IHystrixCommandProperties GetCommandProperties(HystrixCommandKey commandKey, HystrixCommandPropertiesSetter setter)
        {
            if (setter == null)
            {
                setter = UnitTestSetterFactory.GetCommandPropertiesSetter();
            }
            return new MockingHystrixCommandProperties(setter);
        }

        public IHystrixThreadPoolProperties GetThreadPoolProperties(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolPropertiesSetter setter)
        {
            if (setter == null)
            {
                setter = UnitTestSetterFactory.GetThreadPoolPropertiesSetter();
            }
            return new MockingHystrixThreadPoolProperties(setter);
        }


    private static object GetOriginalValue(IValueSetter setter)
    {
      var valueStore = setter.ValueStore;

      if (IsResolvedValueProvider(setter.ValueKind) == false)
        return valueStore;

      return valueStore is ISetterValueProvider valueProvider ? valueProvider.OriginalValue : valueStore;
    }

    public static object GetValue(IValueSetter setter)
    {
      var valueKind = setter.ValueKind & ValueKind.Unspecified;

      return valueKind == ValueKind.Explicit ? GetOriginalValue(setter) : null;
    }

    public static string GetValuePath(IValueSetter setter)
    {
      var valueKind = setter.ValueKind & ValueKind.Unspecified;

      if (valueKind != ValueKind.Explicit)
        return (string) GetOriginalValue(setter);

      return null;
    }

    public static bool IsSpecified(IValueSetter setter)
    {
      return (setter.ValueKind & ValueKind.Unspecified) != ValueKind.Unspecified;
    }

    public static bool IsSpecifiedValuePath(IValueSetter setter)
    {
      var valueKind = setter.ValueKind & ValueKind.Unspecified;

      return valueKind != ValueKind.Unspecified && valueKind != ValueKind.ValuePath;
    }

    public static void SetValue(IValueSetter setter, object value)
    {
      UnresolveValueProvider(setter);

      setter.ValueStore = value;
      setter.ValueKind = ValueKind.Explicit;
    }

		public void Add(IParameterSetter setter)
		{
			_List.Add(setter);
		}

		public void reset()
		{
			foreach(IParameterSetter Setter in _List)
				Setter.reset();
		}

		bool SetValue(ParameterInfo Info, int i, ref object Value)
		{
			foreach(IParameterSetter Setter in _List)
			{
				if (Setter.GetParameterValue(Info, i, ref Value))
					return true;
			}
			return false;
		}

        [Test]
        [ExpectedException(typeof(ValueResolutionException))]
        public void UnexistedPropery()
        {
            var container = new Container();

            var setter = new Setter();
            setter.Set(container,"Unexisted",6000);


        }

        [Test]
        public void ShortToInt()
        {
            var f = typeof(Int32).IsAssignableFrom(typeof(Int16));
            ;
            var container = new Container();

            var setter = new Setter();
            
            setter.Set(container, "Width", (short)45);

            Assert.AreEqual(45, container.Width);

            

        }

        [Test]
        public void IntToDecimal()
        {
            var container = new Container();

            var setter = new Setter();

            setter.Set(container, "Decimal", (int)45);

            Assert.AreEqual(45, container.Decimal);



        }


        [Test]
        public void DoubleToDecimal()
        {
            var container = new Container();

            var setter = new Setter();

            setter.Set(container, "Decimal", (double)45.7);

            Assert.AreEqual(45.7, container.Decimal);



        }



        [Test]
        public void IntToSort()
        {
            var f = typeof(Int32).IsAssignableFrom(typeof(Int16));
            ;
            var container = new Container();

            var setter = new Setter();

            setter.Set(container, "Short", (int)45);

            Assert.AreEqual(45, container.Short);

        }


        [Test]
        public void IntToIntNullable()
        {
            var f = typeof(Int32).IsAssignableFrom(typeof(Int16));
            ;
            var container = new Container();

            var setter = new Setter();

            setter.Set(container, "IntNullable", (int)45);

            Assert.AreEqual(45, container.IntNullable.Value);

        }

        public static Setter Property(this Setter setter, BindableProperty property)
        {
            setter.Property = property;
            return setter;
        }

        public static Setter Property(this Setter setter, BindableProperty property, object value)
        {
            setter.Property = property;
            setter.Value = value;
            return setter;
        }

        public static Setter Property(this Setter setter, (BindableProperty property, object value) prop)
        {
            setter.Property = prop.property;
            setter.Value = prop.value;
            return setter;
        }

        public static Setter Value(this Setter setter, object value)
        {
            setter.Value = value;
            return setter;
        }


        private void SetDataContext(object target, XmlPropertySetter setter, object dataContext, bool useContext)
        {
            if (useContext)
                target.SetDataContext(dataContext);
            else
                XmlPropertySetter.AddBinding(setter, target, AttachedMemberConstants.DataContext, DataContext, false);
        }

namespace Elders.Hystrix.NET.Test
{
    using System;
    using Elders.Hystrix.NET;

    internal class MockingHystrixCommandProperties : IHystrixCommandProperties
    {
        private readonly HystrixCommandPropertiesSetter setter;

        public MockingHystrixCommandProperties(HystrixCommandPropertiesSetter setter)
        {
            if (setter == null)
                throw new ArgumentNullException("setter");

            this.setter = setter;
        }

        public IHystrixProperty<bool> CircuitBreakerEnabled
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.CircuitBreakerEnabled.Value); }
        }
        public IHystrixProperty<int> CircuitBreakerErrorThresholdPercentage
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.CircuitBreakerErrorThresholdPercentage.Value); }
        }
        public IHystrixProperty<bool> CircuitBreakerForceClosed
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.CircuitBreakerForceClosed.Value); }
        }
        public IHystrixProperty<bool> CircuitBreakerForceOpen
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.CircuitBreakerForceOpen.Value); }
        }
        public IHystrixProperty<int> CircuitBreakerRequestVolumeThreshold
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.CircuitBreakerRequestVolumeThreshold.Value); }
        }
        public IHystrixProperty<TimeSpan> CircuitBreakerSleepWindow
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.CircuitBreakerSleepWindow.Value); }
        }
        public IHystrixProperty<int> ExecutionIsolationSemaphoreMaxConcurrentRequests
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.ExecutionIsolationSemaphoreMaxConcurrentRequests.Value); }
        }
        public IHystrixProperty<ExecutionIsolationStrategy> ExecutionIsolationStrategy
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.ExecutionIsolationStrategy.Value); }
        }
        public IHystrixProperty<bool> ExecutionIsolationThreadInterruptOnTimeout
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.ExecutionIsolationThreadInterruptOnTimeout.Value); }
        }
        public IHystrixProperty<string> ExecutionIsolationThreadPoolKeyOverride
        {
            get { return HystrixPropertyFactory.NullProperty<string>(); }
        }
        public IHystrixProperty<TimeSpan> ExecutionIsolationThreadTimeout
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.ExecutionIsolationThreadTimeout.Value); }
        }
        public IHystrixProperty<int> FallbackIsolationSemaphoreMaxConcurrentRequests
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.FallbackIsolationSemaphoreMaxConcurrentRequests.Value); }
        }
        public IHystrixProperty<bool> FallbackEnabled
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.FallbackEnabled.Value); }
        }
        public IHystrixProperty<TimeSpan> MetricsHealthSnapshotInterval
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.MetricsHealthSnapshotInterval.Value); }
        }
        public IHystrixProperty<int> MetricsRollingPercentileBucketSize
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.MetricsRollingPercentileBucketSize.Value); }
        }
        public IHystrixProperty<bool> MetricsRollingPercentileEnabled
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.MetricsRollingPercentileEnabled.Value); }
        }
        public IHystrixProperty<int> MetricsRollingPercentileWindowInMilliseconds
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.MetricsRollingPercentileWindowInMilliseconds.Value); }
        }
        public IHystrixProperty<int> MetricsRollingPercentileWindowBuckets
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.MetricsRollingPercentileWindowBuckets.Value); }
        }
        public IHystrixProperty<int> MetricsRollingStatisticalWindowInMilliseconds
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.MetricsRollingStatisticalWindowInMilliseconds.Value); }
        }
        public IHystrixProperty<int> MetricsRollingStatisticalWindowBuckets
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.MetricsRollingStatisticalWindowBuckets.Value); }
        }
        public IHystrixProperty<bool> RequestCacheEnabled
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.RequestCacheEnabled.Value); }
        }
        public IHystrixProperty<bool> RequestLogEnabled
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.RequestLogEnabled.Value); }
        }
    }
}

Other methods

Other methods

Setter

Namespace: Uno.UI
We found 10 examples in language CSharp for this search. You will see 39 fragments of code.
            internal static MemberGetterSetter ForBoolean(MemberGetterSetter<Boolean>.GetterFunction getter, MemberGetterSetter<Boolean>.SetterFunction setter) => new BooleanGetterSetter(getter, setter);
                internal override void Deserialize(TInheritor inheritor, BinaryReader reader) => Setter(inheritor, reader.ReadBoolean());

            internal static MemberGetterSetter ForByte(MemberGetterSetter<Byte>.GetterFunction getter, MemberGetterSetter<Byte>.SetterFunction setter) => new ByteGetterSetter(getter, setter);
                internal override void Deserialize(TInheritor inheritor, BinaryReader reader) => Setter(inheritor, reader.ReadByte());

            internal static MemberGetterSetter ForChar(MemberGetterSetter<Char>.GetterFunction getter, MemberGetterSetter<Char>.SetterFunction setter) => new CharGetterSetter(getter, setter);
                internal override void Deserialize(TInheritor inheritor, BinaryReader reader) => Setter(inheritor, reader.ReadChar());


    internal override void LoadCore(IInteractivityRoot root)
    {
      base.LoadCore(root);

      if (IsApplied == false) 
	      return;

      foreach (var setter in this)
        setter.Apply();
    }

    private void LoadSetter(SetterBase setter)
    {
      if (IsLoaded)
        setter.Load();

      if (IsApplied)
        setter.Apply();
    }

//#if !SILVERLIGHT
//		protected override void MoveItem(int oldIndex, int newIndex)
//		{
//			base.MoveItem(oldIndex, newIndex);

//			FixIndices(Math.Min(oldIndex, newIndex), false);
//		}
//#endif

    protected override void ClearCore()
    {
      foreach (var setter in this)
        UnloadSetter(setter);

      base.ClearCore();
    }

    private void UnloadSetter(SetterBase setter)
    {
      if (setter.IsApplied)
        setter.Undo();

      if (setter.IsLoaded)
        setter.Unload();
    }

        public static Setter Property(this Setter setter, BindableProperty property)
        {
            setter.Property = property;
            return setter;
        }

        public static Setter Property(this Setter setter, BindableProperty property, object value)
        {
            setter.Property = property;
            setter.Value = value;
            return setter;
        }

        public static Setter Property(this Setter setter, (BindableProperty property, object value) prop)
        {
            setter.Property = prop.property;
            setter.Value = prop.value;
            return setter;
        }

        public static Setter Value(this Setter setter, object value)
        {
            setter.Value = value;
            return setter;
        }


        public IHystrixCommandProperties GetCommandProperties(HystrixCommandKey commandKey, HystrixCommandPropertiesSetter setter)
        {
            if (setter == null)
            {
                setter = UnitTestSetterFactory.GetCommandPropertiesSetter();
            }
            return new MockingHystrixCommandProperties(setter);
        }

        public IHystrixThreadPoolProperties GetThreadPoolProperties(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolPropertiesSetter setter)
        {
            if (setter == null)
            {
                setter = UnitTestSetterFactory.GetThreadPoolPropertiesSetter();
            }
            return new MockingHystrixThreadPoolProperties(setter);
        }

		public void Add(IParameterSetter setter)
		{
			_List.Add(setter);
		}

		public void reset()
		{
			foreach(IParameterSetter Setter in _List)
				Setter.reset();
		}

		bool SetValue(ParameterInfo Info, int i, ref object Value)
		{
			foreach(IParameterSetter Setter in _List)
			{
				if (Setter.GetParameterValue(Info, i, ref Value))
					return true;
			}
			return false;
		}


    private static object GetOriginalValue(IValueSetter setter)
    {
      var valueStore = setter.ValueStore;

      if (IsResolvedValueProvider(setter.ValueKind) == false)
        return valueStore;

      return valueStore is ISetterValueProvider valueProvider ? valueProvider.OriginalValue : valueStore;
    }

    public static object GetValue(IValueSetter setter)
    {
      var valueKind = setter.ValueKind & ValueKind.Unspecified;

      return valueKind == ValueKind.Explicit ? GetOriginalValue(setter) : null;
    }

    public static string GetValuePath(IValueSetter setter)
    {
      var valueKind = setter.ValueKind & ValueKind.Unspecified;

      if (valueKind != ValueKind.Explicit)
        return (string) GetOriginalValue(setter);

      return null;
    }

    public static bool IsSpecified(IValueSetter setter)
    {
      return (setter.ValueKind & ValueKind.Unspecified) != ValueKind.Unspecified;
    }

    public static bool IsSpecifiedValuePath(IValueSetter setter)
    {
      var valueKind = setter.ValueKind & ValueKind.Unspecified;

      return valueKind != ValueKind.Unspecified && valueKind != ValueKind.ValuePath;
    }

    public static void SetValue(IValueSetter setter, object value)
    {
      UnresolveValueProvider(setter);

      setter.ValueStore = value;
      setter.ValueKind = ValueKind.Explicit;
    }

        [Test]
        [ExpectedException(typeof(ValueResolutionException))]
        public void UnexistedPropery()
        {
            var container = new Container();

            var setter = new Setter();
            setter.Set(container,"Unexisted",6000);


        }

        [Test]
        public void ShortToInt()
        {
            var f = typeof(Int32).IsAssignableFrom(typeof(Int16));
            ;
            var container = new Container();

            var setter = new Setter();
            
            setter.Set(container, "Width", (short)45);

            Assert.AreEqual(45, container.Width);

            

        }

        [Test]
        public void IntToDecimal()
        {
            var container = new Container();

            var setter = new Setter();

            setter.Set(container, "Decimal", (int)45);

            Assert.AreEqual(45, container.Decimal);



        }


        [Test]
        public void DoubleToDecimal()
        {
            var container = new Container();

            var setter = new Setter();

            setter.Set(container, "Decimal", (double)45.7);

            Assert.AreEqual(45.7, container.Decimal);



        }



        [Test]
        public void IntToSort()
        {
            var f = typeof(Int32).IsAssignableFrom(typeof(Int16));
            ;
            var container = new Container();

            var setter = new Setter();

            setter.Set(container, "Short", (int)45);

            Assert.AreEqual(45, container.Short);

        }


        [Test]
        public void IntToIntNullable()
        {
            var f = typeof(Int32).IsAssignableFrom(typeof(Int16));
            ;
            var container = new Container();

            var setter = new Setter();

            setter.Set(container, "IntNullable", (int)45);

            Assert.AreEqual(45, container.IntNullable.Value);

        }


        private void SetDataContext(object target, XmlPropertySetter setter, object dataContext, bool useContext)
        {
            if (useContext)
                target.SetDataContext(dataContext);
            else
                XmlPropertySetter.AddBinding(setter, target, AttachedMemberConstants.DataContext, DataContext, false);
        }

namespace Elders.Hystrix.NET.Test
{
    using System;
    using Elders.Hystrix.NET;

    internal class MockingHystrixCommandProperties : IHystrixCommandProperties
    {
        private readonly HystrixCommandPropertiesSetter setter;

        public MockingHystrixCommandProperties(HystrixCommandPropertiesSetter setter)
        {
            if (setter == null)
                throw new ArgumentNullException("setter");

            this.setter = setter;
        }

        public IHystrixProperty<bool> CircuitBreakerEnabled
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.CircuitBreakerEnabled.Value); }
        }
        public IHystrixProperty<int> CircuitBreakerErrorThresholdPercentage
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.CircuitBreakerErrorThresholdPercentage.Value); }
        }
        public IHystrixProperty<bool> CircuitBreakerForceClosed
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.CircuitBreakerForceClosed.Value); }
        }
        public IHystrixProperty<bool> CircuitBreakerForceOpen
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.CircuitBreakerForceOpen.Value); }
        }
        public IHystrixProperty<int> CircuitBreakerRequestVolumeThreshold
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.CircuitBreakerRequestVolumeThreshold.Value); }
        }
        public IHystrixProperty<TimeSpan> CircuitBreakerSleepWindow
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.CircuitBreakerSleepWindow.Value); }
        }
        public IHystrixProperty<int> ExecutionIsolationSemaphoreMaxConcurrentRequests
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.ExecutionIsolationSemaphoreMaxConcurrentRequests.Value); }
        }
        public IHystrixProperty<ExecutionIsolationStrategy> ExecutionIsolationStrategy
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.ExecutionIsolationStrategy.Value); }
        }
        public IHystrixProperty<bool> ExecutionIsolationThreadInterruptOnTimeout
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.ExecutionIsolationThreadInterruptOnTimeout.Value); }
        }
        public IHystrixProperty<string> ExecutionIsolationThreadPoolKeyOverride
        {
            get { return HystrixPropertyFactory.NullProperty<string>(); }
        }
        public IHystrixProperty<TimeSpan> ExecutionIsolationThreadTimeout
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.ExecutionIsolationThreadTimeout.Value); }
        }
        public IHystrixProperty<int> FallbackIsolationSemaphoreMaxConcurrentRequests
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.FallbackIsolationSemaphoreMaxConcurrentRequests.Value); }
        }
        public IHystrixProperty<bool> FallbackEnabled
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.FallbackEnabled.Value); }
        }
        public IHystrixProperty<TimeSpan> MetricsHealthSnapshotInterval
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.MetricsHealthSnapshotInterval.Value); }
        }
        public IHystrixProperty<int> MetricsRollingPercentileBucketSize
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.MetricsRollingPercentileBucketSize.Value); }
        }
        public IHystrixProperty<bool> MetricsRollingPercentileEnabled
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.MetricsRollingPercentileEnabled.Value); }
        }
        public IHystrixProperty<int> MetricsRollingPercentileWindowInMilliseconds
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.MetricsRollingPercentileWindowInMilliseconds.Value); }
        }
        public IHystrixProperty<int> MetricsRollingPercentileWindowBuckets
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.MetricsRollingPercentileWindowBuckets.Value); }
        }
        public IHystrixProperty<int> MetricsRollingStatisticalWindowInMilliseconds
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.MetricsRollingStatisticalWindowInMilliseconds.Value); }
        }
        public IHystrixProperty<int> MetricsRollingStatisticalWindowBuckets
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.MetricsRollingStatisticalWindowBuckets.Value); }
        }
        public IHystrixProperty<bool> RequestCacheEnabled
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.RequestCacheEnabled.Value); }
        }
        public IHystrixProperty<bool> RequestLogEnabled
        {
            get { return HystrixPropertyFactory.AsProperty(this.setter.RequestLogEnabled.Value); }
        }
    }
}


        /// <summary>
        /// If the target state is of type <see cref="ExtendedVisualState"/>,
        /// checks the state for setters and applies them to the targets.
        /// </summary>
        /// <returns>
        /// true if the target state was of type <see cref="ExtendedVisualState"/>;
        /// false if not.
        /// </returns>
        protected override bool GoToStateCore()
        {
            RemovePreviousStateSetters();
            ApplyCurrentStateSetters();

            return true;
        }

        private void RemovePreviousStateSetters()
        {
            if (ExtendedFromState == null) return;

            foreach (SetterBase setterBase in ExtendedFromState.Setters)
            {
                if (IsValidSetter(setterBase))
                {
                    RemoveSetter((Setter)setterBase);
                }
            }
        }

        private void RemoveSetter(Setter setter)
        {
            // InvalidateProperty forces the previously changed property to be 
            // re-evaluated. This resets any previous changes.
            DependencyObject setterTarget = FindSetterTarget(setter);
            if (setterTarget != null)
            {
                if (setter.Value is Binding)
                {
                    BindingOperations.ClearBinding(setterTarget, setter.Property);
                }
                else
                {
                    // A normal .NET value can simply be invalidated. The DP remembers the previous
                    // value.
                    setterTarget.InvalidateProperty(setter.Property);
                }

                VisualStateSource.Verbose(
                    "Removed visual state setter for property {0} from element {1}.",
                    setter.Property.Name,
                    setterTarget);
            }
        }

        private void ApplyCurrentStateSetters()
        {
            if (ExtendedToState == null) return;

            foreach (SetterBase setterBase in ExtendedToState.Setters)
            {
                if (IsValidSetter(setterBase))
                {
                    ApplySetter((Setter)setterBase);
                }
            }
        }

        private void ApplySetter(Setter setter)
        {
            DependencyObject setterTarget = FindSetterTarget(setter);
            if (setterTarget != null)
            {
                if (setter.Value is Binding binding)
                {
                    BindingOperations.SetBinding(setterTarget, setter.Property, binding);
                }
                else
                {
                    // We are dealing with a "normal" .NET property value.
                    //
                    // SetCurrentValue doesn't change the property source, but changes the value until
                    // reset.
                    // This is ideal, as long as we reset the property again 
                    // (which is done in the RemoveSetter method(s)).
                    setterTarget.SetCurrentValue(setter.Property, setter.Value);
                }

                VisualStateSource.Verbose(
                    "Setting property {0} to {1} on element {2}.",
                    setter.Property.Name,
                    setter.Value,
                    setterTarget);
            }
        }

        private DependencyObject FindSetterTarget(Setter setter)
        {
            // If no target name is specified, the setter referes (by convention) to the control.
            if (string.IsNullOrEmpty(setter.TargetName))
                return Control;

            // Try to locate the target in the template part, or in the control itself.
            var target = StateGroupsRoot.FindName(setter.TargetName) as DependencyObject ??
                         Control.FindName(setter.TargetName) as DependencyObject;

            if (target == null)
            {
                VisualStateSource.Warn(
                    "Couldn't find the visual state setter target \"{0}\".", setter.TargetName);
            }

            return target;
        }