aboutsummaryrefslogtreecommitdiffstats
path: root/QtVsTools.Wizards/Util/VCLanguageManagerValidationRule.cs
blob: 184fd68bd6c5aca8761e3c3306f8b2dec45280e3 (plain)
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
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

using System.Windows.Controls;
using EnvDTE;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.VCCodeModel;

namespace QtVsTools.Wizards.Util
{
    using VisualStudio;

    internal abstract class VCLanguageManagerValidationRule : ValidationRule
    {
        protected VCLanguageManagerValidationRule()
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            ValidatesOnTargetUpdated = true;

            if (VsServiceProvider.GetService<DTE>() is { } dte)
                Vclm = dte.GetObject("VCLanguageManager") as VCLanguageManager;
        }

        public string FileExt { get; set; }
        protected VCLanguageManager Vclm { get; }
    }
}