void OnBatchUpdateStarted(BatchStartedEventArgs e)
 {
     if (BatchUpdateStarted != null)
     {
         BatchUpdateStarted(this, e);
     }
 }
        private BatchStartedEventArgs BatchRefresh()
        {
            BatchStartedEventArgs ba = new BatchStartedEventArgs(ThreadedWaitService);

            OnBatchUpdateStarted(ba);
            ba.Disposers += _pendingChanges.BatchUpdate().Dispose;
            return(ba);
        }
        private void SvnSccProvider_BatchUpdateStarted(object sender, BatchStartedEventArgs e)
        {
            e.Disposers += delegate
            {
                int n = GetService <IPendingChangesManager>().PendingChanges.Count;

                if (n != _lastPcCount)
                {
                    _lastPcCount = n;
                    RaisePropertyChanged("PendingChangeCount");
                }
            };
        }
        internal void OnTickRefresh()
        {
            List <string> toRefresh;
            bool          fullRefresh;

            lock (_toRefresh)
            {
                _refreshScheduled = false;

                if (_fullRefresh)
                {
                    fullRefresh = true;
                    toRefresh   = null;
                }
                else
                {
                    fullRefresh = false;
                    toRefresh   = new List <string>(_toRefresh);
                }
                _toRefresh.Clear();
                _fullRefresh = false;

                _extraFiles.UniqueAddRange(_toMonitor);
                _toMonitor.Clear();
            }

            if (fullRefresh)
            {
                InnerRefresh();
            }
            else
            {
                using (BatchStartedEventArgs br = SmartRefresh(toRefresh.Count))
                {
                    foreach (string path in toRefresh)
                    {
                        if (br != null)
                        {
                            br.Tick();
                        }
                        ItemRefresh(path);
                    }
                }
            }
        }
        void InnerRefresh()
        {
            using (BatchStartedEventArgs br = BatchRefresh())
            {
                HybridCollection <string> mapped = new HybridCollection <string>(StringComparer.OrdinalIgnoreCase);

                ISvnStatusCache cache = Cache;

                foreach (string file in Mapper.GetAllFilesOfAllProjects())
                {
                    br.Tick();
                    _extraFiles.Remove(file); // If we find it here; it is no longer 'extra'!

                    SvnItem item = cache[file];

                    if (item == null)
                    {
                        continue;
                    }

                    PendingChange pc = UpdatePendingChange(item);

                    if (pc != null)
                    {
                        mapped.Add(pc.FullPath);
                    }
                }

                foreach (string file in new List <string>(_extraFiles))
                {
                    br.Tick();
                    SvnItem item = cache[file];

                    if (item == null)
                    {
                        _extraFiles.Remove(file);
                        continue;
                    }

                    PendingChange pc = UpdatePendingChange(item);

                    if (pc != null)
                    {
                        mapped.Add(pc.FullPath);
                    }
                    else
                    {
                        _extraFiles.Remove(file);
                    }
                }

                for (int i = 0; i < _pendingChanges.Count; i++)
                {
                    br.Tick();
                    PendingChange pc = _pendingChanges[i];

                    if (mapped.Contains(pc.FullPath))
                    {
                        continue;
                    }

                    _pendingChanges.RemoveAt(i--);
                }
            }
        }