コード例 #1
0
        public void Refresh(ILookup <string, string> definitionNames)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            try
            {
                IsUpdating = true;

                (PlainTextForeground, PlainTextBackground) = FontsAndColorsHelper.GetPlainTextColors();
                var infos = FontsAndColorsHelper.GetTextEditorInfos()
                            .ToImmutableDictionary(
                    kvp => kvp.Key,
                    kvp => kvp.Value
                    .Where(info => definitionNames.Contains(info.bstrName))
                    .ToImmutableDictionary(info => info.bstrName));

                foreach (var item in GridItems.Where(item => definitionNames.Contains(item.DefinitionName)))
                {
                    FontsAndColorsHelper.RefreshClassificationItem(item, infos[item.Category][item.DefinitionName]);
                }
            }
            finally
            {
                IsUpdating = false;
            }
        }
コード例 #2
0
        public ClassificationProvider()
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            ClassificationNameMap = ClassificationHelpers.GetClassificationNameMap();
            (PlainTextForeground, PlainTextBackground) = FontsAndColorsHelper.GetPlainTextColors();
            var infos = FontsAndColorsHelper.GetTextEditorInfos();

            GridItems = infos.Keys
                        .SelectMany(category => infos[category].Select(info => FontsAndColorsHelper.TryGetClassificationItemForInfo(category, info)))
                        .OfType <ClassificationGridItem>()
                        .ToImmutableArray();
        }