This commit is contained in:
Alexandre Zollinger Chohfi 2019-02-22 17:08:58 -08:00
Родитель a9aeed04de
Коммит a5cf3ef8d1
6 изменённых файлов: 68 добавлений и 65 удалений

Просмотреть файл

@ -32,6 +32,8 @@ namespace Microsoft.Toolkit.Forms.UI.XamlHost
/// </remarks>
private static readonly IXamlMetadataContainer _metadataContainer = XamlApplication.GetOrCreateXamlMetadataContainer();
#pragma warning disable SA1401 // Fields must be private
#pragma warning disable CA1051 // Do not declare visible instance fields
/// <summary>
/// DesktopWindowXamlSource instance
/// </summary>
@ -41,6 +43,8 @@ namespace Microsoft.Toolkit.Forms.UI.XamlHost
/// A render transform to scale the UWP XAML content should be applied
/// </summary>
private bool _dpiScalingRenderTransformEnabled = false;
#pragma warning restore SA1401 // Fields must be private
#pragma warning restore CA1051 // Do not declare visible instance fields
/// <summary>
/// Gets the current instance of <seealso cref="XamlApplication"/>

Просмотреть файл

@ -98,7 +98,6 @@ Global
{9C49A885-D39B-4CA0-9DEB-204A6EA7D453}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C49A885-D39B-4CA0-9DEB-204A6EA7D453}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C49A885-D39B-4CA0-9DEB-204A6EA7D453}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C49A885-D39B-4CA0-9DEB-204A6EA7D453}.Release|Any CPU.Build.0 = Release|Any CPU
{F87EDD34-AF48-45C7-9342-49023B882DA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F87EDD34-AF48-45C7-9342-49023B882DA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F87EDD34-AF48-45C7-9342-49023B882DA1}.Release|Any CPU.ActiveCfg = Release|Any CPU

Просмотреть файл

@ -1,49 +1,49 @@
// 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 windows = Windows;
namespace Microsoft.Toolkit.Wpf.UI.XamlHost
{
/// <summary>
/// Extensions for use with UWP UIElement objects wrapped by the WindowsXamlHostBaseExt
/// </summary>
public static class UwpUIElementExtensions
{
private static bool IsDesktopWindowsXamlSourcePresent() => windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.UI.Xaml.Hosting.HostingContract", 3);
private static windows.UI.Xaml.DependencyProperty WrapperProperty
{
get
{
if (IsDesktopWindowsXamlSourcePresent())
{
var result = windows.UI.Xaml.DependencyProperty.RegisterAttached("Wrapper", typeof(System.Windows.UIElement), typeof(UwpUIElementExtensions), new windows.UI.Xaml.PropertyMetadata(null));
return result;
}
throw new NotImplementedException();
}
}
public static WindowsXamlHostBase GetWrapper(this windows.UI.Xaml.UIElement element)
{
if (IsDesktopWindowsXamlSourcePresent())
{
return (WindowsXamlHostBase)element.GetValue(WrapperProperty);
}
return null;
}
public static void SetWrapper(this windows.UI.Xaml.UIElement element, WindowsXamlHostBase wrapper)
{
if (IsDesktopWindowsXamlSourcePresent())
{
element.SetValue(WrapperProperty, wrapper);
}
}
}
}
// 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 windows = Windows;
namespace Microsoft.Toolkit.Wpf.UI.XamlHost
{
/// <summary>
/// Extensions for use with UWP UIElement objects wrapped by the WindowsXamlHostBaseExt
/// </summary>
public static class UwpUIElementExtensions
{
private static bool IsDesktopWindowsXamlSourcePresent() => windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.UI.Xaml.Hosting.HostingContract", 3);
private static windows.UI.Xaml.DependencyProperty WrapperProperty
{
get
{
if (IsDesktopWindowsXamlSourcePresent())
{
var result = windows.UI.Xaml.DependencyProperty.RegisterAttached("Wrapper", typeof(System.Windows.UIElement), typeof(UwpUIElementExtensions), new windows.UI.Xaml.PropertyMetadata(null));
return result;
}
throw new NotImplementedException();
}
}
public static WindowsXamlHostBase GetWrapper(this windows.UI.Xaml.UIElement element)
{
if (IsDesktopWindowsXamlSourcePresent())
{
return (WindowsXamlHostBase)element.GetValue(WrapperProperty);
}
return null;
}
public static void SetWrapper(this windows.UI.Xaml.UIElement element, WindowsXamlHostBase wrapper)
{
if (IsDesktopWindowsXamlSourcePresent())
{
element.SetValue(WrapperProperty, wrapper);
}
}
}
}

Просмотреть файл

@ -1,7 +1,7 @@
// 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.
// 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.
// Based on https://github.com/saikrishnav/testfxSTAext/blob/master/LICENSE
#if NETCOREAPP

Просмотреть файл

@ -1,7 +1,7 @@
// 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.
// 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.
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given

Просмотреть файл

@ -1,8 +1,8 @@
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
$globalJsonPath = Join-Path -Path $PSScriptRoot -ChildPath ..\global.json
$globalJson = Get-Content $globalJsonPath | ConvertFrom-Json
$dotnetinstall = Join-Path -Path $PSScriptRoot dotnet-install.ps1
Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile $dotnetinstall;
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
$globalJsonPath = Join-Path -Path $PSScriptRoot -ChildPath ..\global.json
$globalJson = Get-Content $globalJsonPath | ConvertFrom-Json
$dotnetinstall = Join-Path -Path $PSScriptRoot dotnet-install.ps1
Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile $dotnetinstall;
& $dotnetinstall -Version $globalJson.sdk.version;