Пример #1
0
        public CollectionProxy(string appId,decimal? value,decimal? offset)
        {
            AppId = appId;
            Value = value;
            Offset = offset;

            _original=new CollectionProxy()
                          {
                              AppId = appId,
                              Value = value,
                              Offset = offset
                          };
        }
        private ICollectionProxy CreateCollectionObservable(IObservableCollection observableCollection)
        {
            ICollectionProxy collectionProxy = CollectionProxy.Create(
                observableCollection,
                proxyWrapper,
                proxyFactory,
                observableFactory);

            foreach (var subscriber in subscribers)
            {
                collectionProxy.Subscribe(subscriber);
            }

            return(collectionProxy);
        }
        private void Initialize()
        {
            var observedProperties  = ObservableProperty.GetObservedProperties();
            var observedCollections = ObservableProperty.GetObservedCollections();

            foreach (var observedProperty in observedProperties)
            {
                IObservableProperty observableProperty = observedProperty.Value;
                runtimeProxies[observedProperty.Key] = (IRuntimeProxy)RuntimeProxyManagerHelper.CreateRuntimeManager(observableProperty, null, IsReadOnly).Implementation;
            }

            foreach (var observedCollection in observedCollections)
            {
                collectionProxies[observedCollection.Key] = CollectionProxy.Create(
                    observedCollection.Value,
                    proxyWrapper,
                    proxyFactory,
                    observableFactory);
            }
        }
 /// <summary>
 /// Retrieve the target collection wrapped in <paramref name="proxies"/>.
 /// </summary>
 /// <typeparam name="T">
 /// Type of the collection elements.
 /// </typeparam>
 /// <param name="proxies">
 /// An proxy collection returned by <see cref="GetProxy{T}(ICollection{T})"/>.
 /// </param>
 /// <returns>
 /// The target collection instance wrapped by <paramref name="proxies"/>,
 /// or <paramref name="proxies"/> itself if it is actually not a proxy.
 /// </returns>
 public static ICollection <T> GetTarget <T>(ICollection <T> proxies)
     where T : class
 {
     return(CollectionProxy <T> .GetTarget(proxies));
 }
 /// <summary>
 /// Get a collection of proxies of the given <paramref name="targets"/>.
 /// </summary>
 /// <typeparam name="T">
 /// Type of the collection elements.
 /// </typeparam>
 /// <param name="targets">
 /// A collection of original target objects.
 /// </param>
 /// <returns>
 /// A collection of proxies of targets or targets itself if it is already
 /// a collection of others.
 /// </returns>
 public static ICollection <T> GetProxy <T>(ICollection <T> targets)
     where T : class
 {
     return(CollectionProxy <T> .GetProxy(targets));
 }