NamingRuleTreeItemViewModel.TreeDisplayItem.cs 1.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System.Windows;
using Microsoft.Internal.VisualStudio.PlatformUI;
using Microsoft.VisualStudio.Imaging;
using Microsoft.VisualStudio.Imaging.Interop;

namespace Microsoft.VisualStudio.LanguageServices.Implementation.Options.Style.NamingPreferences
{
    partial class NamingRuleTreeItemViewModel : ITreeDisplayItemWithImages
    {
        public ImageMoniker ExpandedIconMoniker => GetMoniker();

        public FontStyle FontStyle => FontStyles.Normal;

        public FontWeight FontWeight => FontWeights.Normal;

        public ImageMoniker IconMoniker => GetMoniker();

        public bool IsCut => false;

        public ImageMoniker OverlayIconMoniker => default(ImageMoniker);

        public ImageMoniker StateIconMoniker => default(ImageMoniker);

        public string StateToolTipText => null;

        public string Text => Title;

        public object ToolTipContent => null;

        public string ToolTipText => null;

        private ImageMoniker GetMoniker()
        {
            if (EnforcementLevel == null)
            {
                return KnownMonikers.FolderOpened;
            }

            switch (EnforcementLevel.Value)
            {
                case CodeAnalysis.DiagnosticSeverity.Hidden:
                    return KnownMonikers.None;
                case CodeAnalysis.DiagnosticSeverity.Info:
                    return KnownMonikers.StatusInformation;
                case CodeAnalysis.DiagnosticSeverity.Warning:
                    return KnownMonikers.StatusWarning;
                case CodeAnalysis.DiagnosticSeverity.Error:
                    return KnownMonikers.StatusError;
                default:
                    break;
            }

            return KnownMonikers.Rule;
        }
    }
}