Пример #1
0
        internal RainbowProvider(
            ITextBuffer buffer,
            RainbowTaggerProvider provider)
        {
            this.TextBuffer      = buffer;
            this.Registry        = provider.ClassificationRegistry;
            this.LanguageFactory = provider.LanguageFactory;
            this.Settings        = provider.Settings;
            this.ColorTagger     = new RainbowColorTagger(this);

            SetLanguage(buffer.CurrentSnapshot);

            this.updatePendingFrom              = -1;
            this.TextBuffer.ChangedLowPriority += this.BufferChanged;
            this.TextBuffer.ContentTypeChanged += this.ContentTypeChanged;
            this.Dispatcher = Dispatcher.CurrentDispatcher;
            VsfSettingsEventManager.AddListener(this.Settings, this);

            UpdateBraceList(new SnapshotPoint(buffer.CurrentSnapshot, 0));
        }
Пример #2
0
 private void UnsubscribeFromEvents()
 {
     if (TextBuffer != null)
     {
         // ensure that we remove the property so that
         // next time we create a new provider
         TextBuffer.Properties.RemoveProperty(GetType());
         TextBuffer.ChangedLowPriority -= this.BufferChanged;
         TextBuffer.ContentTypeChanged -= this.ContentTypeChanged;
         TextBuffer = null;
     }
     this.Dispatcher = null;
     if (this.dispatcherTimer != null)
     {
         this.dispatcherTimer.Stop();
         this.dispatcherTimer = null;
     }
     if (Settings != null)
     {
         VsfSettingsEventManager.RemoveListener(this.Settings, this);
         Settings = null;
     }
 }