Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into TwitterPageBackground
- Loading branch information
Showing
68 changed files
with
2,740 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Interop/Win32/NativeDefines.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32; | ||
|
||
namespace Microsoft.Toolkit.Forms.UI.XamlHost.Interop.Win32 | ||
{ | ||
internal static class NativeDefines | ||
{ | ||
public const int WM_MOVE = (int)WM.MOVE; | ||
public const int WM_SIZE = (int)WM.SIZE; | ||
|
||
public const int WM_WINDOWPOSCHANGING = (int)WM.WINDOWPOSCHANGING; | ||
public const int WM_WINDOWPOSCHANGED = (int)WM.WINDOWPOSCHANGED; | ||
|
||
public const int WM_SETFOCUS = (int)WM.SETFOCUS; | ||
public const int WM_KILLFOCUS = (int)WM.KILLFOCUS; | ||
|
||
public static IntPtr HWND_TOP { get; } = IntPtr.Zero; | ||
|
||
public static IntPtr HWND_TOPMOST { get; } = IntPtr.Zero - 1; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Interop/Win32/NativeMethods.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
using System.Runtime.Versioning; | ||
using Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32; | ||
|
||
namespace Microsoft.Toolkit.Forms.UI.XamlHost.Interop.Win32 | ||
{ | ||
/// <summary> | ||
/// This class does not suppress stack walks for unmanaged code permission. | ||
/// </summary> | ||
/// <remarks> | ||
/// This class is for methods that can be used anywhere because a stack walk will be performed. | ||
/// </remarks> | ||
internal static class NativeMethods | ||
{ | ||
[DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)] | ||
[ResourceExposure(ResourceScope.None)] | ||
public static extern IntPtr GetFocus(); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...soft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Interop/Win32/SafeNativeMethods.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
using System.Runtime.Versioning; | ||
using System.Security; | ||
using Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32; | ||
|
||
namespace Microsoft.Toolkit.Forms.UI.XamlHost.Interop.Win32 | ||
{ | ||
/// <summary> | ||
/// This class is for methods that are safe for anyone to call. Callers of these methods are not required to perform a full security review to make sure that the usage is secure because the methods are harmless for any caller. | ||
/// </summary> | ||
/// <remarks> | ||
/// <see cref="SuppressUnmanagedCodeSecurityAttribute"/> is applied to this class. | ||
/// </remarks> | ||
[SuppressUnmanagedCodeSecurity] | ||
internal static class SafeNativeMethods | ||
{ | ||
[DllImport(ExternDll.User32, ExactSpelling = true, CharSet = CharSet.Auto)] | ||
[ResourceExposure(ResourceScope.None)] | ||
internal static extern IntPtr SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, int flags); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...soft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Interop/Win32/SetWindowPosFlags.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
namespace Microsoft.Toolkit.Forms.UI.XamlHost.Interop.Win32 | ||
{ | ||
/// <summary> | ||
/// SetWindowPos Flags | ||
/// </summary> | ||
internal static class SetWindowPosFlags | ||
{ | ||
public static readonly int SHOWWINDOW = 0x0040; | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...ft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Interop/Win32/UnsafeNativeMethods.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
using System.Security; | ||
using Microsoft.Toolkit.Win32.UI.Controls.Interop.Win32; | ||
|
||
namespace Microsoft.Toolkit.Forms.UI.XamlHost.Interop.Win32 | ||
{ | ||
/// <summary> | ||
/// This class is for methods that are potentially dangerous. Any caller of these methods must perform a full security review to make sure that the usage is secure because no stack walk will be performed. | ||
/// </summary> | ||
/// <remarks> | ||
/// <see cref="SuppressUnmanagedCodeSecurityAttribute"/> is applied to this class. | ||
/// </remarks> | ||
[SuppressUnmanagedCodeSecurity] | ||
internal static class UnsafeNativeMethods | ||
{ | ||
/// <summary> | ||
/// This code returns a pointer to a native control with focus. | ||
/// </summary> | ||
/// <SecurityNote> | ||
/// SecurityCritical: This code happens to return a critical resource and causes unmanaged code elevation | ||
/// </SecurityNote> | ||
/// <returns>handle</returns> | ||
[SecurityCritical] | ||
[DllImport(ExternDll.User32, EntryPoint = "SetFocus", ExactSpelling = true, CharSet = CharSet.Auto, SetLastError = true)] | ||
public static extern IntPtr IntSetFocus(IntPtr hWnd); | ||
|
||
/// <summary> | ||
/// Enables a window and returns an unmanaged handle to it. | ||
/// </summary> | ||
/// <SecurityNote> | ||
/// Critical: This code calls into unmanaged code which elevates | ||
/// </SecurityNote> | ||
/// <returns>handle</returns> | ||
[SecurityCritical] | ||
[DllImport(ExternDll.User32, EntryPoint = "EnableWindow", SetLastError = true, ExactSpelling = true, CharSet = CharSet.Auto)] | ||
public static extern bool IntEnableWindow(HandleRef hWnd, bool enable); | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
...lkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Microsoft.Toolkit.Forms.UI.XamlHost.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net462</TargetFramework> | ||
<RootNamespace>Microsoft.Toolkit.Forms.UI.XamlHost</RootNamespace> | ||
<AssemblyName>Microsoft.Toolkit.Forms.UI.XamlHost</AssemblyName> | ||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> | ||
<RunCodeAnalysis>true</RunCodeAnalysis> | ||
|
||
<Title>Windows Community Toolkit XAMLHost for Windows Forms</Title> | ||
<Description>This library provides XAML islands interop helpers for Windows Forms. It is part of the Windows Community Toolkit.</Description> | ||
<PackageTags>XAML Islands Win32 Forms WindowsForms WinForms XamlHost</PackageTags> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | ||
<DefineConstants>TRACE;DEBUG;CODE_ANALYSIS;NET47</DefineConstants> | ||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> | ||
<WarningsAsErrors /> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Remove="Shared\**" /> | ||
<Compile Remove="WPF\**" /> | ||
<EmbeddedResource Remove="Shared\**" /> | ||
<EmbeddedResource Remove="WPF\**" /> | ||
<None Remove="Shared\**" /> | ||
<None Remove="WPF\**" /> | ||
<Page Remove="Shared\**" /> | ||
<Page Remove="WPF\**" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="..\Microsoft.Toolkit.Win32.UI.XamlHost\**\*.cs" /> | ||
<Compile Include="..\Microsoft.Toolkit.Win32.UI.Controls\Interop\Win32\ExternDll.cs" Link="Interop\Win32\ExternDll.cs" /> | ||
<Compile Include="..\Microsoft.Toolkit.Win32.UI.Controls\Interop\Win32\WM.cs" Link="Interop\Win32\WM.cs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Windows.Forms" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xaml"> | ||
<RequiredTargetFramework>4.0</RequiredTargetFramework> | ||
</Reference> | ||
<Reference Include="WindowsBase" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Compile Update="Properties\Resources.Designer.cs"> | ||
<AutoGen>True</AutoGen> | ||
<DesignTime>True</DesignTime> | ||
<DependentUpon>Resources.resx</DependentUpon> | ||
</Compile> | ||
<Compile Update="Properties\Settings.Designer.cs"> | ||
<AutoGen>True</AutoGen> | ||
<DependentUpon>Settings.settings</DependentUpon> | ||
<DesignTimeSharedInput>True</DesignTimeSharedInput> | ||
</Compile> | ||
<EmbeddedResource Update="Properties\Resources.resx"> | ||
<Generator>ResXFileCodeGenerator</Generator> | ||
<LastGenOutput>Resources.Designer.cs</LastGenOutput> | ||
</EmbeddedResource> | ||
<None Include="Properties\Settings.settings"> | ||
<Generator>SettingsSingleFileGenerator</Generator> | ||
<LastGenOutput>Settings.Designer.cs</LastGenOutput> | ||
</None> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="System.Runtime.WindowsRuntime" Version="4.0.0" PrivateAssets="All" /> | ||
<PackageReference Include="System.Runtime.WindowsRuntime.UI.Xaml" Version="4.0.0" PrivateAssets="All" /> | ||
</ItemGroup> | ||
|
||
</Project> |
26 changes: 26 additions & 0 deletions
26
Microsoft.Toolkit.Win32/Microsoft.Toolkit.Forms.UI.XamlHost/Properties/AssemblyInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Reflection; | ||
using System.Resources; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
using System.Windows; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("Microsoft.Toolkit.Forms.UI.XamlHost")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("Microsoft.Toolkit")] | ||
[assembly: AssemblyCopyright("Copyright © 2018")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] |
Oops, something went wrong.