public void RemovePropertyChangedListener(CompositionObject co, string propertyName, LoggableType type)
            {
                var proxyVisual = _logger._proxyVisualsMap[new Tuple <CompositionObject, string>(co, propertyName)];

                if (proxyVisual != null)
                {
                    // Stop listending to CompositionPropertyChanged notifications on the proxy visual
                    var notifyPropertyPartner = (ICompositionNotifyPropertyChangedPartner)proxyVisual;
                    notifyPropertyPartner.SetPropertyChangedListener(ProxyPropertyInfoList[(int)type].proxyPropertyType, null);

                    // Clean up logData and proxyVisual we've used.
                    LogData logData = _logger._logDataMap[proxyVisual];

                    ((CompositionObject)proxyVisual).StopAnimation(ProxyPropertyInfoList[(int)type].proxyPropertyName);
                    _logger._logDataMap.Remove(proxyVisual);
                    _logger._proxyVisualsMap.Remove(new Tuple <CompositionObject, string>(co, propertyName));
                }
            }
 public void UnregisterProperty(CompositionObject co, string propertyName, LoggableType type)
 {
     _propertyChangedListener.RemovePropertyChangedListener(co, propertyName, type);
 }
            public ManualResetEvent AddPropertyChangedListener(CompositionObject co, string propertyName, LoggableType type, Object defaultValue, Object expectedValue, float epsilon)
            {
                Compositor myCompositior = Window.Current.Compositor;
                var        proxyVisual   = myCompositior.CreateContainerVisual();

                // Add mapping from {CO, propertyName} to unique proxyVisual
                _logger._proxyVisualsMap.Add(new Tuple <CompositionObject, string>(co, propertyName), proxyVisual);

                LogData logData = new LogData();

                logData.type             = type;
                logData.values           = new List <Object>();
                logData.defaultValue     = defaultValue;
                logData.expectedValue    = expectedValue;
                logData.gotExpectedValue = new ManualResetEvent(false);
                logData.epsilon          = epsilon;
                logData.expression       = myCompositior.CreateExpressionAnimation("MySourceObject." + propertyName);
                logData.expression.SetReferenceParameter("MySourceObject", co);
                proxyVisual.StartAnimation(ProxyPropertyInfoList[(int)type].proxyPropertyName, logData.expression);

                // Add mapping from proxyVisual to logData, which cotains values and the connecting expression
                _logger._logDataMap.Add(proxyVisual, logData);

                // Manually populate the initial default value, since otherwise we will get no notification if the value never changes from default.
                PropertyChanged(proxyVisual, 0, defaultValue);

                // Start listening to CompositionPropertyChanged notifications on the proxy visual
                ICompositionNotifyPropertyChangedPartner notifyPartner = (ICompositionNotifyPropertyChangedPartner)(object)proxyVisual;

                notifyPartner.SetPropertyChangedListener(ProxyPropertyInfoList[(int)type].proxyPropertyType, this);

                return(logData.gotExpectedValue);
            }
 public ManualResetEvent RegisterProperty(CompositionObject co, string propertyName, LoggableType type, Object defaultValue, Object expectedValue, float epsilon)
 {
     return(_propertyChangedListener.AddPropertyChangedListener(co, propertyName, type, defaultValue, expectedValue, epsilon));
 }