예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FormattingViewModel" /> class.
        /// </summary>
        /// <param name="package">The hosting package.</param>
        /// <param name="activeSettings">The active settings.</param>
        public FormattingViewModel(CodeMaidPackage package, Settings activeSettings)
            : base(package, activeSettings)
        {
            Mappings = new SettingsToOptionsList(ActiveSettings, this)
            {
                new SettingToOptionMapping <bool, bool>(x => ActiveSettings.Formatting_CommentRunDuringCleanup, x => CommentRunDuringCleanup),
                new SettingToOptionMapping <bool, bool>(x => ActiveSettings.Formatting_CommentSkipWrapOnLastWord, x => CommentSkipWrapOnLastWord),
                new SettingToOptionMapping <int, int>(x => ActiveSettings.Formatting_CommentWrapColumn, x => CommentWrapColumn),
                new SettingToOptionMapping <bool, bool>(x => ActiveSettings.Formatting_CommentXmlAlignParamTags, x => CommentXmlAlignParamTags),
                new SettingToOptionMapping <bool, bool>(x => ActiveSettings.Formatting_CommentXmlKeepTagsTogether, x => CommentXmlKeepTagsTogether),
                new SettingToOptionMapping <bool, bool>(x => ActiveSettings.Formatting_CommentXmlSpaceSingleTags, x => CommentXmlSpaceSingleTags),
                new SettingToOptionMapping <bool, bool>(x => ActiveSettings.Formatting_CommentXmlSpaceTags, x => CommentXmlSpaceTags),
                new SettingToOptionMapping <bool, bool>(x => ActiveSettings.Formatting_CommentXmlSplitAllTags, x => CommentXmlSplitAllTags),
                new SettingToOptionMapping <bool, bool>(x => ActiveSettings.Formatting_CommentXmlSplitSummaryTagToMultipleLines, x => CommentXmlSplitSummaryTagToMultipleLines),
                new SettingToOptionMapping <bool, bool>(x => ActiveSettings.Formatting_CommentXmlTagsToLowerCase, x => CommentXmlTagsToLowerCase),
                new SettingToOptionMapping <int, int>(x => ActiveSettings.Formatting_CommentXmlValueIndent, x => CommentXmlValueIndent)
            };

            _editorProperties = Package.IDE.Properties["FontsAndColors", "TextEditor"];
            var property            = _editorProperties.Item("FontsAndColorsItems");
            var fontsAndColorsItems = (EnvDTE.FontsAndColorsItems)property.Object;

            _commentColors = fontsAndColorsItems.Item("Comment");

            PropertyChanged += (sender, args) => UpdatePreviewText();
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FormattingViewModel" /> class.
        /// </summary>
        /// <param name="package">The hosting package.</param>
        /// <param name="activeSettings">The active settings.</param>
        public FormattingViewModel(CodeMaidPackage package, Settings activeSettings)
            : base(package, activeSettings)
        {
            Mappings = new SettingsToOptionsList(ActiveSettings, this)
            {
                new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Formatting_CommentRunDuringCleanup, x => CommentRunDuringCleanup),
                new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Formatting_CommentSkipWrapOnLastWord, x => CommentSkipWrapOnLastWord),
                new SettingToOptionMapping<int, int>(x => ActiveSettings.Formatting_CommentWrapColumn, x => CommentWrapColumn),
                new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Formatting_CommentXmlAlignParamTags, x => CommentXmlAlignParamTags),
                new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Formatting_CommentXmlKeepTagsTogether, x => CommentXmlKeepTagsTogether),
                new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Formatting_CommentXmlSpaceSingleTags, x => CommentXmlSpaceSingleTags),
                new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Formatting_CommentXmlSpaceTags, x => CommentXmlSpaceTags),
                new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Formatting_CommentXmlSplitAllTags, x => CommentXmlSplitAllTags),
                new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Formatting_CommentXmlSplitSummaryTagToMultipleLines, x => CommentXmlSplitSummaryTagToMultipleLines),
                new SettingToOptionMapping<bool, bool>(x => ActiveSettings.Formatting_CommentXmlTagsToLowerCase, x => CommentXmlTagsToLowerCase),
                new SettingToOptionMapping<int, int>(x => ActiveSettings.Formatting_CommentXmlValueIndent, x => CommentXmlValueIndent)
            };

            _editorProperties = Package.IDE.Properties["FontsAndColors", "TextEditor"];
            var property = _editorProperties.Item("FontsAndColorsItems");
            var fontsAndColorsItems = (EnvDTE.FontsAndColorsItems)property.Object;
            _commentColors = fontsAndColorsItems.Item("Comment");

            PropertyChanged += (sender, args) => UpdatePreviewText();
        }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FormattingViewModel" /> class.
 /// </summary>
 /// <param name="package">The hosting package.</param>
 public FormattingViewModel(CodeMaidPackage package)
     : base(package)
 {
     _editorProperties = Package.IDE.Properties["FontsAndColors", "TextEditor"];
     var property = _editorProperties.Item("FontsAndColorsItems");
     var fontsAndColorsItems = (EnvDTE.FontsAndColorsItems)property.Object;
     _commentColors = fontsAndColorsItems.Item("Comment");
 }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FormattingViewModel" /> class.
        /// </summary>
        /// <param name="package">The hosting package.</param>
        public FormattingViewModel(CodeMaidPackage package)
            : base(package)
        {
            _editorProperties = Package.IDE.Properties["FontsAndColors", "TextEditor"];
            var property            = _editorProperties.Item("FontsAndColorsItems");
            var fontsAndColorsItems = (EnvDTE.FontsAndColorsItems)property.Object;

            _commentColors = fontsAndColorsItems.Item("Comment");

            PropertyChanged += (sender, args) => UpdatePreviewText();
        }
 private static HighlightingColor CreateColor(string name, EnvDTE.ColorableItems foreground, EnvDTE.ColorableItems background)
 {
     return(new HighlightingColor()
     {
         Name = name,
         Background = ConvertDTEColor(background.Background),
         Foreground = ConvertDTEColor(foreground.Foreground),
         FontStyle = FontStyles.Normal,
         FontWeight = foreground.Bold ? FontWeights.Bold : FontWeights.Normal,
         Underline = false,
     });
 }
 private static HighlightingColor CreateColor(string name, EnvDTE.ColorableItems colorableItems)
 {
     return(CreateColor(name, colorableItems, colorableItems));
 }