aboutsummaryrefslogtreecommitdiffstats
path: root/QtVsTools.Wizards/Util/VCLanguageManagerValidationRule.cs
blob: 563cb24813fccd471f6798a3b531af9002625c8b (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
29
30
/***************************************************************************************************
 Copyright (C) 2024 The Qt Company Ltd.
 SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
***************************************************************************************************/

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

namespace QtVsTools.Wizards.Util
{
    using VisualStudio;

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

            ValidatesOnTargetUpdated = true;

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

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