Skip to content

Commit

Permalink
Merge branch 'master' into TwitterPageBackground
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrons committed Aug 24, 2018
2 parents 2b707c4 + a3a205c commit e2ca4cb
Show file tree
Hide file tree
Showing 68 changed files with 2,740 additions and 112 deletions.
33 changes: 23 additions & 10 deletions Directory.Build.props
Expand Up @@ -9,35 +9,46 @@
<PackageLicenseUrl>https://github.com/Microsoft/WindowsCommunityToolkit/blob/master/license.md</PackageLicenseUrl>
<PackageReleaseNotes>v3.0 release https://github.com/Microsoft/WindowsCommunityToolkit/releases</PackageReleaseNotes>
<Copyright>(c) .NET Foundation and Contributors. All rights reserved.</Copyright>

<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)Toolkit.ruleset</CodeAnalysisRuleSet>

<DefaultLanguage>en-US</DefaultLanguage>

<IsDesignProject>$(MSBuildProjectName.Contains('.Design'))</IsDesignProject>
<IsTestProject>$(MSBuildProjectName.Contains('Test'))</IsTestProject>
<IsUwpProject Condition="'$(IsDesignProject)' != 'true'">$(MSBuildProjectName.Contains('Uwp'))</IsUwpProject>
<IsWin32Project Condition="'$(IsDesignProject)' != 'true'">$(MSBuildProjectName.Contains('Win32'))</IsWin32Project>
<IsWpfProject Condition="'$(IsDesignProject)' != 'true'">$(MSBuildProjectName.Contains('Wpf'))</IsWpfProject>
<IsFormsProject Condition="'$(IsDesignProject)' != 'true'">$(MSBuildProjectName.Contains('Forms'))</IsFormsProject>
<IsSampleProject>$(MSBuildProjectName.Contains('Sample'))</IsSampleProject>

<DefaultTargetPlatformVersion>17134</DefaultTargetPlatformVersion>
<DefaultTargetPlatformMinVersion>15063</DefaultTargetPlatformMinVersion>
<PackageOutputPath>$(MSBuildThisFileDirectory)bin\nupkg</PackageOutputPath>
<PackageOutputPath>$(MSBuildThisFileDirectory)bin\nupkg</PackageOutputPath>
</PropertyGroup>

<PropertyGroup>
<SignAssembly Condition="'$(SignAssembly)' == '' and '$(IsUwpProject)' != 'true'" >true</SignAssembly>
<SignAssembly Condition="'$(SignAssembly)' == '' and '$(IsUwpProject)' != 'true'" >true</SignAssembly>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)toolkit.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<Choose>
<When Condition="'$(IsWin32Project)' == 'true'">
<When Condition="'$(IsWin32Project)' == 'true' or '$(IsWpfProject)' == 'true' or '$(IsFormsProject)' == 'true'">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>

<!-- Need RS5 or later.
When changing this value, ensure the SDK is installed with the build process.
Need to check several files:
- /.vsts-ci.yml
- /.vsts-pr.yml
This also needs to be installed on your local machine. Can do this with PowerShell:
./build/Install-WindowsSDKISO.ps1 17713
-->
<TargetPlatformVersion>10.0.17733.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>

<!-- Compiler -->
<FileAlignment>512</FileAlignment>
<HighEntropyVA>true</HighEntropyVA>
Expand All @@ -49,6 +60,7 @@
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<OutputPath>bin\$(Platform)\$(Configuration)</OutputPath>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -68,13 +80,13 @@
<Choose>
<When Condition="'$(IsTestProject)' != 'true' and '$(IsSampleProject)' != 'true' and '$(IsDesignProject)' != 'true'">
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
</When>
</Choose>

<Choose>
<When Condition="('$(IsUwpProject)' == 'true' or '$(IsWin32Project)' == 'true') and '$(IsSampleProject)' != 'true' and '$(IsDesignProject)' != 'true'">
<When Condition="('$(IsUwpProject)' == 'true' or '$(IsWin32Project)' == 'true' or '$(IsWpfProject)' == 'true' or '$(IsFormsProject)' == 'true') and '$(IsSampleProject)' != 'true' and '$(IsDesignProject)' != 'true'">
<PropertyGroup>
<GenerateLibraryLayout>true</GenerateLibraryLayout>
</PropertyGroup>
Expand All @@ -91,7 +103,7 @@
<!-- Optional: Include PDB in the built .nupkg -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.Vsts.Git" Version="1.0.0-beta-62925-02" PrivateAssets="All"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-62925-02" PrivateAssets="All"/>
</ItemGroup>
Expand All @@ -115,6 +127,7 @@
</Choose>

<PropertyGroup Condition="'$(IsUwpProject)' == 'true'">

<!-- 8002 is a strong named -> non-strong-named reference -->
<!-- This is valid for platforms other than .NET Framework (and is needed for the UWP targets -->
<NoWarn>$(NoWarn);8002</NoWarn>
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.targets
Expand Up @@ -20,7 +20,7 @@
</Choose>

<Choose>
<When Condition="'$(IsWin32Project)' == 'true'">
<When Condition="'$(IsWin32Project)' == 'true' or '$(IsWpfProject)' == 'true' or '$(IsFormsProject)' == 'true'">
<PropertyGroup>
<TargetPlatformVersion Condition="'$(TargetPlatformVersion)' == ''">10.0.$(DefaultTargetPlatformVersion).0</TargetPlatformVersion>
<TargetPlatformMinVersion Condition="'$(TargetPlatformMinVersion)' == ''">10.0.$(DefaultTargetPlatformMinVersion).0</TargetPlatformMinVersion>
Expand Down
2 changes: 1 addition & 1 deletion Microsoft.Toolkit.Uwp.SampleApp/SamplePages/samples.json
Expand Up @@ -288,7 +288,7 @@
{
"Name": "StaggeredPanel",
"Type": "StaggeredPanelPage",
"About": "Allows items to be displayed with a specified header.",
"About": "The StaggeredPanel allows for layout of items in a column approach where an item will be added to whichever column has used the least amount of space.",
"CodeUrl": "https://github.com/Microsoft/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/StaggeredPanel",
"XamlCodeFile": "StaggeredPanel.bind",
"Icon": "/SamplePages/StaggeredPanel/StaggeredPanel.png",
Expand Down
@@ -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;
}
}
@@ -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();
}
}
@@ -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);
}
}
@@ -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;
}
}
@@ -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);
}
}
@@ -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>
@@ -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)]

0 comments on commit e2ca4cb

Please sign in to comment.