public void Clear()
        {
            lock (SyncRoot)
                Graph.Clear();

            Cleared?.Invoke(this, EventArgs.Empty);
        }
示例#2
0
        /// <summary>
        /// Removes all registered
        /// <see cref="Spring.Context.IApplicationContext"/>s from this
        /// registry.
        /// </summary>
        /// <remarks>
        /// Raises the <see cref="ContextRegistry.Cleared"/> event while still holding a lock on <see cref="ContextRegistry.SyncRoot"/>
        /// </remarks>
        public static void Clear()
        {
            lock (syncRoot)
            {
                ICollection <IApplicationContext> contexts = new List <IApplicationContext>(instance.contextMap.Values);
                foreach (IApplicationContext ctx in contexts)
                {
                    ctx.Dispose();
                }

                // contexts will be removed from contextMap during OnContextEvent handler
                // but someone might choose to override AbstractApplicationContext.Dispose() without
                // calling base.Dispose() ...
                if (log.IsEnabled(LogLevel.Warning))
                {
                    if (instance.contextMap.Count > 0)
                    {
                        log.LogWarning(
                            String.Format(
                                "Not all contexts were removed from registry during cleanup - did you forget to call base.Dispose() when overriding AbstractApplicationContext.Dispose()?"));
                    }
                }

                instance.contextMap.Clear();
                ConfigurationUtils.ClearCache();
                rootContextName = null;
                // mark section dirty - force re-read from disk next time
                ConfigurationUtils.RefreshSection(AbstractApplicationContext.ContextSectionName);
                DynamicCodeManager.Clear();
                Cleared?.Invoke(typeof(ContextRegistry), EventArgs.Empty);
            }
        }
示例#3
0
 //Очищение списка
 public void Clear()
 {
     first = null;
     last  = null;
     count = 0;
     Cleared.Invoke(this, EventArgs.Empty);
 }
示例#4
0
 public void Clear()
 {
     First = null;
     Last  = null;
     Count = 0;
     Cleared?.Invoke();
 }
示例#5
0
 /// <summary>
 /// Removes all nodes from the LinkedList T .
 /// </summary>
 public void Clear()
 {
     Count = 0;
     First = null;
     Last  = null;
     Cleared?.Invoke(this, new LinkedListEventArgs(true, "The LinkedList was cleared."));
 }
示例#6
0
 public void Clear()  //Удаляет все элементы
 {
     first = null;
     last  = null;
     Count = 0;
     Cleared?.Invoke();
 }
 public void RemoveWordStrip(GLRenderVxFormattedString vx)
 {
     _wordStrips.Remove(vx);
     if (_full && _wordStrips.Count == 0)
     {
         Cleared?.Invoke(this);
     }
 }
示例#8
0
 /// <summary>
 /// Raises <see cref="CollectionModified" /> and <see cref="Cleared" /> events
 /// </summary>
 /// <param name="e">An <see cref="System.EventArgs" /> that contains the event data</param>
 protected virtual void OnCleared(EventArgs e)
 {
     if (IgnoreEvents)
     {
         return;
     }
     Cleared?.Invoke(this, e);
     OnCollectionModified(new ListModificationEventArgs(ListModification.Cleared, -1, -1));
 }
示例#9
0
        protected virtual Task OnClearAsync(bool cancel = true)
        {
            downloadMap.Clear();
            Cleared?.Invoke(this);
#if NETSTANDARD2_0
            return(Task.CompletedTask);
#else
            return(Task.FromResult(true));
#endif
        }
示例#10
0
        public void Clear()
        {
            var plots = _plots.ToArray();

            _plots.Clear();

            ActiveIndex = -1;
            PlotCount   = 0;

            Cleared?.Invoke(this, new RPlotEventArgs(null));
        }
示例#11
0
 /// <summary>
 /// Clears this instance.
 /// </summary>
 public void Clear()
 {
     for (int i = 0; i < ItemsInternal.Count; ++i)
     {
         ItemsInternal[i].Detach();
         ItemsInternal[i].Parent = null;
     }
     ItemsInternal.Clear();
     itemHashSet.Clear();
     Cleared?.Invoke(this, new OnChildNodeChangedArgs(null, Operation.Clear));
 }
示例#12
0
    /// <summary>
    /// Removes the specific area.
    /// </summary>
    /// <param name="area">The area to remove.</param>
    public void Clear(RelativeAreas area)
    {
        Flush();
        var h = Handler;
        if (h != null)
        {
            h.Remove(area, context);
            Cleared?.Invoke(this, new DataEventArgs<RelativeAreas>(area));
            return;
        }

        switch (Mode)
        {
            case Modes.Cmd:
                try
                {
                    ClearInCmd(area);
                    break;
                }
                catch (IOException)
                {
                }
                catch (InvalidOperationException)
                {
                }
                catch (NotSupportedException)
                {
                }

                WriteImmediately(AnsiCodeGenerator.Clear(area));
                break;
            case Modes.Text:
                switch (area)
                {
                    case RelativeAreas.ToEndOfScreen:
                    case RelativeAreas.ToEndOfLine:
                        col.Add(new ConsoleText(" \b"));
                        break;
                    case RelativeAreas.None:
                        break;
                    default:
                        Write("\b \b");
                        break;
                }

                break;
            default:
                WriteImmediately(AnsiCodeGenerator.Clear(area));
                break;
        }

        Cleared?.Invoke(this, new DataEventArgs<RelativeAreas>(area));
    }
示例#13
0
        public void Clear()
        {
            foreach (Algorithm algorithm in instance.algorithms)
            {
                algorithm.actions.Clear();
            }

            // TODO: Нужно ли чистить????? instance = null, а в памяти весь хлам остался
            instance = null;

            Cleared?.Invoke(this, new ClearEventArgs());
        }
示例#14
0
 /// <summary>
 /// Clear all elements in this collection. This will call dispose on the
 /// elements that are in the collection.
 /// </summary>
 public virtual void clear()
 {
     foreach (CollectionType item in items)
     {
         item.Dispose();
     }
     items.Clear();
     if (Cleared != null)
     {
         Cleared.Invoke();
     }
 }
示例#15
0
 /// <summary>
 /// Dispose all open objects
 /// </summary>
 public void DisposeAllInstances()
 {
     lock (_thisLock)
     {
         // NetOffice is appending new proxies so we free them in reverse order
         while (Count > 0)
         {
             this[Count - 1].Dispose();
         }
         Cleared?.Invoke(Parent);
     }
 }
示例#16
0
        /// <inheritdoc />
        public void Clear()
        {
            if (InternalList.Count == 0)
            {
                return;
            }

            InternalList.Clear();
            IsChanged = true;

            Cleared?.Invoke(this, EventArgs.Empty);
        }
示例#17
0
        /// <summary>
        /// Clears all operations on this UndoSystem
        /// </summary>
        public void Clear()
        {
            foreach (IUndoTask task in _undoTasks)
            {
                task.Clear();
            }

            _undoTasks.Clear();

            _currentTask = 0;

            Cleared?.Invoke(this, new EventArgs());
        }
示例#18
0
        private void OnSettingsChanged(object sender, EventArgs e)
        {
            //var syntaxCheckWasEnabled = _syntaxCheckEnabled;

            // _syntaxCheckEnabled = IsSyntaxCheckEnabled(_editorTree.EditorBuffer, _settings, out _lintCheckEnabled);

            // This will clear error list so any errors that were produced
            // by validators that were turned off will go away.
            StopValidation();
            StartValidation();

            Cleared?.Invoke(this, EventArgs.Empty);
        }
示例#19
0
        /// <summary>
        /// Unlike <see cref="Drain"/>, this method just clears the queue without persisting the changes.
        /// </summary>
        public void Clear()
        {
            if (_isDraining)
            {
                throw new InvalidOperationException("Cannot Clear when Drain() is running.");
            }

            // if timer is running, wait for it to finish
            while (_isTimerRunning)
            {
                Thread.Sleep(100);
            }

            _queue.Clear();
            Cleared?.Invoke();
        }
示例#20
0
        private void OnSettingsChanged(object sender, EventArgs e)
        {
            bool syntaxCheckWasEnabled = _syntaxCheckEnabled;

            _syntaxCheckEnabled = IsSyntaxCheckEnabled(_editorTree.EditorBuffer, _settings);
            if (syntaxCheckWasEnabled && !_syntaxCheckEnabled)
            {
                StopValidation();
            }
            else if (!syntaxCheckWasEnabled && _syntaxCheckEnabled)
            {
                StartValidation();
            }

            Cleared?.Invoke(this, EventArgs.Empty);
        }
示例#21
0
        /// <summary>
        /// Execute clear event for items removed from bag.
        /// </summary>
        /// <param name="items"></param>
        private void DispatchEvents(IReadOnlyList <T> items)
        {
            if (!items.Any())
            {
                return;
            }

            try
            {
                Cleared?.Invoke(items);
            }
            catch
            {
                EnqueueFailures(items);
            }
        }
        public override int Clear()
        {
            List <KeyValuePair <TKey, TValue> > pairs =
                new List <KeyValuePair <TKey, TValue> >()
            ;

            lock (lockObject)
            {
                (from pair in dictionary
                 orderby pair.Value.Created ascending
                 select pair
                )
                .Each
                    (pair =>
                {
                    TValue value = pair.Value.Value;
                    pairs.Add
                        (new KeyValuePair <TKey, TValue>
                            (CloneKey(pair.Key)
                            , CloneValue(value)
                            )
                        )
                    ;
                }
                    )
                ;
                dictionary.Clear();
                RemovedCount += pairs.Count;
                CheckThread();
            }
            if (EntryRemoved != null)
            {
                pairs.Each
                    (pair =>
                {
                    EntryRemoved(pair.Key, pair.Value);
                }
                    )
                ;
            }
            if (Cleared != null)
            {
                Cleared.Invoke();
            }
            return(0);
        }
示例#23
0
        /// <inheritdoc/>
        public void Clear()
        {
            lock (lockObject)
            {
                if (RollInProgress)
                {
                    throw new TransactionException("Unable to clear. A rollback or rollforward operation is in progress.");
                }

                foreach (var transaction in transactions)
                {
                    transaction.Interface.Freeze();
                }
                transactions.Clear();
                currentPosition = 0;
                Cleared?.Invoke(this, EventArgs.Empty);
            }
        }
        /// <summary>
        /// Clears all objects from the database.
        /// </summary>
        public static void Clear()
        {
            s_objectsLock.EnterWriteLock();
            try
            {
                s_objects.Clear();
            }
            finally
            {
                s_objectsLock.ExitWriteLock();
            }

            s_folderMappingsLock.EnterWriteLock();
            try
            {
                s_folderMappings.Clear();
            }
            finally
            {
                s_folderMappingsLock.ExitWriteLock();
            }

            s_relationshipsLock.EnterWriteLock();
            try
            {
                s_relationships.Clear();
            }
            finally
            {
                s_relationshipsLock.ExitWriteLock();
            }

            s_inverseRelationshipsLock.EnterWriteLock();
            try
            {
                s_inverseRelationships.Clear();
            }
            finally
            {
                s_inverseRelationshipsLock.ExitWriteLock();
            }

            Cleared?.Invoke(null, null);
        }
示例#25
0
        private void OnSettingsChanged(object sender, EventArgs e)
        {
            var syntaxCheckWasEnabled = _syntaxCheckEnabled;
            var lintCheckWasEnabled   = _lintCheckEnabled;

            _syntaxCheckEnabled = IsSyntaxCheckEnabled(_editorTree.EditorBuffer, _settings, out _lintCheckEnabled, out _projectedBuffer);
            _lintCheckEnabled  &= _settings.LintOptions.Enabled;

            var optionsChanged = (syntaxCheckWasEnabled ^ _syntaxCheckEnabled) ||
                                 (lintCheckWasEnabled ^ _lintCheckEnabled);

            if (optionsChanged)
            {
                // This will clear error list so any errors that were produced
                // by validators that were turned off will go away.
                StopValidation();
            }

            StartValidation(); // Checks _syntaxCheckEnabled
            Cleared?.Invoke(this, EventArgs.Empty);
        }
示例#26
0
        protected override void ClearItems()
        {
            T[] items = new T[Count];
            for (int i = 0; i < Count; i++)
            {
                if (items[i] is INotifyPropertyChanged notify)
                {
                    notify.PropertyChanged -= Item_PropertyChanged;
                }

                items[i] = this[i];
            }

            base.ClearItems();

            Cleared?.Invoke(this, new CollectionClearEventArgs <T>(items));

            for (int i = 0; i < items.Length; i++)
            {
                RemovedAny?.Invoke(this, new SingleChangeEventArgs <T>(i, items[i], SingleChangeType.Removed));
            }
        }
示例#27
0
        /// <inheritdoc />
        public void DeleteBy(SecurityLookupMessage criteria)
        {
            if (criteria.IsLookupAll())
            {
                _inner.Clear();
                Cleared?.Invoke();
                return;
            }

            Security[] toDelete;

            lock (_inner.SyncRoot)
            {
                toDelete = _inner.Values.Filter(criteria).ToArray();

                foreach (var security in toDelete)
                {
                    _inner.Remove(security.ToSecurityId());
                }
            }

            Removed?.Invoke(toDelete);
        }
示例#28
0
 public void Clear()
 {
     elements.Clear();
     objects.Clear();
     Cleared?.Invoke(this, EventArgs.Empty);
 }
 /// <summary>
 /// Raises the Cleared event.
 /// </summary>
 /// <param name="e">An EventArgs instance containing event data.</param>
 protected virtual void OnCleared(EventArgs e)
 {
     Cleared?.Invoke(this, e);
 }
示例#30
0
 /// <summary>
 /// Sends a cache cleared message.
 /// </summary>
 protected internal void TriggerCleared()
 {
     Cleared?.Invoke(this, new EventArgs());
 }