Exemplo n.º 1
0
        public void Dispose()
        {
            switch (ChangeType)
            {
            case MODIFICATION_TYPE.ADDED:
                if (_State == MODIFICATION_STATE.FOR_REDO)
                {
                    Control.Dispose();
                }
                break;

            case MODIFICATION_TYPE.PROPERTY_CHANGED:
                var d = OldValue as IDisposable;
                if (d != null)
                {
                    d.Dispose();
                }
                break;

            case MODIFICATION_TYPE.REMOVED:
                if (_State == MODIFICATION_STATE.FOR_UNDO)
                {
                    Control.Dispose();
                }
                break;

            case MODIFICATION_TYPE.RESIZED:
            case MODIFICATION_TYPE.MOVED:
                break;

            default:
                throw new InvalidOperationException();
            }
        }