Ejemplo n.º 1
0
        /// <summary>
        ///     Releases unmanaged and - optionally - managed resources
        /// </summary>
        /// <param name="disposing">
        ///     <c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.
        /// </param>
        /// <returns>
        ///     <c>true</c> if operation is allowed
        /// </returns>
        protected virtual bool Dispose(bool disposing)
        {
            if (IsDisposed || !disposing)
            {
                return(false);
            }
            IsDisposed = true;

            if (_propertyChangedHandlers != null)
            {
                _propertyChangedHandlers.Dispose();
                _propertyChangedHandlers = null;
            }

            if (_propertyChangingHandlers != null)
            {
                _propertyChangingHandlers.Dispose();
                _propertyChangingHandlers = null;
            }

            _id = null;

#if !UNITY3D
            Debug.WriteLine(string.Format("Dispose {0}", GetType()));
#else
            Debug.Log(string.Format("Dispose {0}", GetType()));
#endif

            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Releases unmanaged and - optionally - managed resources
        /// </summary>
        /// <param name="disposing">
        ///     <c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.
        /// </param>
        /// <returns></returns>
        protected override bool Dispose(bool disposing)
        {
            if (!disposing)
            {
                return(false);
            }

            _isActive = false;

            if (_canExecuteMethod != null)
            {
                _canExecuteMethod.Dispose();
                _canExecuteMethod = null;
            }

            if (_executeMethod != null)
            {
                _executeMethod.Dispose();
                _executeMethod = null;
            }

            if (_isActiveChangedHandlers != null)
            {
                _isActiveChangedHandlers.Dispose();
                _isActiveChangedHandlers = null;
            }

            if (_canExecuteChangedHandlers != null)
            {
                _canExecuteChangedHandlers.Dispose();
                _canExecuteChangedHandlers = null;
            }
            return(base.Dispose(true));
        }
Ejemplo n.º 3
0
 /// <summary>
 ///     Gets the property changing handlers.
 /// </summary>
 /// <returns></returns>
 private WeakDelegatesManager GetPropertyChangingHandlers()
 {
     return(_propertyChangingHandlers ?? (_propertyChangingHandlers = new WeakDelegatesManager()));
 }
Ejemplo n.º 4
0
 /// <summary>
 ///     Gets the is active changed handlers.
 /// </summary>
 /// <returns></returns>
 private WeakDelegatesManager GetIsActiveChangedHandlers()
 {
     return(_isActiveChangedHandlers ?? (_isActiveChangedHandlers = new WeakDelegatesManager()));
 }
Ejemplo n.º 5
0
 /// <summary>
 ///     Gets the can execute changed handlers.
 /// </summary>
 /// <returns></returns>
 private WeakDelegatesManager GetCanExecuteChangedHandlers()
 {
     return(_canExecuteChangedHandlers ?? (_canExecuteChangedHandlers = new WeakDelegatesManager()));
 }