Exemple #1
0
        public void Dispose()
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            _activeWindowTracker?.Dispose();
            _activeWindowTracker = null;
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindowControl"/> class.
        /// </summary>
        public MainWindowControl()
        {
            DataContext = _viewModel = new MainWindowControlViewModel();
            InitializeComponent();

            _activeWindowTracker = new ActiveWindowTracker();
            _activeWindowTracker.PropertyChanged += ActiveWindowPropertyChanged;

            var editorFormatMapService = VSServiceHelpers.GetMefExport <IEditorFormatMapService>();
            var editorFormatMap        = editorFormatMapService.GetEditorFormatMap("text");

            editorFormatMap.FormatMappingChanged += (object s, FormatItemsEventArgs e) => UpdateClassifications(e.ChangedItems);

            void UpdateClassifications(ReadOnlyCollection <string> definitionNames)
            {
                _viewModel.OnThemeChanged(definitionNames.ToLookup(name => name));
            }
        }