Beispiel #1
0
        public IDisposable __Internal_BeginEventAddMoratorium()
        {
            if (!this.eventAddAllowed)
            {
                throw new InvalidOperationException("An event add moratorium is already in effect");
            }

            List <IDisposable> propUndoFns = new List <IDisposable>(this.properties.Count);

            foreach (Property property in this.properties.Values)
            {
                IDisposable propUndoFn = property.BeginEventAddMoratorium();
                propUndoFns.Add(propUndoFn);
            }

            IDisposable undoFn = new CallbackOnDispose(() =>
            {
                this.eventAddAllowed = true;

                foreach (IDisposable propUndoFn in propUndoFns)
                {
                    propUndoFn.Dispose();
                }
            });

            this.eventAddAllowed = false;

            return(undoFn);
        }
Beispiel #2
0
 void IDisposable.Dispose()
 {
     EnumerationList = null;
     if (CallbackOnDispose != null)
     {
         CallbackOnDispose.DisposeOf(this);
     }
 }
Beispiel #3
0
        internal IDisposable BeginEventAddMoratorium()
        {
            if (!this.eventAddAllowed)
            {
                throw new InvalidOperationException("An event add moratorium is already in effect");
            }

            IDisposable undoFn = new CallbackOnDispose(() => this.eventAddAllowed = true);

            this.eventAddAllowed = false;

            return(undoFn);
        }