From ca47896204482bf4a6979e3838bf7f09f61cebeb Mon Sep 17 00:00:00 2001
From: giy <giy@omp-system.ru>
Date: Fri, 02 Sep 2022 14:16:56 +0300
Subject: [PATCH] Обновление до версии 2.9.0

---
 QtVsTools.Core/MainWinWrapper.cs |   20 ++++----------------
 1 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/QtVsTools.Core/MainWinWrapper.cs b/QtVsTools.Core/MainWinWrapper.cs
index f42ca31..2da7105 100644
--- a/QtVsTools.Core/MainWinWrapper.cs
+++ b/QtVsTools.Core/MainWinWrapper.cs
@@ -28,30 +28,18 @@
 
 using System;
 using System.Windows.Forms;
+using Microsoft.VisualStudio.Shell;
 
 namespace QtVsTools.Core
 {
     public class MainWinWrapper : IWin32Window
     {
-        private readonly EnvDTE.DTE dteObject;
+        public IntPtr Handle { get; }
 
         public MainWinWrapper(EnvDTE.DTE dte)
         {
-            dteObject = dte;
-        }
-
-        public IntPtr Handle
-        {
-            get
-            {
-                if (dteObject != null)
-#if VS2022
-                    return dteObject.MainWindow.HWnd;
-#else
-                    return new IntPtr(dteObject.MainWindow.HWnd);
-#endif
-                return new IntPtr(0);
-            }
+            ThreadHelper.ThrowIfNotOnUIThread();
+            Handle = new IntPtr((long)dte.MainWindow.HWnd);
         }
     }
 }

--
Gitblit v1.9.1