コード例 #1
0
        void RevisionGetter_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            // Make sure those puppies aren't used any more.
            // And, let the GC do its thing on the old thread.
            // Otherwise, we will hang onto it, until we go away.
            RevisionGetter.DoWork             -= RevisionGetter_DoWork;
            RevisionGetter.RunWorkerCompleted -= RevisionGetter_RunWorkerCompleted;

            ProgressDisplay.WriteStatus("");
            RevisionGetter.Dispose();
            RevisionGetter = null;
        }
コード例 #2
0
        /// <summary>
        /// After call this, you can check DiscoveredRevisionsQueue occasionally (lock on it)
        /// </summary>
        public void BeginGettingRevisions()
        {
            if (RevisionGetter != null)
            {
                // RevisionGetter.Dispose();//review
                return;                 // Let the poor thing do its job. Otherwise, repeated Refresh attempts will throw a null reference exception, when doing its RunWorkerCompleted event.
            }

            Guard.AgainstNull(ProgressDisplay, "ProgressDisplay");
            SanityCheck();            //review: remove?

            RevisionGetter                     = new BackgroundWorker();
            RevisionGetter.DoWork             += RevisionGetter_DoWork;
            RevisionGetter.RunWorkerCompleted += RevisionGetter_RunWorkerCompleted;
            var tip = _repository.GetTip();

            if (tip != null)
            {
                _currentTipRev = tip.Number.LocalRevisionNumber;
            }

            ProgressDisplay.WriteStatus(LocalizationManager.GetString("Messages.GettingHistory", "Getting history..."));
            RevisionGetter.RunWorkerAsync();
        }