Ejemplo n.º 1
0
        private static void JsonToClassification(JProperty item, ClassificationColors classification)
        {
            JObject value      = item.Value as JObject;
            var     foreground = value["foreground"];

            if (foreground != null)
            {
                classification.Foreground = ColorFromHtml(foreground.Value <String>());
            }
            var background = value["background"];

            if (background != null)
            {
                classification.Background = ColorFromHtml(background.Value <String>());
            }
            var style = value["style"];

            if (style != null)
            {
                FontStyles parsedStyle;
                if (Enum.TryParse <FontStyles>(style.Value <String>(), out parsedStyle))
                {
                    classification.Style = parsedStyle;
                }
            }
        }
Ejemplo n.º 2
0
        public void Load(params String[] classificationNames)
        {
            classifications.Clear();

              Guid category = new Guid(FontsAndColorsCategories.TextEditorCategory);
              uint flags = (uint)(__FCSTORAGEFLAGS.FCSF_LOADDEFAULTS
                        | __FCSTORAGEFLAGS.FCSF_NOAUTOCOLORS
                        | __FCSTORAGEFLAGS.FCSF_READONLY);
              var hr = storage.Storage.OpenCategory(ref category, flags);
              ErrorHandler.ThrowOnFailure(hr);

              try {
            foreach ( var classification in classificationNames ) {
              var colors = new ClassificationColors(classification);
              colors.Load(storage);
              classifications.Add(classification, colors);
            }
              } finally {
            storage.Storage.CloseCategory();
              }
        }
Ejemplo n.º 3
0
        public void Load(params String[] classificationNames)
        {
            classifications.Clear();

            Guid category = new Guid(FontsAndColorsCategories.TextEditorCategory);
            uint flags    = (uint)(__FCSTORAGEFLAGS.FCSF_LOADDEFAULTS
                                   | __FCSTORAGEFLAGS.FCSF_READONLY);
            var hr = storage.Storage.OpenCategory(ref category, flags);

            ErrorHandler.ThrowOnFailure(hr);

            try {
                foreach (var classification in classificationNames)
                {
                    var colors = new ClassificationColors(classification);
                    colors.Load(storage);
                    classifications.Add(classification, colors);
                }
            } finally {
                storage.Storage.CloseCategory();
            }
        }