Beispiel #1
0
        [FriendAccessAllowed] // Built into Core, also used by Framework. 
        internal void RemoveLoadedOrUnloadedCallback(LoadedOrUnloadedOperation op)
        {
            Debug.Assert(op != null);
 
            // cancel the operation - this prevents it from running even if it has
            // already been copied into the local array in FireLoadedPendingCallbacks 
            op.Cancel(); 

            if (_loadedOrUnloadedPendingOperations != null) 
            {
                for (int i=0; i<_loadedOrUnloadedPendingOperations.Count; i++)
                {
                    LoadedOrUnloadedOperation operation = _loadedOrUnloadedPendingOperations[i]; 
                    if (operation == op)
                    { 
                        _loadedOrUnloadedPendingOperations.RemoveAt(i); 
                        break;
                    } 
                }
            }
        }
Beispiel #2
0
        [FriendAccessAllowed] // Built into Core, also used by Framework. 
        internal LoadedOrUnloadedOperation AddLoadedOrUnloadedCallback(
            DispatcherOperationCallback callback, 
            DependencyObject target)
        {
            LoadedOrUnloadedOperation op = new LoadedOrUnloadedOperation(callback, target);
 
            if (_loadedOrUnloadedPendingOperations == null)
            { 
                _loadedOrUnloadedPendingOperations = new FrugalObjectList<LoadedOrUnloadedOperation>(1); 
            }
 
            _loadedOrUnloadedPendingOperations.Add(op);

            return op;
        }