Example #1
0
        /// <summary>
        /// Executed when the set accessor successfully completes. Raises the
        /// <see cref="INotifyCollectionChanged.CollectionChanged"/> event.
        /// </summary>
        /// <param name="eventArgs">Event arguments with information about the
        /// current execution context.</param>
        public override void OnSuccess(MethodExecutionEventArgs eventArgs)
        {
            this.eventArgs = eventArgs;

/*
 *          string credentialsString = eventArgs.InstanceCredentials.ToString();
 */

            implementation =
                (IFireCollectionChanged)
                ((IComposed <INotifyCollectionChanged>)eventArgs.Instance).GetImplementation(
                    eventArgs.InstanceCredentials);

/*
 *          object arg = this.eventArgs.GetReadOnlyArgumentArray()[0];
 */

            if (logging)
            {
/*
 *              log.DebugFormat("Firing an event on property '{0}' set for: {1}, credentials {2}", propertyName,
 *                              eventArgs.Instance.GetType().Name, credentialsString);
 */
            }

            lock (implementation)
            {
                // manage subscription to childobjects that are notifiable
                //if (oldValue is INotifyCollectionChanged)
                //{
                //    implementation.Unsubscribe(oldValue as INotifyCollectionChanged);
                //}

                //if (arg is INotifyCollectionChanged)
                //{
                //    implementation.Subscribe(arg as INotifyCollectionChanged);
                //}

                //todo this should be moved to another onmethodboundary aspect for
                //adding and removing list items.
                //implementation.OnCollectionChanged((NotifyCollectionChangedAction) oldValue, newValue);
                // Raises the CollectionChanged event.
            }
        }
        /// <summary>
        /// Executed when the set accessor successfully completes. Raises the 
        /// <see cref="INotifyCollectionChanged.CollectionChanged"/> event.
        /// </summary>
        /// <param name="eventArgs">Event arguments with information about the 
        /// current execution context.</param>
        public override void OnSuccess(MethodExecutionEventArgs eventArgs)
        {
            this.eventArgs = eventArgs;
/*
            string credentialsString = eventArgs.InstanceCredentials.ToString();
*/

            implementation =
                (IFireCollectionChanged)
                ((IComposed<INotifyCollectionChanged>) eventArgs.Instance).GetImplementation(
                    eventArgs.InstanceCredentials);

/*
            object arg = this.eventArgs.GetReadOnlyArgumentArray()[0];
*/

            if (logging)
            {
/*
                log.DebugFormat("Firing an event on property '{0}' set for: {1}, credentials {2}", propertyName,
                                eventArgs.Instance.GetType().Name, credentialsString);
*/
            }

            lock (implementation)
            {
                // manage subscription to childobjects that are notifiable
                //if (oldValue is INotifyCollectionChanged)
                //{
                //    implementation.Unsubscribe(oldValue as INotifyCollectionChanged);
                //}

                //if (arg is INotifyCollectionChanged)
                //{
                //    implementation.Subscribe(arg as INotifyCollectionChanged);
                //}

                //todo this should be moved to another onmethodboundary aspect for
                //adding and removing list items.
                //implementation.OnCollectionChanged((NotifyCollectionChangedAction) oldValue, newValue);
                // Raises the CollectionChanged event.
            }
        }