Skip to content

Commit

Permalink
Use DpiAwarenessContext.SystemAware when creating Tool Windows. (#934)
Browse files Browse the repository at this point in the history
  • Loading branch information
lajones authored Jun 20, 2019
1 parent 3103cac commit 2e0ba78
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Text;
Expand Down Expand Up @@ -109,6 +110,7 @@ public ITextTemplatingSession CreateSession()
return new TextTemplatingSession();
}

[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
public string ProcessTemplate(string inputFile, string content, ITextTemplatingCallback callback = null)
{
Debug.Assert(!string.IsNullOrEmpty(inputFile), "inputFile is null or empty.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace Microsoft.Data.Entity.Design.Package
using Microsoft.VisualStudio.DataDesign.Interfaces;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Utilities;
using ModelChangeEventArgs = Microsoft.Data.Entity.Design.VisualStudio.Package.ModelChangeEventArgs;

[ProvideToolWindow(typeof(EntityDesignExplorerWindow),
Expand Down Expand Up @@ -478,7 +479,10 @@ public ExplorerWindow ExplorerWindow
{
if (_explorerWindow == null)
{
_explorerWindow = FindToolWindow(typeof(EntityDesignExplorerWindow), 0, true) as ExplorerWindow;
using (DpiAwareness.EnterDpiScope(DpiAwarenessContext.SystemAware))
{
_explorerWindow = FindToolWindow(typeof(EntityDesignExplorerWindow), 0, true) as ExplorerWindow;
}
}
return _explorerWindow;
}
Expand All @@ -490,7 +494,10 @@ public MappingDetailsWindow MappingDetailsWindow
{
if (_mappingDetailsWindow == null)
{
_mappingDetailsWindow = GetToolWindow(typeof(MappingDetailsWindow), true) as MappingDetailsWindow;
using (DpiAwareness.EnterDpiScope(DpiAwarenessContext.SystemAware))
{
_mappingDetailsWindow = GetToolWindow(typeof(MappingDetailsWindow), true) as MappingDetailsWindow;
}
}
return _mappingDetailsWindow;
}
Expand Down
7 changes: 7 additions & 0 deletions src/EFTools/EntityDesignPackage/EntityDesignPackage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
</PropertyGroup>
<Import Project="$(RepositoryRoot)tools\EFToolsVsReferences.settings.targets" />
<ItemGroup>
<Reference Condition="'$(VisualStudioVersion)' == '16.0'" Include="Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime, Version=14.0.0.0">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.VisualStudio.Shell.$(VisualStudioVersion15)" />
<Reference Condition="'$(VisualStudioVersion)' == '16.0'" Include="Microsoft.VisualStudio.Shell.Framework" />
<Reference Include="Microsoft.VisualStudio.Package.LanguageService.$(VisualStudioVersion15)" />
Expand All @@ -66,11 +69,15 @@
<Reference Include="Microsoft.VisualStudio.Shell.Interop.11.0" />
<Reference Condition="'$(VisualStudioVersion)' != '11.0' AND '$(VisualStudioVersion)' != '12.0' AND '$(VisualStudioVersion)' != '14.0'"
Include="Microsoft.VisualStudio.Shell.Interop.15.3.DesignTime" />
<Reference Condition="'$(VisualStudioVersion)' == '16.0'" Include="Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime, Version=14.0.0.0">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.11.0" />
<Reference Include="Microsoft.VisualStudio.DataDesign.Interfaces" />
<Reference Include="Microsoft.VisualStudio.ComponentModelHost" />
<Reference Include="Microsoft.VisualStudio.TemplateWizardInterface" />
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.10.0" />
<Reference Condition="$(VisualStudioVersion)!='11.0' AND $(VisualStudioVersion)!='12.0'" Include="Microsoft.VisualStudio.Utilities" />
<Reference Include="Accessibility" />
<Reference Include="System" />
<Reference Include="System.Xaml" />
Expand Down

0 comments on commit 2e0ba78

Please sign in to comment.