Merge branch 'master' into smokeTests

This commit is contained in:
Alexandre Zollinger Chohfi 2020-09-22 11:06:08 -07:00
Родитель 307537de06 130dbe0737
Коммит 7af85d0630
109 изменённых файлов: 422 добавлений и 1540 удалений

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

@ -14,8 +14,8 @@
<IsTestProject>$(MSBuildProjectName.Contains('Test'))</IsTestProject>
<IsUwpProject Condition="'$(IsDesignProject)' != 'true'">$(MSBuildProjectName.Contains('Uwp'))</IsUwpProject>
<IsSampleProject>$(MSBuildProjectName.Contains('Sample'))</IsSampleProject>
<DefaultTargetPlatformVersion>18362</DefaultTargetPlatformVersion>
<DefaultTargetPlatformMinVersion>16299</DefaultTargetPlatformMinVersion>
<DefaultTargetPlatformVersion>19041</DefaultTargetPlatformVersion>
<DefaultTargetPlatformMinVersion>17763</DefaultTargetPlatformMinVersion>
<PackageOutputPath>$(MSBuildThisFileDirectory)bin\nupkg</PackageOutputPath>
</PropertyGroup>

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

@ -1,6 +1,6 @@
<Project>
<Choose>
<When Condition="'$(TargetFramework)' == 'uap10.0' or '$(TargetFramework)' == 'uap10.0.16299' or '$(TargetFramework)' == 'native' or '$(TargetFramework)' == 'net461'">
<When Condition="'$(TargetFramework)' == 'uap10.0' or '$(TargetFramework)' == 'uap10.0.17763' or '$(TargetFramework)' == 'native' or '$(TargetFramework)' == 'net461'">
<!-- UAP versions for uap10.0 where TPMV isn't implied -->
<PropertyGroup>
<TargetPlatformVersion>10.0.$(DefaultTargetPlatformVersion).0</TargetPlatformVersion>
@ -15,9 +15,6 @@
<SDKReference Condition="'$(UseWindowsDesktopSdk)' == 'true' " Include="WindowsDesktop, Version=$(TargetPlatformVersion)">
<Name>Windows Desktop Extensions for the UWP</Name>
</SDKReference>
<SDKReference Condition="'$(UseWindowsMobileSdk)' == 'true' " Include="WindowsMobile, Version=$(TargetPlatformVersion)">
<Name>Windows Mobile Extensions for the UWP</Name>
</SDKReference>
</ItemGroup>
</When>
</Choose>

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

@ -11,7 +11,7 @@
<AssemblyName>GazeInputTest</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.18362.0</TargetPlatformVersion>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>

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

@ -103,6 +103,68 @@ namespace Microsoft.Toolkit.HighPerformance.Helpers
return valid;
}
/// <summary>
/// Checks whether the given value has any bytes that are set to 0.
/// That is, given a <see cref="uint"/> value, which has a total of 4 bytes,
/// it checks whether any of those have all the bits set to 0.
/// </summary>
/// <param name="value">The input value to check.</param>
/// <returns>Whether <paramref name="value"/> has any bytes set to 0.</returns>
/// <remarks>
/// This method contains no branches.
/// For more background on this subject, see <see href="https://graphics.stanford.edu/~seander/bithacks.html#ZeroInWord"/>.
/// </remarks>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool HasZeroByte(uint value)
{
return ((value - 0x0101_0101u) & ~value & 0x8080_8080u) != 0;
}
/// <summary>
/// Checks whether the given value has any bytes that are set to 0.
/// This method mirrors <see cref="HasZeroByte(uint)"/>, but with <see cref="ulong"/> values.
/// </summary>
/// <param name="value">The input value to check.</param>
/// <returns>Whether <paramref name="value"/> has any bytes set to 0.</returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool HasZeroByte(ulong value)
{
return ((value - 0x0101_0101_0101_0101ul) & ~value & 0x8080_8080_8080_8080ul) != 0;
}
/// <summary>
/// Checks whether a byte in the input <see cref="uint"/> value matches a target value.
/// </summary>
/// <param name="value">The input value to check.</param>
/// <param name="target">The target byte to look for.</param>
/// <returns>Whether <paramref name="value"/> has any bytes set to <paramref name="target"/>.</returns>
/// <remarks>
/// This method contains no branches.
/// For more info, see <see href="https://graphics.stanford.edu/~seander/bithacks.html#ZeroInWord"/>.
/// </remarks>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool HasByteEqualTo(uint value, byte target)
{
return HasZeroByte(value ^ (0x0101_0101u * target));
}
/// <summary>
/// Checks whether a byte in the input <see cref="uint"/> value matches a target value.
/// This method mirrors <see cref="HasByteEqualTo(uint,byte)"/>, but with <see cref="ulong"/> values.
/// </summary>
/// <param name="value">The input value to check.</param>
/// <param name="target">The target byte to look for.</param>
/// <returns>Whether <paramref name="value"/> has any bytes set to <paramref name="target"/>.</returns>
[Pure]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool HasByteEqualTo(ulong value, byte target)
{
return HasZeroByte(value ^ (0x0101_0101_0101_0101u * target));
}
/// <summary>
/// Sets a bit to a specified value.
/// </summary>

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

@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<TargetFrameworks>uap10.0.16299;netstandard2.0;NET462</TargetFrameworks>
<TargetFrameworks>uap10.0.17763;netstandard2.0;NET462</TargetFrameworks>
<Title>Windows Community Toolkit .NET Standard Services</Title>
<Description>
This .NET standard library enables access to different data sources such as Microsoft Graph, OneDrive, Twitter, Microsoft Translator, and LinkedIn. It is part of the Windows Community Toolkit.
@ -12,7 +12,7 @@
<DeterministicSourcePaths Condition="'$(EnableSourceLink)' == ''">false</DeterministicSourcePaths>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'uap10.0.16299'">
<PropertyGroup Condition="'$(TargetFramework)' == 'uap10.0.17763'">
<DefineConstants Condition="'$(DisableImplicitFrameworkDefines)' != 'true'">$(DefineConstants);WINRT</DefineConstants>
</PropertyGroup>
@ -31,7 +31,7 @@
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='uap10.0.16299'">
<ItemGroup Condition="'$(TargetFramework)'=='uap10.0.17763'">
<ProjectReference Include="..\Microsoft.Toolkit.Uwp\Microsoft.Toolkit.Uwp.csproj" />
</ItemGroup>
@ -47,7 +47,7 @@
<PackageReference Include="Microsoft.Toolkit.Forms.UI.Controls.WebView" Version="[5.0.0-preview.gb86cb1c4cb,)" />
</ItemGroup>
<ItemGroup Condition="!('$(TargetFramework)'=='uap10.0.16299')">
<ItemGroup Condition="!('$(TargetFramework)'=='uap10.0.17763')">
<Compile Remove="PlatformSpecific\Uwp\**\*" />
</ItemGroup>
</Project>

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

@ -12,7 +12,6 @@ using Microsoft.Toolkit.Uwp.Helpers;
using Windows.Devices.Bluetooth;
using Windows.Devices.Bluetooth.Advertisement;
using Windows.Devices.Enumeration;
using Windows.Foundation.Metadata;
using Windows.System;
namespace Microsoft.Toolkit.Uwp.Connectivity
@ -27,11 +26,6 @@ namespace Microsoft.Toolkit.Uwp.Connectivity
/// </summary>
private const string BluetoothLeDeviceWatcherAqs = "(System.Devices.Aep.ProtocolId:=\"{bb7bb05e-5972-42b5-94fc-76eaa7084d49}\")";
/// <summary>
/// Gets a value indicating whether the Bluetooth LE Helper is supported
/// </summary>
private static bool? _isBluetoothLESupported = null;
/// <summary>
/// We need to cache all DeviceInformation objects we get as they may
/// get updated in the future. The update may make them eligible to be put on
@ -82,12 +76,6 @@ namespace Microsoft.Toolkit.Uwp.Connectivity
/// </summary>
public static BluetoothLEHelper Context { get; } = new BluetoothLEHelper();
/// <summary>
/// Gets a value indicating whether the Bluetooth LE Helper is supported.
/// </summary>
public static bool IsBluetoothLESupported => (bool)(_isBluetoothLESupported ??
(_isBluetoothLESupported = ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 4)));
/// <summary>
/// Gets the list of available bluetooth devices
/// </summary>

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

@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<TargetFramework>uap10.0.16299</TargetFramework>
<TargetFramework>uap10.0.17763</TargetFramework>
<Title>Windows Community Toolkit Devices</Title>
<Description>This library enables easier consumption of connectivity Devices/Peripherals and handle its connection to Windows devices. It contains BluetoothLE and Network connectivity helpers.</Description>
<PackageTags>UWP Toolkit Windows Devices Bluetooth BluetoothLE BLE Networking</PackageTags>

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

@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<TargetFramework>uap10.0.16299</TargetFramework>
<TargetFramework>uap10.0.17763</TargetFramework>
<Title>Windows Community Toolkit Developer Tools</Title>
<Description>This library provides XAML user controls and services to help developers build their app. It is part of the Windows Community Toolkit.

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

@ -42,7 +42,7 @@
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<AppContainerApplication>true</AppContainerApplication>
<ApplicationType>Windows Store</ApplicationType>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.17134.0</WindowsTargetPlatformMinVersion>
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
<ProjectName>Microsoft.Toolkit.Uwp.Input.GazeInteraction</ProjectName>

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

@ -1,24 +0,0 @@
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<TargetFramework>uap10.0</TargetFramework>
<IncludeBuildOutput>false</IncludeBuildOutput>
<Title>Windows Community Toolkit Notifications for JavaScript</Title>
<Description>
This project is used for packaging the WinMD to work for WinJS projects.
Generate tile, toast, and badge notifications for Windows 10 via code, with the help of IntelliSense, instead of directly using XML.
Supports adaptive tiles and adaptive/interactive toasts for Windows 10. It is part of the Windows Community Toolkit.
Supports C# and C++ UWP project types (see Microsoft.Toolkit.Uwp.Notifications).
Also works with C# portable class libraries and non-UWP C# projects like server projects.
</Description>
<PackageTags>notifications win10 windows-10 tile tiles toast toasts badge xml uwp javascript</PackageTags>
<ExtrasImplicitPlatformPackageIsPrivate>true</ExtrasImplicitPlatformPackageIsPrivate>
</PropertyGroup>
<ItemGroup>
<None Include="Microsoft.Toolkit.Uwp.Notifications.JavaScript.targets" PackagePath="build\Windows" Pack="true" />
<None Include="..\Microsoft.Toolkit.Uwp.Notifications\bin\$(Configuration)\native\*.*" PackagePath="lib\Windows" Pack="true" />
</ItemGroup>
</Project>

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

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Reference Include="Microsoft.Toolkit.Uwp.Notifications.Windows">
<HintPath>$(MSBuildThisFileDirectory)..\..\lib\Windows\Microsoft.Toolkit.Uwp.Notifications.winmd</HintPath>
<IsWinMDFile>true</IsWinMDFile>
</Reference>
</ItemGroup>
</Project>

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

@ -7,7 +7,7 @@
<Description>
Generate tile, toast, and badge notifications for Windows 10 via code, with the help of IntelliSense.
Adds Support for adaptive tiles and adaptive/interactive toasts for Windows 10. It is part of the Windows Community Toolkit.
Supports C# and C++ UWP project types (see Microsoft.Toolkit.Uwp.Notifications.JavaScript for the JS version).
Supports C# and C++ UWP project types.
Also works with C# portable class libraries and non-UWP C# projects like server projects.
This project contains outputs for netstandard1.4, uap10.0 and native for WinRT.
</Description>
@ -18,10 +18,10 @@
<Choose>
<!--Desktop Win32 apps-->
<When Condition="'$(TargetFramework)'=='net461' or '$(TargetFramework)'=='netcoreapp3.0'">
<When Condition="'$(TargetFramework)'=='net461' or '$(TargetFramework)'=='netcoreapp3.1'">
<ItemGroup>
<!--Reference Windows SDK NuGet of correct target platform version-->
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.17763.1000" />
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1" />
</ItemGroup>
<PropertyGroup>
<!--Define the WINDOWS_UWP conditional symbol, since the Windows.Data.Xml and the Windows.UI.Notification namespaces are available-->
@ -40,7 +40,7 @@
</Choose>
<!--NET Core desktop apps also need the Registry NuGet package-->
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp3.0'">
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp3.1'">
<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
</ItemGroup>
@ -65,7 +65,7 @@
<NugetTargetMoniker Condition="'$(DesignTimeBuild)' == 'true'">native</NugetTargetMoniker>
<NugetTargetMoniker Condition="'$(DesignTimeBuild)' != 'true'">UAP,Version=v10.0</NugetTargetMoniker>
<PackageTargetFallback>uap10.0</PackageTargetFallback>
<TargetPlatformVersion Condition="'$(TargetPlatformVersion)' == '' ">10.0.18362.0</TargetPlatformVersion>
<TargetPlatformVersion Condition="'$(TargetPlatformVersion)' == '' ">10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion Condition="'$(TargetPlatformMinVersion)' == '' ">10.0.10240.0</TargetPlatformMinVersion>
<DefineConstants Condition="'$(DisableImplicitFrameworkDefines)' != 'true'">$(DefineConstants);NETFX_CORE;WINDOWS_UWP;WINRT</DefineConstants>
<CopyLocalLockFileAssemblies Condition="'$(CopyLocalLockFileAssemblies)' == ''">false</CopyLocalLockFileAssemblies>

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

@ -6,22 +6,16 @@ Any code for generating notifications should be written in the Microsoft.Toolkit
If there's UWP-specific code, use the appropriate `#ifdef`, `WINDOWS_UWP` or `WINRT`.
## What are all the projects for?
There's two notification projects...
- Microsoft.Toolkit.Uwp.Notifications
- Microsoft.Toolkit.Uwp.Notifications.JavaScript
All the code is contained on the Microsoft.Toolkit.Uwp.Notifications project.
The first project is where all the code is contained.
The JavaScript project is just for packaging the `WinMD` to work for WinJS projects.
It outputs `netstandard1.4`, `uap10.0`, `native` for WinRT, and netcoreapp for .Net Core projects. The UWP library is only for C#, while the WinRT library is a Windows Runtime Component for C++.
The first project contains outputs for `netstandard1.4`, `uap10.0` and a `native` for WinRT. The UWP library is only for C#, while the WinRT library is a Windows Runtime Component for JavaScript and C++.
| C# | JavaScript/C++ |
| C# | C++ |
| ---------------- | ------------------- |
| NET Standard 1.4 | UWP WinRT Component |
| UWP C# DLL | |
| .Net Core DLL | |

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

@ -11,8 +11,8 @@
<AssemblyName>Microsoft.Toolkit.Uwp.SampleApp</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
@ -412,10 +412,7 @@
<Content Include="SamplePages\Incremental Loading Collection\IncrementalLoadingCollectionCode.bind" />
<Content Include="SamplePages\ImageCache\ImageCacheCode.bind" />
<Content Include="SamplePages\DropShadowPanel\DropShadowPanelXaml.bind" />
<Content Include="SamplePages\LiveTile\LiveTileCodeJavaScript.bind" />
<Content Include="SamplePages\Toast\ToastCodeJavaScript.bind" />
<Content Include="SamplePages\Object Storage\ObjectStorageCode.bind" />
<Content Include="SamplePages\WeatherLiveTileAndToast\WeatherLiveTileAndToastCodeJavaScript.bind" />
<Content Include="SamplePages\BackgroundTaskHelper\BackgroundTaskHelperCode.bind" />
<Content Include="SamplePages\MasterDetailsView\MasterDetailsView.bind" />
<Content Include="SamplePages\NetworkHelper\NetworkHelperCode.bind" />

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

@ -141,8 +141,6 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
public string CodeFile { get; set; }
public string JavaScriptCodeFile { get; set; }
public string XamlCodeFile { get; set; }
public bool DisableXamlEditorRendering { get; set; }
@ -163,8 +161,6 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
public bool HasCSharpCode => !string.IsNullOrEmpty(CodeFile);
public bool HasJavaScriptCode => !string.IsNullOrEmpty(JavaScriptCodeFile);
public bool HasDocumentation => !string.IsNullOrEmpty(DocumentationUrl);
public bool IsSupported
@ -191,17 +187,6 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
}
}
public async Task<string> GetJavaScriptSourceAsync()
{
using (var codeStream = await StreamHelper.GetPackagedFileStreamAsync(JavaScriptCodeFile.StartsWith('/') ? JavaScriptCodeFile : $"SamplePages/{Name}/{JavaScriptCodeFile}"))
{
using (var streamReader = new StreamReader(codeStream.AsStream()))
{
return await streamReader.ReadToEndAsync();
}
}
}
#pragma warning disable SA1009 // Doesn't like ValueTuples.
public async Task<(string contents, string path)> GetDocumentationAsync()
#pragma warning restore SA1009 // Doesn't like ValueTuples.

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

@ -195,12 +195,6 @@
IsFocusEngagementEnabled="False" />
</PivotItem>
<PivotItem x:Name="JavaScriptPivotItem"
Padding="0, 10,0,0"
Header="Javascript">
<controlsLocal:CodeRenderer x:Name="JavaScriptCodeRenderer" />
</PivotItem>
<PivotItem x:Name="DocumentationPivotItem"
Padding="0, 10,0,0"
Header="Documentation">

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

@ -271,14 +271,6 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
InfoAreaPivot.Items.Add(CSharpPivotItem);
}
if (CurrentSample.HasJavaScriptCode)
{
var code = await CurrentSample.GetJavaScriptSourceAsync();
JavaScriptCodeRenderer.SetCode(code, "js");
InfoAreaPivot.Items.Add(JavaScriptPivotItem);
}
if (CurrentSample.HasDocumentation)
{
#pragma warning disable SA1008 // Opening parenthesis must be spaced correctly
@ -421,14 +413,6 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
return;
}
if (CurrentSample.HasJavaScriptCode && InfoAreaPivot.SelectedItem == JavaScriptPivotItem)
{
var code = await CurrentSample.GetJavaScriptSourceAsync();
JavaScriptCodeRenderer.SetCode(code, "js");
return;
}
}
private async void XamlCodeEditor_UpdateRequested(object sender, EventArgs e)

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

@ -1,22 +1,18 @@
// Get a local copy of the context for easier reading
BluetoothLEHelper bluetoothLEHelper = BluetoothLEHelper.Context;
// check if BluetoothLE APIs are available
if (BluetoothLEHelper.IsBluetoothLESupported)
{
// Start the Enumeration
bluetoothLEHelper.StartEnumeration();
// Start the Enumeration
bluetoothLEHelper.StartEnumeration();
// At this point the user needs to select a device they want to connect to. This can be done by
// creating a ListView and binding the bluetoothLEHelper collection to it. Once a device is found,
// the Connect() method can be called to connect to the device and start interacting with its services
// At this point the user needs to select a device they want to connect to. This can be done by
// creating a ListView and binding the bluetoothLEHelper collection to it. Once a device is found,
// the Connect() method can be called to connect to the device and start interacting with its services
// Connect to a device if your choice
ObservableBluetoothLEDevice device = bluetoothLEHelper.BluetoothLeDevices[<Device you choose>];
await device.ConnectAsync();
// Connect to a device if your choice
ObservableBluetoothLEDevice device = bluetoothLEHelper.BluetoothLeDevices[<Device you choose>];
await device.ConnectAsync();
// At this point the device is connected and the Services property is populated.
// At this point the device is connected and the Services property is populated.
// See all the services
var services = device.Services;
}
// See all the services
var services = device.Services;

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

@ -6,9 +6,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid>
<RelativePanel x:Name="MainContent"
Visibility="Collapsed">
<RelativePanel>
<Button x:Name="BtEnumeration"
Margin="10"
Click="Enumeration_Click"
@ -80,15 +78,4 @@
Margin="10"
RelativePanel.Below="BtReadCharValue" />
</RelativePanel>
<TextBlock x:Name="NotAvailableMessage"
Margin="40"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="20"
Foreground="{ThemeResource SystemControlForegroundAccentBrush}"
Text="BluetoothLE requires the Windows 10 Creators Update"
TextAlignment="Center"
TextWrapping="WrapWholeWords"
Visibility="Collapsed" />
</Grid>
</Page>

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

@ -20,19 +20,6 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
this.InitializeComponent();
bluetoothLEHelper.EnumerationCompleted += BluetoothLEHelper_EnumerationCompleted;
Load();
}
private void Load()
{
if (BluetoothLEHelper.IsBluetoothLESupported)
{
MainContent.Visibility = Visibility.Visible;
}
else
{
NotAvailableMessage.Visibility = Visibility.Visible;
}
}
private async void BluetoothLEHelper_EnumerationCompleted(object sender, EventArgs e)
@ -46,11 +33,6 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
private void Enumeration_Click(object sender, RoutedEventArgs e)
{
if (!BluetoothLEHelper.IsBluetoothLESupported)
{
return;
}
if (!bluetoothLEHelper.IsEnumerating)
{
bluetoothLEHelper.StartEnumeration();

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

@ -22,20 +22,5 @@
</Style>
</Page.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock x:Name="WarningText"
Margin="0,20"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Foreground="{ThemeResource Brush-Grey-03}"
Text="DropShadowPanel is only available on Windows 10 Anniversary Update or greater"
TextWrapping="Wrap"
Visibility="Collapsed" />
<Grid x:Name="XamlRoot" Grid.Row="1" />
</Grid>
<Grid x:Name="XamlRoot"/>
</Page>

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

@ -2,11 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.Toolkit.Uwp.SampleApp.Models;
using Microsoft.Toolkit.Uwp.UI.Controls;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
@ -21,15 +17,6 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public DropShadowPanelPage()
{
InitializeComponent();
Load();
}
private void Load()
{
if (!DropShadowPanel.IsSupported)
{
WarningText.Visibility = Visibility.Visible;
}
}
}
}

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

@ -69,9 +69,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
AddImage(false, false, true);
});
if (ImageExBase.IsLazyLoadingSupported)
{
SampleController.Current.RegisterNewCommand("Lazy loading sample (17763 or higher supported)", (sender, args) =>
SampleController.Current.RegisterNewCommand("Lazy loading sample", (sender, args) =>
{
var imageExLazyLoadingControl = new ImageExLazyLoadingControl();
imageExLazyLoadingControl.CloseButtonClick += (s, a) =>
@ -87,7 +85,6 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
lazyLoadingControlHost.Child = imageExLazyLoadingControl;
}
});
}
SampleController.Current.RegisterNewCommand("Clear image cache", async (sender, args) =>
{

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

@ -9,14 +9,6 @@
mc:Ignorable="d">
<Grid>
<TextBlock x:Name="WarningText"
Margin="0,20"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Foreground="Red"
Text="Light effects are not available on your version of Windows 10"
TextWrapping="Wrap"
Visibility="Collapsed" />
<Grid x:Name="XamlRoot"/>
<!-- Shallow Copy -->

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

@ -27,11 +27,6 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
this.InitializeComponent();
if (!AnimationExtensions.IsLightingSupported)
{
WarningText.Visibility = Visibility.Visible;
}
SampleController.Current.RegisterNewCommand("Apply", (s, e) =>
{
_lightBehavior?.StartAnimation();

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

@ -1,138 +0,0 @@
var square44x44Logo = new Windows.Foundation.Uri("ms-appx:///Assets/Square44x44Logo.png");
var square150x150Logo = new Windows.Foundation.Uri("ms-appx:///Assets/Square150x150Logo.png");
var wide310x150Logo = new Windows.Foundation.Uri("ms-appx:///Assets/Wide310x150Logo.png");
var square310x310Logo = new Windows.Foundation.Uri("ms-appx:///Assets/Square310x310Logo.png");
var generateTileBindingMedium = function (username, avatarLogoSource) {
var tileBinding = new Microsoft.Toolkit.Uwp.Notifications.TileBinding();
tileBinding.content = new Microsoft.Toolkit.Uwp.Notifications.TileBindingContentAdaptive();
tileBinding.content.peekImage = new Microsoft.Toolkit.Uwp.Notifications.TilePeekImage();
tileBinding.content.peekImage.source = avatarLogoSource;
tileBinding.content.peekImage.hintCrop = Microsoft.Toolkit.Uwp.Notifications.TilePeekImageCrop.Circle;
tileBinding.content.textStacking = Microsoft.Toolkit.Uwp.Notifications.TileTextStacking.center;
var adaptativeText1 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
adaptativeText1.text = "Hi,";
adaptativeText1.hintAlign = Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextAlign.center;
adaptativeText1.hintStyle = Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextStyle.base;
var adaptativeText2 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
adaptativeText2.text = username;
adaptativeText2.hintAlign = Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextAlign.center;
adaptativeText2.hintStyle = Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextStyle.captionSubtle;
tileBinding.content.children.push(adaptativeText1);
tileBinding.content.children.push(adaptativeText2);
return tileBinding;
};
var generateTileBindingWide = function (username, avatarLogoSource) {
var tileBinding = new Microsoft.Toolkit.Uwp.Notifications.TileBinding();
tileBinding.content = new Microsoft.Toolkit.Uwp.Notifications.TileBindingContentAdaptive();
var group = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveGroup();
var adaptativeSubgroup1 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveSubgroup();
adaptativeSubgroup1.hintWeight = 33;
var adaptativeImage = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveImage();
adaptativeImage.source = avatarLogoSource;
adaptativeImage.hintCrop = Microsoft.Toolkit.Uwp.Notifications.AdaptiveImageCrop.circle;
adaptativeSubgroup1.children.push(adaptativeImage);
var adaptativeSubgroup2 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveSubgroup();
adaptativeSubgroup2.hintTextStacking = Microsoft.Toolkit.Uwp.Notifications.AdaptiveSubgroupTextStacking.center;
var adaptativeText1 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
adaptativeText1.text = "Hi,";
adaptativeText1.hintStyle = Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextStyle.title;
var adaptativeText2 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
adaptativeText2.text = username;
adaptativeText2.hintStyle = Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextStyle.subtitleSubtle;
adaptativeSubgroup2.children.push(adaptativeText1);
adaptativeSubgroup2.children.push(adaptativeText2);
group.children.push(adaptativeSubgroup1);
group.children.push(adaptativeSubgroup2);
tileBinding.content.children.push(group);
return tileBinding;
};
var generateTileBindingLarge = function (username, avatarLogoSource) {
var tileBinding = new Microsoft.Toolkit.Uwp.Notifications.TileBinding();
tileBinding.content = new Microsoft.Toolkit.Uwp.Notifications.TileBindingContentAdaptive();
tileBinding.content.textStacking = Microsoft.Toolkit.Uwp.Notifications.TileTextStacking.center;
var group = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveGroup();
var adaptativeSubgroup1 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveSubgroup();
adaptativeSubgroup1.hintWeight = 1;
// we surround the image by two subgroups so that it doesn't take the full width
var adaptativeSubgroup2 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveSubgroup();
adaptativeSubgroup2.hintWeight = 2;
var adaptativeImage = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveImage();
adaptativeImage.source = avatarLogoSource;
adaptativeImage.hintCrop = Microsoft.Toolkit.Uwp.Notifications.AdaptiveImageCrop.circle;
adaptativeSubgroup2.children.push(adaptativeImage);
var adaptativeSubgroup3 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveSubgroup();
adaptativeSubgroup3.hintWeight = 1;
group.children.push(adaptativeSubgroup1);
group.children.push(adaptativeSubgroup2);
group.children.push(adaptativeSubgroup3);
var adaptativeText1 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
adaptativeText1.text = "Hi,";
adaptativeText1.hintAlign = Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextAlign.center;
adaptativeText1.hintStyle = Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextStyle.title;
var adaptativeText2 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
adaptativeText2.text = username;
adaptativeText2.hintAlign = Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextAlign.center;
adaptativeText2.hintStyle = Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextStyle.subtitleSubtle;
tileBinding.content.children.push(group);
tileBinding.content.children.push(adaptativeText1);
tileBinding.content.children.push(adaptativeText2);
return tileBinding;
};
var generateTileContent = function (username, avatarLogoSource) {
var tileContent = new Microsoft.Toolkit.Uwp.Notifications.TileContent();
tileContent.visual = new Microsoft.Toolkit.Uwp.Notifications.TileVisual();
tileContent.visual.tileMedium = generateTileBindingMedium(username, avatarLogoSource);
tileContent.visual.tileWide = generateTileBindingWide(username, avatarLogoSource);
tileContent.visual.tileLarge = generateTileBindingLarge(username, avatarLogoSource);
return tileContent;
};
var pinTile = function () {
var tile = new Windows.UI.StartScreen.SecondaryTile(new Date().getTime());
tile.displayName = "Xbox";
tile.arguments = "args";
tile.visualElements.square150x150Logo = square150x150Logo;
tile.visualElements.wide310x150Logo = wide310x150Logo;
tile.visualElements.square310x310Logo = square310x310Logo;
tile.visualElements.showNameOnSquare150x150Logo = true;
tile.visualElements.showNameOnSquare310x310Logo = true;
tile.visualElements.showNameOnWide310x150Logo = true;
tile.requestCreateAsync()
.then(function () {
// generate the tile notification content and update the tile
var content = generateTileContent("MasterHip", "Assets/Photos/Owl.jpg");
var tileNotification = new Windows.UI.Notifications.TileNotification(content.getXml());
Windows.UI.Notifications.TileUpdateManager.createTileUpdaterForSecondaryTile(tile.TileId).update(tileNotification);
});
};

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

@ -3,6 +3,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:brushes="using:Microsoft.Toolkit.Uwp.UI.Media"
mc:Ignorable="d">
<Page.Resources>
@ -62,7 +63,10 @@
<controls:Loading x:Name="LoadingControl">
<controls:Loading.Background>
<SolidColorBrush Color="@[Background:Brush:Black]" Opacity="@[Background Opacity:DoubleSlider:0.7:0-1]" />
<brushes:AcrylicBrush BackgroundSource="Backdrop"
TintColor="Black"
TintOpacity="@[Opacity:DoubleSlider:0.4:0.0-1.0]"
BlurAmount="@[BlurAmount:DoubleSlider:8:0.0-24.0]"/>
</controls:Loading.Background>
<ContentControl x:Name="LoadingContentControl" />
</controls:Loading>

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

@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using System.Threading.Tasks;
using Microsoft.Toolkit.Uwp.UI.Animations;
using Microsoft.Toolkit.Uwp.UI.Controls;
using Microsoft.Toolkit.Uwp.UI.Extensions;
using Windows.UI.Xaml;
@ -13,7 +12,6 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
public sealed partial class LoadingPage : IXamlRenderListener
{
private AdaptiveGridView adaptiveGridViewControl;
private Loading loadingControl;
private ContentControl loadingContentControl;
private ResourceDictionary resources;
@ -26,14 +24,13 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
public async void OnXamlRendered(FrameworkElement control)
{
adaptiveGridViewControl = control.FindChildByName("AdaptiveGridViewControl") as AdaptiveGridView;
loadingControl = control.FindDescendantByName("LoadingControl") as Loading;
loadingContentControl = control.FindChildByName("LoadingContentControl") as ContentControl;
resources = control.Resources;
if (adaptiveGridViewControl != null)
if (control.FindChildByName("AdaptiveGridViewControl") is AdaptiveGridView gridView)
{
adaptiveGridViewControl.ItemsSource = await new Data.PhotosDataSource().GetItemsAsync();
gridView.ItemsSource = await new Data.PhotosDataSource().GetItemsAsync();
}
}
@ -57,14 +54,12 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
}
});
SampleController.Current.RegisterNewCommand("Loading control with logo and blurring when requested", async (sender, args) =>
SampleController.Current.RegisterNewCommand("Loading control with logo", async (sender, args) =>
{
if (loadingContentControl != null)
{
loadingContentControl.ContentTemplate = resources["LogoTemplate"] as DataTemplate;
await loadingContentControl.Blur(2, 100).StartAsync();
await ShowLoadingDialogAsync();
await loadingContentControl.Blur(0, 0).StartAsync();
}
});
}
@ -72,7 +67,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
private async Task ShowLoadingDialogAsync()
{
loadingControl.IsLoading = true;
await Task.Delay(3000);
await Task.Delay(5000);
loadingControl.IsLoading = false;
}
}

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

@ -8,7 +8,6 @@
xmlns:textToolbarSamples="using:Microsoft.Toolkit.Uwp.SampleApp.SamplePages.TextToolbarSamples"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:contract7Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,7)"
mc:Ignorable="d">
<Page.Resources>
@ -58,7 +57,7 @@
BorderThickness="1"
BorderBrush="{ThemeResource SystemControlForegroundChromeHighBrush}"
Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}"
contract7Present:SelectionFlyout="{x:Null}"/>
SelectionFlyout="{x:Null}"/>
<Grid x:Name="MD"
Grid.Row="1"
Margin="0, 16"

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

@ -1,53 +0,0 @@
var generateToastContent = function () {
var toastButtonSnooze = new Microsoft.Toolkit.Uwp.Notifications.ToastButtonSnooze();
toastButtonSnooze.selectionBoxId = "snoozeTime";
var toastButtonDismiss = new Microsoft.Toolkit.Uwp.Notifications.ToastButtonDismiss();
var toastSelectionBox = new Microsoft.Toolkit.Uwp.Notifications.ToastSelectionBox("snoozeTime");
toastSelectionBox.defaultSelectionBoxItemId = "15";
toastSelectionBox.items.push(new Microsoft.Toolkit.Uwp.Notifications.ToastSelectionBoxItem("1", "1 minute"));
toastSelectionBox.items.push(new Microsoft.Toolkit.Uwp.Notifications.ToastSelectionBoxItem("15", "15 minutes"));
toastSelectionBox.items.push(new Microsoft.Toolkit.Uwp.Notifications.ToastSelectionBoxItem("60", "1 hour"));
toastSelectionBox.items.push(new Microsoft.Toolkit.Uwp.Notifications.ToastSelectionBoxItem("240", "4 hours"));
toastSelectionBox.items.push(new Microsoft.Toolkit.Uwp.Notifications.ToastSelectionBoxItem("1440", "1 day"));
var toastVisual = new Microsoft.Toolkit.Uwp.Notifications.ToastVisual();
var bindingGeneric = new Microsoft.Toolkit.Uwp.Notifications.ToastBindingGeneric();
var adaptiveText1 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
adaptiveText1.text = "Adaptive Tiles Meeting";
var adaptiveText2 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
adaptiveText2.text = "Conf Room 2001 / Building 135";
var adaptiveText3 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
adaptiveText3.text = "10:00 AM - 10:30 AM";
bindingGeneric.children.push(adaptiveText1);
bindingGeneric.children.push(adaptiveText2);
bindingGeneric.children.push(adaptiveText3);
toastVisual.bindingGeneric = bindingGeneric;
var toastActions = new Microsoft.Toolkit.Uwp.Notifications.ToastActionsCustom();
toastActions.inputs.push(toastSelectionBox);
toastActions.buttons.push(toastButtonSnooze);
toastActions.buttons.push(toastButtonDismiss);
var content = new Microsoft.Toolkit.Uwp.Notifications.ToastContent();
content.launch = "action=viewEvent&eventId=1983";
content.scenario = Microsoft.Toolkit.Uwp.Notifications.ToastScenario.reminder;
content.visual = toastVisual;
content.actions = toastActions;
return content;
};
var popToast = function () {
// generate the toast notification content and pop the toast
var content = generateToastContent();
var toast = new Windows.UI.Notifications.ToastNotification(content.getXml());
Windows.UI.Notifications.ToastNotificationManager.createToastNotifier().show(toast);
};

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

@ -10,15 +10,11 @@
extensions:TitleBarExtensions.ForegroundColor="White"
extensions:TitleBarExtensions.ButtonBackgroundColor="CornflowerBlue"
extensions:TitleBarExtensions.ButtonForegroundColor="White"
extensions:StatusBarExtensions.BackgroundColor="CornflowerBlue"
extensions:StatusBarExtensions.BackgroundOpacity="0.8"
extensions:StatusBarExtensions.ForegroundColor="White"
extensions:StatusBarExtensions.IsVisible="False"
mc:Ignorable="d">
<Grid>
<TextBlock Margin="16">
Modify the XAML to change the Title and (mobile) Status bars.
Modify the XAML to change the Title.
</TextBlock>
</Grid>
</Page>

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

@ -5,10 +5,6 @@
xmlns:extensions="using:Microsoft.Toolkit.Uwp.UI.Extensions"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
extensions:ApplicationViewExtensions.Title="View Extensions"
extensions:StatusBarExtensions.BackgroundColor="Blue"
extensions:StatusBarExtensions.BackgroundOpacity="0.8"
extensions:StatusBarExtensions.ForegroundColor="White"
extensions:StatusBarExtensions.IsVisible="True"
extensions:TitleBarExtensions.BackgroundColor="Blue"
extensions:TitleBarExtensions.ForegroundColor="White"
mc:Ignorable="d">

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

@ -24,9 +24,6 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
base.OnNavigatedFrom(e);
// Reset app back to normal.
StatusBarExtensions.SetIsVisible(this, false);
ApplicationViewExtensions.SetTitle(this, string.Empty);
var lightGreyBrush = (Color)Application.Current.Resources["Grey-04"];

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

@ -1,271 +0,0 @@
var square44x44Logo = new Windows.Foundation.Uri("ms-appx:///Assets/Square44x44Logo.png");
var square150x150Logo = new Windows.Foundation.Uri("ms-appx:///Assets/Square150x150Logo.png");
var wide310x150Logo = new Windows.Foundation.Uri("ms-appx:///Assets/Wide310x150Logo.png");
var square310x310Logo = new Windows.Foundation.Uri("ms-appx:///Assets/Square310x310Logo.png");
var generateLargeSubgroup = function (day, image, high, low) {
// generate the normal subgroup
var subgroup = generateSubgroup(day, image, high, low);
// allow there to be padding around the image
(subgroup.children[1]).hintRemoveMargin = null;
return subgroup;
};
var generateSubgroup = function (day, img, tempHi, tempLo) {
var adaptativeSubgroup = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveSubgroup();
adaptativeSubgroup.hintWeight = 1;
// Day
var dayText = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
dayText.text = day;
dayText.hintAlign = Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextAlign.Center;
// Image
var adaptativeImage = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveImage();
adaptativeImage.source = img;
adaptativeImage.hintRemoveMargin = true;
// High temp
var highTempText = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
highTempText.text = tempHi + "<22>";
highTempText.hintAlign = Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextAlign.Center;
// Low temp
var lowTempText = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
lowTempText.text = tempLo + "<22>";
lowTempText.hintAlign = Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextAlign.Center;
lowTempText.hintStyle = Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextStyle.CaptionSubtle;
adaptativeSubgroup.children.push(dayText);
adaptativeSubgroup.children.push(adaptativeImage);
adaptativeSubgroup.children.push(highTempText);
adaptativeSubgroup.children.push(lowTempText);
return adaptativeSubgroup;
};
var generateLegacyToastText = function (day, weatherEmoji, tempHi, tempLo) {
var adaptativeText = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
adaptativeText.text = `${day} ${weatherEmoji} ${tempHi}<7D> / ${tempLo}<7D>`;
return adaptativeText;
};
var isAdaptiveToastSupported = function () {
switch (Windows.System.Profile.AnalyticsInfo.versionInfo.deviceFamily) {
// desktop and Mobile started supporting adaptive toasts in API contract 3 (Anniversary Update)
case "Windows.Mobile":
case "Windows.Desktop":
return Windows.Foundation.Metadata.ApiInformation.isApiContractPresent("Windows.Foundation.UniversalApiContract", 3);
// other device families do not support adaptive toasts
default:
return false;
}
};
var generateToastContent = function () {
// start by constructing the visual portion of the toast
var binding = new Microsoft.Toolkit.Uwp.Notifications.ToastBindingGeneric();
// we'll always have this summary text on our toast notification
// (it is required that your toast starts with a text element)
var adaptativeText1 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
adaptativeText1.text = "Today will be mostly sunny with a high of 63 and a low of 42.";
binding.children.push(adaptativeText1);
// if Adaptive Toast Notifications are supported
if (isAdaptiveToastSupported()) {
var adaptativeGroup = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveGroup();
adaptativeGroup.children.push(generateSubgroup("Mon", "Mostly Cloudy.png", 63, 42));
adaptativeGroup.children.push(generateSubgroup("Tue", "Cloudy.png", 57, 38));
adaptativeGroup.children.push(generateSubgroup("Wed", "Sunny.png", 59, 43));
adaptativeGroup.children.push(generateSubgroup("Thu", "Sunny.png", 62, 42));
adaptativeGroup.children.push(generateSubgroup("Fri", "Sunny.png", 71, 66));
// use the rich Tile-like visual layout
binding.children.push(adaptativeGroup);
} else {
var adaptativeText2 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
adaptativeText2.text = "Monday ? 63<36> / 42<34>";
var adaptativeText3 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
adaptativeText3.text = "Tuesday ? 57<35> / 38<33>"
// we'll just add two simple lines of text
binding.children.push(adaptativeText2);
binding.children.push(adaptativeText3);
}
// construct the entire notification
var toastContent = new Microsoft.Toolkit.Uwp.Notifications.ToastContent();
toastContent.visual = new Microsoft.Toolkit.Uwp.Notifications.ToastVisual();
// use our binding from above
toastContent.visual.bindingGeneric = binding;
// set the base URI for the images, so we don't redundantly specify the entire path
toastContent.visual.baseUri = new Windows.Foundation.Uri("ms-appx:///Assets/NotificationAssets/");
// include launch string so we know what to open when user clicks toast
toastContent.launch = "action=viewForecast&zip=98008";
return toastContent;
};
var generateTileBindingSmall = function () {
var tileBinding = new Microsoft.Toolkit.Uwp.Notifications.TileBinding();
tileBinding.content = new Microsoft.Toolkit.Uwp.Notifications.TileBindingContentAdaptive();
tileBinding.content.textStacking = Microsoft.Toolkit.Uwp.Notifications.TileTextStacking.Center;
var adaptativeText1 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
adaptativeText1.text = "Mon";
adaptativeText1.hintStyle = Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextStyle.Body;
adaptativeText1.hintAlign = Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextAlign.Center;
var adaptativeText2 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
adaptativeText2.text = "63<36>";
adaptativeText2.hintStyle = Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextStyle.Base;
adaptativeText2.hintAlign = Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextAlign.Center;
tileBinding.content.children.push(adaptativeText1);
tileBinding.content.children.push(adaptativeText2);
return tileBinding;
};
var generateTileBindingMedium = function () {
var tileBinding = new Microsoft.Toolkit.Uwp.Notifications.TileBinding();
tileBinding.content = new Microsoft.Toolkit.Uwp.Notifications.TileBindingContentAdaptive();
var adaptativeGroup = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveGroup()
adaptativeGroup.children.push(generateSubgroup("Mon", "Mostly Cloudy.png", 63, 42));
adaptativeGroup.children.push(generateSubgroup("Tue", "Cloudy.png", 57, 38));
tileBinding.content.children.push(adaptativeGroup);
return tileBinding;
};
var generateTileBindingWide = function () {
var tileBinding = new Microsoft.Toolkit.Uwp.Notifications.TileBinding();
tileBinding.content = new Microsoft.Toolkit.Uwp.Notifications.TileBindingContentAdaptive();
var adaptativeGroup = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveGroup();
adaptativeGroup.children.push(generateSubgroup("Mon", "Mostly Cloudy.png", 63, 42));
adaptativeGroup.children.push(generateSubgroup("Tue", "Cloudy.png", 57, 38));
adaptativeGroup.children.push(generateSubgroup("Wed", "Sunny.png", 59, 43));
adaptativeGroup.children.push(generateSubgroup("Thu", "Sunny.png", 62, 42));
adaptativeGroup.children.push(generateSubgroup("Fri", "Sunny.png", 71, 66));
tileBinding.content.children.push(adaptativeGroup);
return tileBinding;
};
var generateTileBindingLarge = function () {
var tileBinding = new Microsoft.Toolkit.Uwp.Notifications.TileBinding();
tileBinding.content = new Microsoft.Toolkit.Uwp.Notifications.TileBindingContentAdaptive();
// 1. group
var adaptativeGroup1 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveGroup();
var adaptativeSubgroup1 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveSubgroup();
adaptativeSubgroup1.hintWeight = 30;
var adaptativeImage1 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveImage();
adaptativeImage1.source = "Mostly Cloudy.png";
adaptativeSubgroup1.children.push(adaptativeImage1);
var adaptativeSubgroup2 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveSubgroup();
var adaptativeText1 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
adaptativeText1.text = "Monday";
adaptativeText1.hintStyle = Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextStyle.base;
var adaptativeText2 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
adaptativeText2.text = "63<36> / 42<34>";
var adaptativeText3 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
adaptativeText3.text = "20% chance of rain";
adaptativeText3.hintStyle = Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextStyle.captionSubtle;
var adaptativeText4 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText();
adaptativeText4.text = "Winds 5 mph NE";
adaptativeText4.hintStyle = Microsoft.Toolkit.Uwp.Notifications.AdaptiveTextStyle.captionSubtle;
adaptativeSubgroup2.children.push(adaptativeText1);
adaptativeSubgroup2.children.push(adaptativeText2);
adaptativeSubgroup2.children.push(adaptativeText3);
adaptativeSubgroup2.children.push(adaptativeText4);
adaptativeGroup1.children.push(adaptativeSubgroup1);
adaptativeGroup1.children.push(adaptativeSubgroup2);
tileBinding.content.children.push(adaptativeGroup1);
// 2. for spacing
tileBinding.content.children.push(new Microsoft.Toolkit.Uwp.Notifications.AdaptiveText());
// 3. group
var adaptativeGroup2 = new Microsoft.Toolkit.Uwp.Notifications.AdaptiveGroup();
adaptativeGroup2.children.push(generateLargeSubgroup("Tue", "Cloudy.png", 57, 38));
adaptativeGroup2.children.push(generateLargeSubgroup("Wed", "Sunny.png", 59, 43));
adaptativeGroup2.children.push(generateLargeSubgroup("Thu", "Sunny.png", 62, 42));
adaptativeGroup2.children.push(generateLargeSubgroup("Fri", "Sunny.png", 71, 66));
tileBinding.content.children.push(adaptativeGroup2);
return tileBinding;
};
var generateTileContent = function () {
var tileContent = new Microsoft.Toolkit.Uwp.Notifications.TileContent();
tileContent.visual = new Microsoft.Toolkit.Uwp.Notifications.TileVisual();
tileContent.visual.tileSmall = generateTileBindingSmall();
tileContent.visual.tileMedium = generateTileBindingMedium();
tileContent.visual.tileWide = generateTileBindingWide();
tileContent.visual.tileLarge = generateTileBindingLarge();
// set the base URI for the images, so we don't redundantly specify the entire path
tileContent.visual.baseUri = new Windows.Foundation.Uri("ms-appx:///Assets/NotificationAssets/");
return tileContent;
};
var pinTile = function () {
var tile = new Windows.UI.StartScreen.SecondaryTile(new Date().getTime());
tile.displayName = "WeatherSample";
tile.arguments = "args";
tile.visualElements.square150x150Logo = square150x150Logo;
tile.visualElements.wide310x150Logo = wide310x150Logo;
tile.visualElements.square310x310Logo = square310x310Logo;
tile.visualElements.showNameOnSquare150x150Logo = true;
tile.visualElements.showNameOnSquare310x310Logo = true;
tile.visualElements.showNameOnWide310x150Logo = true;
tile.requestCreateAsync()
.then(function () {
// generate the tile notification content and update the tile
var content = generateTileContent();
var tileNotification = new Windows.UI.Notifications.TileNotification(content.getXml());
Windows.UI.Notifications.TileUpdateManager.createTileUpdaterForSecondaryTile(tile.TileId).update(tileNotification);
});
};
var popToast = function () {
// generate the toast notification content and pop the toast
var content = generateToastContent();
var toast = new Windows.UI.Notifications.ToastNotification(content.getXml());
Windows.UI.Notifications.ToastNotificationManager.createToastNotifier().show(toast);
};

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

@ -5,14 +5,11 @@
using System;
using Microsoft.Toolkit.Uwp.Notifications;
using Microsoft.Toolkit.Uwp.SampleApp.Common;
using Microsoft.Toolkit.Uwp.SampleApp.Models;
using NotificationsVisualizerLibrary;
using Windows.Foundation.Metadata;
using Windows.System.Profile;
using Windows.UI.Notifications;
using Windows.UI.StartScreen;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Navigation;
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
@ -119,10 +116,8 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
switch (AnalyticsInfo.VersionInfo.DeviceFamily)
{
// Desktop and Mobile started supporting adaptive toasts in API contract 3 (Anniversary Update)
case "Windows.Mobile":
case "Windows.Desktop":
return ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 3);
return true;
// Other device families do not support adaptive toasts
default:

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

@ -882,7 +882,6 @@
"About": "This shows how to update a Live Tile with a rich Adaptive notification.",
"CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Notifications",
"CodeFile": "LiveTileCode.bind",
"JavaScriptCodeFile": "LiveTileCodeJavaScript.bind",
"Icon": "/SamplePages/LiveTile/LiveTile.png",
"DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/notifications/NotificationsOverview.md"
},
@ -893,7 +892,6 @@
"About": "This shows how to send a Toast notification.",
"CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Notifications",
"CodeFile": "ToastCode.bind",
"JavaScriptCodeFile": "ToastCodeJavaScript.bind",
"Icon": "/SamplePages/Toast/Toast.png",
"DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/notifications/NotificationsOverview.md"
},
@ -904,7 +902,6 @@
"About": "This shows how to send a Weather Live Tile and Toast notification, displaying the forecast.",
"CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.Notifications",
"CodeFile": "WeatherLiveTileAndToastCode.bind",
"JavaScriptCodeFile": "WeatherLiveTileAndToastCodeJavaScript.bind",
"Icon": "/SamplePages/WeatherLiveTileAndToast/WeatherLiveTileAndToast.png",
"DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/notifications/NotificationsOverview.md"
},
@ -1139,7 +1136,7 @@
{
"Name": "ViewExtensions",
"Type": "ViewExtensionsPage",
"About": "View extensions to set StatusBar and TitleBar properties.",
"About": "View extensions to set TitleBar properties.",
"CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Extensions",
"XamlCodeFile": "ViewExtensionsCode.bind",
"Icon": "/SamplePages/ViewExtensions/ViewExtensions.png",

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

@ -6,14 +6,12 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Toolkit.Uwp.Helpers;
using Microsoft.Toolkit.Uwp.SampleApp.Pages;
using Microsoft.Toolkit.Uwp.UI.Animations;
using Microsoft.Toolkit.Uwp.UI.Controls;
using Microsoft.Toolkit.Uwp.UI.Extensions;
using Windows.Foundation.Metadata;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
@ -331,10 +329,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp
if (MoreInfoImage != null && MoreInfoContent.DataContext != null)
{
var animation = ConnectedAnimationService.GetForCurrentView().GetAnimation("sample_icon");
if (ApiInformation.IsTypePresent("Windows.UI.Xaml.Media.Animation.DirectConnectedAnimationConfiguration"))
{
animation.Configuration = new DirectConnectedAnimationConfiguration();
}
_ = SamplePickerGridView.TryStartConnectedAnimationAsync(animation, MoreInfoContent.DataContext, "SampleIcon");
}

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

@ -10,7 +10,6 @@
xmlns:behaviors="using:Microsoft.Toolkit.Uwp.UI.Animations.Behaviors"
xmlns:animations="using:Microsoft.Toolkit.Uwp.UI.Animations"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
extensions:StatusBarExtensions.IsVisible="False"
extensions:TitleBarExtensions.BackgroundColor="{StaticResource Brand-Color}"
extensions:TitleBarExtensions.ButtonBackgroundColor="{StaticResource Brand-Color}"
extensions:TitleBarExtensions.ButtonForegroundColor="{StaticResource Titlebar-Foreground}"

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

@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Windows.Foundation.Metadata;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;
@ -21,8 +20,6 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.Styles
darkTheme = themes.ThemeDictionaries["Dark"] as ResourceDictionary;
lightTheme = themes.ThemeDictionaries["Light"] as ResourceDictionary;
if (ApiInformation.IsTypePresent("Windows.UI.Xaml.Media.AcrylicBrush"))
{
AddAcrylic(new ThemeAcrylic
{
Name = "Background-AboutPage-SidePane",
@ -61,7 +58,6 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.Styles
}
});
}
}
private static void AddAcrylic(ThemeAcrylic resource)
{

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

@ -168,7 +168,7 @@ The value is a string which is the fully-qualified typename to check for the pre
```json
{
//...
"About": "MySample needs 10.0.16299 or higher to work.",
"About": "MySample needs 10.0.18362 or higher to work.",
"ApiCheck": "Windows.UI.Xaml.Controls.NavigationView",
"BadgeUpdateVersionRequired": "Fall Creators Update required",
//...

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

@ -11,8 +11,8 @@
<AssemblyName>Microsoft.Toolkit.Uwp.Samples.BackgroundTasks</AssemblyName>
<DefaultLanguage>fr-FR</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

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

@ -8,19 +8,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
{
internal class ApiInformationHelper
{
private static bool? _isAniversaryUpdateOrAbove;
private static bool? _isCreatorsUpdateOrAbove;
private static bool? _isFallCreatorsUpdateOrAbove;
public static bool IsAniversaryUpdateOrAbove => (bool)(_isAniversaryUpdateOrAbove ??
(_isAniversaryUpdateOrAbove = ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 3)));
public static bool IsCreatorsUpdateOrAbove => (bool)(_isCreatorsUpdateOrAbove ??
(_isCreatorsUpdateOrAbove = ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 4)));
public static bool IsFallCreatorsUpdateOrAbove => (bool)(_isFallCreatorsUpdateOrAbove ??
(_isFallCreatorsUpdateOrAbove = ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5)));
public static bool IsXamlRootAvailable { get; } = ApiInformation.IsPropertyPresent("Windows.UI.Xaml.UIElement", "XamlRoot");
}
}

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

@ -9,17 +9,9 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
/// <summary>
/// Performs an blur animation using composition.
/// </summary>
/// <remarks>
/// <para>
/// Blurs are only supported on Build 1607 and up. Assigning the blur behavior on an older
/// version of Windows will not add any effect. You can use the <see cref="AnimationExtensions.IsBlurSupported"/>
/// property to check for whether blurs are supported on the device at runtime.
/// </para>
/// </remarks>
/// <seealso>
/// <cref>Microsoft.Xaml.Interactivity.Behavior{Windows.UI.Xaml.UIElement}</cref>
/// </seealso>
/// <seealso cref="AnimationExtensions.IsBlurSupported"/>
public class Blur : CompositionBehaviorBase<FrameworkElement>
{
/// <summary>
@ -43,11 +35,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
/// Starts the animation.
/// </summary>
public override void StartAnimation()
{
if (AnimationExtensions.BlurEffect.IsSupported)
{
AssociatedObject?.Blur(duration: Duration, delay: Delay, value: (float)Value, easingType: EasingType, easingMode: EasingMode)?.Start();
}
}
}
}

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

@ -5,7 +5,6 @@
using Microsoft.Toolkit.Uwp.UI.Animations.Expressions;
using Microsoft.Toolkit.Uwp.UI.Behaviors;
using Microsoft.Toolkit.Uwp.UI.Extensions;
using Windows.Foundation.Metadata;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Hosting;
@ -91,13 +90,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
/// <returns><c>true</c> if the assignment was successful; otherwise, <c>false</c>.</returns>
private bool AssignFadeAnimation()
{
// Confirm that Windows.UI.Xaml.Hosting.ElementCompositionPreview is available (Windows 10 10586 or later).
if (!ApiInformation.IsMethodPresent("Windows.UI.Xaml.Hosting.ElementCompositionPreview", nameof(ElementCompositionPreview.GetScrollViewerManipulationPropertySet)))
{
// Just return true since it's not supported
return true;
}
if (AssociatedObject == null)
{
return false;

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

@ -13,7 +13,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
/// Applies a basic point light to a UIElement. You control the intensity by setting the distance of the light.
/// </summary>
/// <seealso cref="Microsoft.Toolkit.Uwp.UI.Animations.Behaviors.CompositionBehaviorBase" />
/// <seealso cref="AnimationExtensions.IsLightingSupported"/>
[Obsolete("The Light effect will be removed in a future major release. Please use XamlLight instead")]
public class Light : CompositionBehaviorBase<FrameworkElement>
@ -53,8 +52,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
/// Starts the animation.
/// </summary>
public override void StartAnimation()
{
if (AnimationExtensions.IsLightingSupported)
{
AssociatedObject?.Light(
duration: Duration,
@ -65,5 +62,4 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
color: ((SolidColorBrush)Color).Color)?.Start();
}
}
}
}

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

@ -6,7 +6,6 @@ using Microsoft.Toolkit.Uwp.UI.Animations.Expressions;
using Microsoft.Toolkit.Uwp.UI.Behaviors;
using Microsoft.Toolkit.Uwp.UI.Extensions;
using Windows.Foundation;
using Windows.Foundation.Metadata;
using Windows.UI.Composition;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
@ -104,13 +103,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
{
StopAnimation();
// Confirm that Windows.UI.Xaml.Hosting.ElementCompositionPreview is available (Windows 10 10586 or later).
if (!ApiInformation.IsMethodPresent("Windows.UI.Xaml.Hosting.ElementCompositionPreview", nameof(ElementCompositionPreview.GetScrollViewerManipulationPropertySet)))
{
// Just return true since it's not supported
return true;
}
if (AssociatedObject == null)
{
return false;

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

@ -37,8 +37,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
/// Starts the animation.
/// </summary>
public override void StartAnimation()
{
if (AnimationExtensions.SaturationEffect.IsSupported)
{
_frameworkElement?.Saturation(
duration: Duration,
@ -47,7 +45,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
easingMode: EasingMode,
value: (float)Value)?.StartAsync();
}
}
/// <summary>
/// Called after the behavior is attached to the <see cref="P:Microsoft.Xaml.Interactivity.Behavior.AssociatedObject" />.

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

@ -6,7 +6,6 @@ using Microsoft.Toolkit.Uwp.UI.Animations.Expressions;
using Microsoft.Toolkit.Uwp.UI.Behaviors;
using Microsoft.Toolkit.Uwp.UI.Extensions;
using Windows.Foundation;
using Windows.Foundation.Metadata;
using Windows.UI.Composition;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
@ -106,13 +105,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors
{
StopAnimation();
// Confirm that Windows.UI.Xaml.Hosting.ElementCompositionPreview is available (Windows 10 10586 or later).
if (!ApiInformation.IsMethodPresent("Windows.UI.Xaml.Hosting.ElementCompositionPreview", nameof(ElementCompositionPreview.GetScrollViewerManipulationPropertySet)))
{
// Just return true since it's not supported
return true;
}
if (AssociatedObject == null)
{
return false;

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

@ -20,18 +20,5 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
{
Target = "Translation";
}
/// <inheritdoc/>
public override CompositionAnimation GetCompositionAnimation(Compositor compositor)
{
if (ApiInformationHelper.IsCreatorsUpdateOrAbove)
{
return base.GetCompositionAnimation(compositor);
}
else
{
return null;
}
}
}
}

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

@ -69,11 +69,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
animation.Target = Target;
animation.Duration = Duration;
animation.DelayTime = Delay;
if (ApiInformationHelper.IsCreatorsUpdateOrAbove)
{
animation.DelayBehavior = SetInitialValueBeforeDelay ? AnimationDelayBehavior.SetInitialValueBeforeDelay : AnimationDelayBehavior.SetInitialValueAfterDelay;
}
if (KeyFrames.Count == 0)
{

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

@ -378,11 +378,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
private static void OnKeyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (!ApiInformationHelper.IsCreatorsUpdateOrAbove)
{
return;
}
var element = d as FrameworkElement;
if (element == null)
{
@ -406,11 +401,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
private static void OnAnchorElementChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (!ApiInformationHelper.IsCreatorsUpdateOrAbove)
{
return;
}
var element = d as FrameworkElement;
if (element == null)
{
@ -434,11 +424,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
private static void OnListItemKeyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (!ApiInformationHelper.IsCreatorsUpdateOrAbove)
{
return;
}
var element = d as Windows.UI.Xaml.Controls.ListViewBase;
if (element == null)
{
@ -462,11 +447,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
private static void OnListItemElementNameChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (!ApiInformationHelper.IsCreatorsUpdateOrAbove)
{
return;
}
var element = d as Windows.UI.Xaml.Controls.ListViewBase;
if (element == null)
{
@ -520,7 +500,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
private static void AddListViewBaseItemAnimationDetails(Page page, Windows.UI.Xaml.Controls.ListViewBase listViewBase)
{
if (ApiInformationHelper.IsCreatorsUpdateOrAbove && listViewBase != null)
if (listViewBase != null)
{
var elementName = GetListItemElementName(listViewBase);
var key = GetListItemKey(listViewBase);

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

@ -5,7 +5,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Windows.Foundation.Metadata;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media.Animation;
@ -34,11 +33,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
throw new ArgumentNullException(nameof(frame));
}
if (!ApiInformationHelper.IsCreatorsUpdateOrAbove)
{
return;
}
frame.Navigating += Frame_Navigating;
frame.Navigated += Frame_Navigated;
}
@ -69,7 +63,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
{
ConnectedAnimation animation = null;
if (props.IsListAnimation && parameter != null && ApiInformationHelper.IsCreatorsUpdateOrAbove)
if (props.IsListAnimation && parameter != null)
{
foreach (var listAnimProperty in props.ListAnimProperties)
{
@ -97,8 +91,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
}
if (animation != null &&
e.NavigationMode == Windows.UI.Xaml.Navigation.NavigationMode.Back &&
ApiInformation.IsTypePresent("Windows.UI.Xaml.Media.Animation.DirectConnectedAnimationConfiguration"))
e.NavigationMode == Windows.UI.Xaml.Navigation.NavigationMode.Back)
{
UseDirectConnectedAnimationConfiguration(animation);
}
@ -147,7 +140,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
var animationHandled = false;
if (connectedAnimation != null)
{
if (props.IsListAnimation && parameter != null && ApiInformationHelper.IsCreatorsUpdateOrAbove)
if (props.IsListAnimation && parameter != null)
{
foreach (var listAnimProperty in props.ListAnimProperties)
{
@ -174,7 +167,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
}
else if (!props.IsListAnimation)
{
if (ApiInformationHelper.IsCreatorsUpdateOrAbove && coordinatedAnimationElements.TryGetValue(props.Element, out var coordinatedElements))
if (coordinatedAnimationElements.TryGetValue(props.Element, out var coordinatedElements))
{
connectedAnimation.TryStart(props.Element, coordinatedElements);
}

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

@ -19,14 +19,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations.Effects
{
private static string[] _effectProperties;
/// <summary>
/// Gets a value indicating whether this instance is supported.
/// </summary>
/// <value>
/// <c>true</c> if this instance is supported; otherwise, <c>false</c>.
/// </value>
public abstract bool IsSupported { get; }
/// <summary>
/// Gets the name of the effect.
/// </summary>
@ -80,11 +72,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations.Effects
return null;
}
if (!IsSupported)
{
return null;
}
var visual = animationSet.Visual;
var associatedObject = animationSet.Element as FrameworkElement;

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

@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using Microsoft.Graphics.Canvas.Effects;
using Windows.Foundation.Metadata;
using Windows.UI.Composition;
namespace Microsoft.Toolkit.Uwp.UI.Animations.Effects
@ -14,15 +13,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations.Effects
/// <seealso cref="Microsoft.Toolkit.Uwp.UI.Animations.Effects.AnimationEffect" />
public class Blur : AnimationEffect
{
/// <summary>
/// Gets a value indicating whether blur is supported.
/// </summary>
/// <value>
/// <c>true</c> if this instance is supported; otherwise, <c>false</c>.
/// </value>
public override bool IsSupported
=> ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 3);
/// <summary>
/// Gets the name of the effect.
/// </summary>

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

@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using Microsoft.Graphics.Canvas.Effects;
using Windows.Foundation.Metadata;
using Windows.UI.Composition;
namespace Microsoft.Toolkit.Uwp.UI.Animations.Effects
@ -14,15 +13,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations.Effects
/// <seealso cref="Microsoft.Toolkit.Uwp.UI.Animations.Effects.AnimationEffect" />
public class Saturation : AnimationEffect
{
/// <summary>
/// Gets a value indicating whether Saturation is supported.
/// </summary>
/// <value>
/// <c>true</c> if this instance is supported; otherwise, <c>false</c>.
/// </value>
public override bool IsSupported
=> ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 3);
/// <summary>
/// Gets the name of the effect.
/// </summary>

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

@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using Microsoft.Toolkit.Uwp.UI.Animations.Effects;
using Windows.Foundation.Metadata;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media.Animation;
@ -22,17 +21,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
/// </value>
public static Blur BlurEffect { get; } = new Blur();
/// <summary>
/// Gets a value indicating whether the platform supports blur.
/// </summary>
/// <remarks>
/// A check should always be made to IsBlurSupported prior to calling Blur,
/// since older operating systems will not support blurs.
/// </remarks>
/// <seealso cref="Blur(FrameworkElement, double, double, double, EasingType, EasingMode)"/>
public static bool IsBlurSupported =>
ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 3); // SDK >= 14393
/// <summary>
/// Animates the Gaussian blur of the UIElement.
/// </summary>
@ -45,7 +33,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
/// <returns>
/// An Animation Set.
/// </returns>
/// <seealso cref="IsBlurSupported" />
public static AnimationSet Blur(
this FrameworkElement associatedObject,
double value = 0d,
@ -75,7 +62,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
/// <returns>
/// An Animation Set.
/// </returns>
/// <seealso cref="IsBlurSupported" />
public static AnimationSet Blur(
this AnimationSet animationSet,
double value = 0d,

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

@ -27,32 +27,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
/// </summary>
private static Dictionary<Visual, PointLight> pointLights = new Dictionary<Visual, PointLight>();
/// <summary>
/// Gets a value indicating whether this instance is lighting supported.
/// </summary>
/// <value>
/// <c>true</c> if this instance is lighting supported; otherwise, <c>false</c>.
/// </value>
public static bool IsLightingSupported
{
get
{
bool lightingSupported = true;
if (!Windows.Foundation.Metadata.ApiInformation.IsMethodPresent("Windows.UI.Xaml.Hosting.ElementCompositionPreview", "SetElementChildVisual"))
{
lightingSupported = false;
}
if (!Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.Composition.CompositionSurfaceBrush"))
{
lightingSupported = false;
}
return lightingSupported;
}
}
/// <summary>
/// Animates a point light and it's distance.
/// </summary>
@ -93,7 +67,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
/// <param name="color">The color of the spotlight.</param>
/// <param name="easingType">The easing function</param>
/// <param name="easingMode">The easing mode</param>
/// <seealso cref="IsLightingSupported" />
/// <returns>
/// An Animation Set.
/// </returns>
@ -107,11 +80,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
EasingType easingType = EasingType.Default,
EasingMode easingMode = EasingMode.EaseOut)
{
if (!IsLightingSupported)
{
return null;
}
if (animationSet == null)
{
return null;

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

@ -118,11 +118,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
private static void ShowAnimationsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (!ApiInformationHelper.IsCreatorsUpdateOrAbove)
{
return;
}
if (e.OldValue is AnimationCollection oldCollection)
{
oldCollection.AnimationCollectionChanged -= ShowCollectionChanged;
@ -139,11 +134,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
private static void HideAnimationsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (!ApiInformationHelper.IsCreatorsUpdateOrAbove)
{
return;
}
if (e.OldValue is AnimationCollection oldCollection)
{
oldCollection.AnimationCollectionChanged -= HideCollectionChanged;
@ -176,11 +166,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
private static void ShowCollectionChanged(object sender, EventArgs e)
{
if (!ApiInformationHelper.IsCreatorsUpdateOrAbove)
{
return;
}
var collection = (AnimationCollection)sender;
if (collection.Parent == null)
{
@ -192,11 +177,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
private static void HideCollectionChanged(object sender, EventArgs e)
{
if (!ApiInformationHelper.IsCreatorsUpdateOrAbove)
{
return;
}
var collection = (AnimationCollection)sender;
if (collection.Parent == null)
{
@ -220,7 +200,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
private static CompositionAnimationGroup GetCompositionAnimationGroup(AnimationCollection collection, UIElement element)
{
if (ApiInformationHelper.IsCreatorsUpdateOrAbove && collection.ContainsTranslationAnimation)
if (collection.ContainsTranslationAnimation)
{
ElementCompositionPreview.SetIsTranslationEnabled(element, true);
}
@ -230,7 +210,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
private static ImplicitAnimationCollection GetImplicitAnimationCollection(AnimationCollection collection, UIElement element)
{
if (ApiInformationHelper.IsCreatorsUpdateOrAbove && collection.ContainsTranslationAnimation)
if (collection.ContainsTranslationAnimation)
{
ElementCompositionPreview.SetIsTranslationEnabled(element, true);
}

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

@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<TargetFramework>uap10.0.16299</TargetFramework>
<TargetFramework>uap10.0.17763</TargetFramework>
<Title>Windows Community Toolkit Animations</Title>
<Description>
This library provides helpers and extensions on top of Windows Composition and XAML storyboards. It is part of the Windows Community Toolkit.

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

@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
using Windows.Foundation.Metadata;
using Windows.UI.Composition;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
@ -19,16 +18,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
private static readonly DependencyProperty ReorderAnimationProperty =
DependencyProperty.RegisterAttached("ReorderAnimation", typeof(bool), typeof(ImplicitAnimationCollection), new PropertyMetadata(null));
/// <summary>
/// Gets a value indicating whether the platform supports the animation.
/// </summary>
/// <remarks>
/// On platforms not supporting the animation, this class has no effect.
/// </remarks>
public static bool IsSupported =>
Windows.ApplicationModel.DesignMode.DesignModeEnabled ? false :
ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 3); // SDK >= 14393
/// <summary>
/// Identifies the Duration attached dependency property.
/// </summary>
@ -57,7 +46,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Animations
private static void OnDurationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (IsSupported == false)
if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
{
return;
}

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

@ -12,21 +12,21 @@
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<AssetTargetFallback>$(AssetTargetFallback);uap10.0.16299</AssetTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);uap10.0.17763</AssetTargetFallback>
</PropertyGroup>
<PropertyGroup>
<TargetPlatformVersion>8.1</TargetPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\Microsoft.Toolkit.Uwp.UI.Controls.DataGrid\bin\Debug\uap10.0.16299\Design\</OutputPath>
<OutputPath>..\Microsoft.Toolkit.Uwp.UI.Controls.DataGrid\bin\Debug\uap10.0.17763\Design\</OutputPath>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>..\Microsoft.Toolkit.Uwp.UI.Controls.DataGrid\bin\Release\uap10.0.16299\Design\</OutputPath>
<OutputPath>..\Microsoft.Toolkit.Uwp.UI.Controls.DataGrid\bin\Release\uap10.0.17763\Design\</OutputPath>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<Optimize>true</Optimize>
@ -113,7 +113,7 @@
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\Microsoft.Toolkit.Uwp.UI.Controls.DataGrid\bin\$(Configuration)\uap10.0.16299\Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.xml">
<EmbeddedResource Include="..\Microsoft.Toolkit.Uwp.UI.Controls.DataGrid\bin\$(Configuration)\uap10.0.17763\Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.xml">
<Link>Microsoft.Toolkit.Uwp.UI.Controls.DataGrid.xml</Link>
<SubType>Designer</SubType>
</EmbeddedResource>

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

@ -5834,7 +5834,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private void DataGrid_PointerMoved(object sender, PointerRoutedEventArgs e)
{
// Don't process if this is a generated replay of the event.
if (TypeHelper.IsRS3OrHigher && e.IsGenerated)
if (e.IsGenerated)
{
return;
}

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

@ -12,8 +12,6 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:contract6NotPresent="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Windows.Foundation.UniversalApiContract,6)"
xmlns:contract6Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,6)"
xmlns:local="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:localprimitives="using:Microsoft.Toolkit.Uwp.UI.Controls.Primitives">
@ -335,11 +333,7 @@
<VisualState x:Name="SeparatorCollapsed"/>
<VisualState x:Name="SeparatorExpanded">
<Storyboard>
<contract6NotPresent:DoubleAnimation Duration="{ThemeResource ScrollBarsSeparatorExpandDuration}"
Storyboard.TargetName="BottomRightCorner"
Storyboard.TargetProperty="Opacity"
To="1"/>
<contract6Present:DoubleAnimation Duration="{ThemeResource ScrollBarsSeparatorExpandDuration}"
<DoubleAnimation Duration="{ThemeResource ScrollBarsSeparatorExpandDuration}"
BeginTime="{ThemeResource ScrollBarsSeparatorExpandBeginTime}"
Storyboard.TargetName="BottomRightCorner"
Storyboard.TargetProperty="Opacity"
@ -348,11 +342,7 @@
</VisualState>
<VisualState x:Name="SeparatorExpandedWithoutAnimation">
<Storyboard>
<contract6NotPresent:DoubleAnimation Duration="0"
Storyboard.TargetName="BottomRightCorner"
Storyboard.TargetProperty="Opacity"
To="1"/>
<contract6Present:DoubleAnimation Duration="0"
<DoubleAnimation Duration="0"
BeginTime="{ThemeResource ScrollBarsSeparatorExpandBeginTime}"
Storyboard.TargetName="BottomRightCorner"
Storyboard.TargetProperty="Opacity"

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

@ -1,6 +1,6 @@
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<TargetFramework>uap10.0.16299</TargetFramework>
<TargetFramework>uap10.0.17763</TargetFramework>
<Title>Windows Community Toolkit Controls DataGrid</Title>
<Description>
This library provides a XAML DataGrid control. It is part of the Windows Community Toolkit.

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

@ -19,7 +19,6 @@ namespace Microsoft.Toolkit.Uwp.Utilities
internal const char RightIndexerToken = ']';
private static bool isAPIsAvailableInitialized = false;
private static bool isRS3OrHigher = false;
private static bool isXamlRootAvailable = false;
// Methods
@ -459,19 +458,6 @@ namespace Microsoft.Toolkit.Uwp.Utilities
return instance == null ? null : instance.GetType();
}
internal static bool IsRS3OrHigher
{
get
{
if (!isAPIsAvailableInitialized)
{
InitializeAPIsAvailable();
}
return isRS3OrHigher;
}
}
internal static bool IsXamlRootAvailable
{
get
@ -487,7 +473,6 @@ namespace Microsoft.Toolkit.Uwp.Utilities
internal static void InitializeAPIsAvailable()
{
isRS3OrHigher = Windows.Foundation.Metadata.ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 5);
isXamlRootAvailable = Windows.Foundation.Metadata.ApiInformation.IsPropertyPresent("Windows.UI.Xaml.UIElement", "XamlRoot");
isAPIsAvailableInitialized = true;
}

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

@ -13,21 +13,21 @@
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<NoWarn>$(NoWarn);0618</NoWarn>
<AssetTargetFallback>$(AssetTargetFallback);uap10.0.16299</AssetTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);uap10.0.17763</AssetTargetFallback>
</PropertyGroup>
<PropertyGroup>
<TargetPlatformVersion>8.1</TargetPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\Microsoft.Toolkit.Uwp.UI.Controls\bin\Debug\uap10.0.16299\Design\</OutputPath>
<OutputPath>..\Microsoft.Toolkit.Uwp.UI.Controls\bin\Debug\uap10.0.17763\Design\</OutputPath>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>..\Microsoft.Toolkit.Uwp.UI.Controls\bin\Release\uap10.0.16299\Design\</OutputPath>
<OutputPath>..\Microsoft.Toolkit.Uwp.UI.Controls\bin\Release\uap10.0.17763\Design\</OutputPath>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<Optimize>true</Optimize>
@ -136,7 +136,7 @@
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\Microsoft.Toolkit.Uwp.UI.Controls\bin\$(Configuration)\uap10.0.16299\Microsoft.Toolkit.Uwp.UI.Controls.xml">
<EmbeddedResource Include="..\Microsoft.Toolkit.Uwp.UI.Controls\bin\$(Configuration)\uap10.0.17763\Microsoft.Toolkit.Uwp.UI.Controls.xml">
<Link>Microsoft.Toolkit.Uwp.UI.Controls.xml</Link>
<SubType>Designer</SubType>
</EmbeddedResource>

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

@ -1,8 +1,8 @@
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<TargetFramework>uap10.0.17134</TargetFramework>
<TargetPlatformVersion Condition="'$(TargetPlatformVersion)' == '' ">10.0.18362.0</TargetPlatformVersion>
<TargetFramework>uap10.0.17763</TargetFramework>
<TargetPlatformVersion Condition="'$(TargetPlatformVersion)' == '' ">10.0.19041.0</TargetPlatformVersion>
<Title>Windows Community Toolkit Layout</Title>
<Description>
This library provides XAML layout controls. It is part of the Windows Community Toolkit.

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

@ -13,21 +13,21 @@
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<NoWarn>$(NoWarn);0618</NoWarn>
<AssetTargetFallback>$(AssetTargetFallback);uap10.0.16299</AssetTargetFallback>
<AssetTargetFallback>$(AssetTargetFallback);uap10.0.17763</AssetTargetFallback>
</PropertyGroup>
<PropertyGroup>
<TargetPlatformVersion>8.1</TargetPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\Microsoft.Toolkit.Uwp.UI.Controls.Markdown\bin\Debug\uap10.0.16299\Design\</OutputPath>
<OutputPath>..\Microsoft.Toolkit.Uwp.UI.Controls.Markdown\bin\Debug\uap10.0.17763\Design\</OutputPath>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>..\Microsoft.Toolkit.Uwp.UI.Controls.Markdown\bin\Release\uap10.0.16299\Design\</OutputPath>
<OutputPath>..\Microsoft.Toolkit.Uwp.UI.Controls.Markdown\bin\Release\uap10.0.17763\Design\</OutputPath>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<Optimize>true</Optimize>
@ -114,7 +114,7 @@
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\Microsoft.Toolkit.Uwp.UI.Controls.Markdown\bin\$(Configuration)\uap10.0.16299\Microsoft.Toolkit.Uwp.UI.Controls.Markdown.xml">
<EmbeddedResource Include="..\Microsoft.Toolkit.Uwp.UI.Controls.Markdown\bin\$(Configuration)\uap10.0.17763\Microsoft.Toolkit.Uwp.UI.Controls.Markdown.xml">
<Link>Microsoft.Toolkit.Uwp.UI.Controls.Markdown.xml</Link>
<SubType>Designer</SubType>
</EmbeddedResource>

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

@ -275,14 +275,11 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
}
ImageSource GetImageSource(Uri imageUrl)
{
if (_isSvgImageSupported)
{
if (Path.GetExtension(imageUrl.AbsolutePath)?.ToLowerInvariant() == ".svg")
{
return new SvgImageSource(imageUrl);
}
}
return new BitmapImage(imageUrl);
}

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

@ -7,11 +7,9 @@ using System.Collections.Generic;
using ColorCode.Styling;
using Microsoft.Toolkit.Uwp.UI.Controls.Markdown.Render;
using Microsoft.Toolkit.Uwp.UI.Helpers;
using Windows.Foundation.Metadata;
using Windows.UI.Text;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Documents;
using Windows.UI.Xaml.Media;
namespace Microsoft.Toolkit.Uwp.UI.Controls
@ -21,9 +19,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
/// </summary>
public partial class MarkdownTextBlock
{
// SvgImageSource was introduced in Creators Update (15063)
private static readonly bool _isSvgImageSupported = ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 4);
// Used to attach the URL to hyperlinks.
private static readonly DependencyProperty HyperlinkUrlProperty =
DependencyProperty.RegisterAttached("HyperlinkUrl", typeof(string), typeof(MarkdownTextBlock), new PropertyMetadata(null));

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

@ -1,6 +1,6 @@
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<TargetFramework>uap10.0.16299</TargetFramework>
<TargetFramework>uap10.0.17763</TargetFramework>
<Title>Windows Community Toolkit Controls Markdown</Title>
<Description>
This library provides a XAML MarkdownTextBlock control, an efficient and extensible control that can parse and render markdown. It is part of the Windows Community Toolkit.

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

@ -388,14 +388,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Markdown.Render
Span span = new Span();
if (TextDecorationsSupported)
{
span.TextDecorations = TextDecorations.Strikethrough;
}
else
{
span.FontFamily = new FontFamily("Consolas");
}
var childContext = new InlineRenderContext(span.Inlines, context)
{
@ -405,22 +398,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Markdown.Render
// Render the children into the inline.
RenderInlineChildren(element.Inlines, childContext);
if (!TextDecorationsSupported)
{
AlterChildRuns(span, (parentSpan, run) =>
{
var text = run.Text;
var builder = new StringBuilder(text.Length * 2);
foreach (var c in text)
{
builder.Append((char)0x0336);
builder.Append(c);
}
run.Text = builder.ToString();
});
}
// Add it to the current inlines
localContext.InlineCollection.Add(span);
}

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

@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using System.Reflection;
using Windows.Foundation.Metadata;
using Windows.UI.Text;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
@ -16,11 +15,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls.Markdown.Render
/// </summary>
public partial class MarkdownRenderer
{
private static bool? _textDecorationsSupported = null;
private static bool TextDecorationsSupported => (bool)(_textDecorationsSupported ??
(_textDecorationsSupported = ApiInformation.IsTypePresent("Windows.UI.Text.TextDecorations")));
/// <summary>
/// Super Hack to retain inertia and passing the Scroll data onto the Parent ScrollViewer.
/// </summary>

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

@ -145,16 +145,9 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
};
}
if (Windows.Foundation.Metadata.ApiInformation.IsMethodPresent("Windows.Media.Core.MediaSource", "CreateFromMediaFrameSource", 1))
{
_mediaPlayer.Source = MediaSource.CreateFromMediaFrameSource(frameSource);
_mediaPlayerElementControl.SetMediaPlayer(_mediaPlayer);
}
else
{
InvokePreviewFailed("CameraPreview is only supported on the April 2018 Windows 10 Update or later");
}
}
}
catch (Exception ex)
{

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

@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Windows.ApplicationModel;
using Windows.Foundation.Metadata;
using Windows.UI;
using Windows.UI.Composition;
using Windows.UI.Xaml;
@ -58,15 +56,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
public static readonly DependencyProperty IsMaskedProperty =
DependencyProperty.Register(nameof(IsMasked), typeof(bool), typeof(DropShadowPanel), new PropertyMetadata(true, OnIsMaskedChanged));
/// <summary>
/// Gets a value indicating whether the platform supports drop shadows.
/// </summary>
/// <remarks>
/// On platforms not supporting drop shadows, this control has no effect.
/// </remarks>
public static bool IsSupported =>
(!DesignTimeHelpers.IsRunningInLegacyDesignerMode) && ApiInformation.IsTypePresent("Windows.UI.Composition.DropShadow"); // SDK >= 14393
/// <summary>
/// Gets DropShadow. Exposes the underlying composition object to allow custom Windows.UI.Composition animations.
/// </summary>
@ -202,7 +191,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private static void OnBlurRadiusChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (IsSupported && d is DropShadowPanel panel)
if (!DesignTimeHelpers.IsRunningInLegacyDesignerMode && d is DropShadowPanel panel)
{
panel.OnBlurRadiusChanged((double)e.NewValue);
}
@ -210,7 +199,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private static void OnColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (IsSupported && d is DropShadowPanel panel)
if (!DesignTimeHelpers.IsRunningInLegacyDesignerMode && d is DropShadowPanel panel)
{
panel.OnColorChanged((Color)e.NewValue);
}
@ -218,7 +207,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private static void OnOffsetXChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (IsSupported && d is DropShadowPanel panel)
if (!DesignTimeHelpers.IsRunningInLegacyDesignerMode && d is DropShadowPanel panel)
{
panel.OnOffsetXChanged((double)e.NewValue);
}
@ -226,7 +215,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private static void OnOffsetYChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (IsSupported && d is DropShadowPanel panel)
if (!DesignTimeHelpers.IsRunningInLegacyDesignerMode && d is DropShadowPanel panel)
{
panel.OnOffsetYChanged((double)e.NewValue);
}
@ -234,7 +223,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private static void OnOffsetZChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (IsSupported && d is DropShadowPanel panel)
if (!DesignTimeHelpers.IsRunningInLegacyDesignerMode && d is DropShadowPanel panel)
{
panel.OnOffsetZChanged((double)e.NewValue);
}
@ -242,7 +231,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private static void OnShadowOpacityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (IsSupported && d is DropShadowPanel panel)
if (!DesignTimeHelpers.IsRunningInLegacyDesignerMode && d is DropShadowPanel panel)
{
panel.OnShadowOpacityChanged((double)e.NewValue);
}
@ -250,7 +239,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private static void OnIsMaskedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (IsSupported && d is DropShadowPanel panel)
if (!DesignTimeHelpers.IsRunningInLegacyDesignerMode && d is DropShadowPanel panel)
{
panel.UpdateShadowMask();
}

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

@ -34,7 +34,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
{
this.DefaultStyleKey = typeof(DropShadowPanel);
if (IsSupported)
if (!DesignTimeHelpers.IsRunningInLegacyDesignerMode)
{
Compositor compositor = ElementCompositionPreview.GetElementVisual(this).Compositor;
@ -50,7 +50,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
/// </summary>
protected override void OnApplyTemplate()
{
if (!IsSupported)
if (DesignTimeHelpers.IsRunningInLegacyDesignerMode)
{
return;
}
@ -93,7 +93,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private void OnSizeChanged(object sender, SizeChangedEventArgs e)
{
if (IsSupported)
if (!DesignTimeHelpers.IsRunningInLegacyDesignerMode)
{
UpdateShadowSize();
}
@ -103,7 +103,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
{
UpdateShadowMask();
if (IsSupported)
if (!DesignTimeHelpers.IsRunningInLegacyDesignerMode)
{
UpdateShadowSize();
}
@ -127,7 +127,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private void OnOffsetXChanged(double newValue)
{
if (IsSupported && _dropShadow != null)
if (!DesignTimeHelpers.IsRunningInLegacyDesignerMode && _dropShadow != null)
{
UpdateShadowOffset((float)newValue, _dropShadow.Offset.Y, _dropShadow.Offset.Z);
}
@ -135,7 +135,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private void OnOffsetYChanged(double newValue)
{
if (IsSupported && _dropShadow != null)
if (!DesignTimeHelpers.IsRunningInLegacyDesignerMode && _dropShadow != null)
{
UpdateShadowOffset(_dropShadow.Offset.X, (float)newValue, _dropShadow.Offset.Z);
}
@ -143,7 +143,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private void OnOffsetZChanged(double newValue)
{
if (IsSupported && _dropShadow != null)
if (!DesignTimeHelpers.IsRunningInLegacyDesignerMode && _dropShadow != null)
{
UpdateShadowOffset(_dropShadow.Offset.X, _dropShadow.Offset.Y, (float)newValue);
}
@ -159,7 +159,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
private void UpdateShadowMask()
{
if (!IsSupported)
if (DesignTimeHelpers.IsRunningInLegacyDesignerMode)
{
return;
}

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

@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
using Windows.Foundation.Metadata;
using Windows.UI.Composition;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;
@ -56,11 +55,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
/// </summary>
public static readonly DependencyProperty EnableLazyLoadingProperty = DependencyProperty.Register(nameof(EnableLazyLoading), typeof(bool), typeof(ImageExBase), new PropertyMetadata(false));
/// <summary>
/// Gets a value indicating whether <see cref="EnableLazyLoading"/> is supported
/// </summary>
public static bool IsLazyLoadingSupported { get; } = ApiInformation.IsEventPresent("Windows.UI.Xaml.FrameworkElement", nameof(EffectiveViewportChanged));
/// <summary>
/// Returns a mask that represents the alpha channel of an image as a <see cref="CompositionBrush"/>
/// </summary>

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

@ -48,8 +48,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
}
if (e.OldValue == null || e.NewValue == null || !e.OldValue.Equals(e.NewValue))
{
if (IsLazyLoadingSupported)
{
if (e.NewValue == null || !control.EnableLazyLoading || control._isInViewport)
{
@ -61,11 +59,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
control._lazyLoadingSource = e.NewValue;
}
}
else
{
control.SetSource(e.NewValue);
}
}
}
private static bool IsHttpUri(Uri uri)

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

@ -80,11 +80,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
{
LockObj = new object();
if (IsLazyLoadingSupported)
{
EffectiveViewportChanged += ImageExBase_EffectiveViewportChanged;
}
}
/// <summary>
/// Attach image opened event handler
@ -177,8 +174,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
ImageExInitialized?.Invoke(this, EventArgs.Empty);
if (IsLazyLoadingSupported)
{
if (Source == null || !EnableLazyLoading || _isInViewport)
{
_lazyLoadingSource = null;
@ -188,11 +183,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
{
_lazyLoadingSource = Source;
}
}
else
{
SetSource(Source);
}
AttachImageOpened(OnImageOpened);
AttachImageFailed(OnImageFailed);

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

@ -1,7 +1,5 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:contract7NotPresent="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Windows.Foundation.UniversalApiContract,7)"
xmlns:contract7Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,7)"
xmlns:local="using:Microsoft.Toolkit.Uwp.UI.Controls">
<ResourceDictionary.MergedDictionaries>
@ -11,7 +9,7 @@
<Style x:Key="BaseInAppNotificationsStyle"
TargetType="local:InAppNotification">
<Setter Property="Background" Value="{ThemeResource SystemControlBackgroundChromeMediumBrush}" />
<Setter Property="Background" Value="{ThemeResource SystemControlChromeMediumLowAcrylicElementMediumBrush}" />
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseLowBrush}" />
<Setter Property="Visibility" Value="Collapsed" />
@ -35,13 +33,6 @@
<Setter Property="Template" Value="{StaticResource MSEdgeNotificationTemplate}" />
</Style>
<contract7NotPresent:Style BasedOn="{StaticResource BaseInAppNotificationsStyle}"
TargetType="local:InAppNotification">
<Setter Property="Background" Value="{ThemeResource SystemControlBackgroundChromeMediumLowBrush}" />
</contract7NotPresent:Style>
<Style BasedOn="{StaticResource BaseInAppNotificationsStyle}" TargetType="local:InAppNotification"/>
<contract7Present:Style BasedOn="{StaticResource BaseInAppNotificationsStyle}"
TargetType="local:InAppNotification">
<Setter Property="Background" Value="{ThemeResource SystemControlChromeMediumLowAcrylicElementMediumBrush}" />
</contract7Present:Style>
</ResourceDictionary>

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

@ -1,9 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:local="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:contract5Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,5)"
xmlns:contract5NotPresent="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Windows.Foundation.UniversalApiContract,5)">
xmlns:local="using:Microsoft.Toolkit.Uwp.UI.Controls">
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
@ -11,8 +9,7 @@
<SolidColorBrush x:Key="SystemControlButtonBorderBrushPointerOver" Color="{StaticResource SystemBaseLowColor}" />
<SolidColorBrush x:Key="SystemControlButtonForegroundPointerOver" Color="{StaticResource SystemBaseHighColor}" />
<SolidColorBrush x:Key="SystemControlBackgroundBrush" Color="Transparent" />
<contract5NotPresent:SolidColorBrush x:Key="SystemControlFlyoutBackgroundBrush" Color="{StaticResource SystemChromeMediumLowColor}" />
<contract5Present:AcrylicBrush x:Key="SystemControlFlyoutBackgroundBrush"
<AcrylicBrush x:Key="SystemControlFlyoutBackgroundBrush"
BackgroundSource="Backdrop"
TintColor="{StaticResource SystemChromeMediumLowColor}"
TintOpacity="0.8"

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

@ -9,7 +9,6 @@ using System.Text;
using Microsoft.Toolkit.Uwp.UI.Extensions;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Foundation.Metadata;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
@ -27,8 +26,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
{
private const string FlyoutButtonName = "FlyoutButton";
private const char UnderlineCharacter = '^';
private readonly bool _isAccessKeySupported = ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 3);
private readonly bool _isTextTextDecorationsSupported = ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 4);
private Menu _parentMenu;
private bool _isOpened;
private bool _menuFlyoutRepositioned;
@ -130,12 +127,9 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
IsEnabledChanged += MenuItem_IsEnabledChanged;
if (_isAccessKeySupported)
{
FlyoutButton.AccessKey = AccessKey;
AccessKey = string.Empty;
}
}
if (_parentMenu?.CurrentFlyoutPlacement != null)
{
@ -464,10 +458,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
Text = underlinedCharacter.ToString()
};
if (_isTextTextDecorationsSupported)
{
runWithUnderlinedCharacter.TextDecorations = Windows.UI.Text.TextDecorations.Underline;
}
var firstPartBuilder = new StringBuilder();
var secondPartBuilder = new StringBuilder();

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

@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<TargetFramework>uap10.0.16299</TargetFramework>
<TargetFramework>uap10.0.17763</TargetFramework>
<Title>Windows Community Toolkit Controls</Title>
<Description>
This library provides XAML templated controls. It is part of the Windows Community Toolkit.

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

@ -13,13 +13,11 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
using Microsoft.Toolkit.Uwp.UI.Animations.Expressions;
using Microsoft.Toolkit.Uwp.UI.Extensions;
using Windows.Foundation;
using Windows.Foundation.Metadata;
using Windows.UI.Composition;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Hosting;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Shapes;
/// <summary>
/// Orientation of the scroll

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

@ -7,10 +7,8 @@ using System.Collections.Generic;
using System.Linq;
using Microsoft.Toolkit.Extensions;
using Windows.Foundation;
using Windows.Foundation.Metadata;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
namespace Microsoft.Toolkit.Uwp.UI.Controls
{
@ -19,9 +17,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
/// </summary>
public partial class UniformGrid : Grid
{
// Guard for 15063 as Grid Spacing only works on 16299+.
private static bool _hasGridSpacing = ApiInformation.IsPropertyPresent("Windows.UI.Xaml.Controls.Grid", "ColumnSpacing");
// Internal list we use to keep track of items that we don't have space to layout.
private List<UIElement> _overflow = new List<UIElement>();
@ -70,12 +65,8 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls
double columnSpacingSize = 0;
double rowSpacingSize = 0;
// Guard for 15063 as Grid Spacing only works on 16299+.
if (_hasGridSpacing)
{
columnSpacingSize = ColumnSpacing * (columns - 1);
rowSpacingSize = RowSpacing * (rows - 1);
}
Size childSize = new Size(
(availableSize.Width - columnSpacingSize) / columns,

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

@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<TargetFramework>uap10.0.16299</TargetFramework>
<TargetFramework>uap10.0.17763</TargetFramework>
<LangVersion>8.0</LangVersion>
<Title>Windows Community Toolkit UI Media</Title>
<Description>

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

@ -1,165 +0,0 @@
// 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.UI;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace Microsoft.Toolkit.Uwp.UI.Extensions
{
/// <summary>
/// Provides attached dependency properties for interacting with the <see cref="StatusBar"/> on a window (app view).
/// </summary>
public static class StatusBarExtensions
{
/// <summary>
/// Gets a value indicating whether StatusBar is supported or not.
/// </summary>
public static bool IsStatusBarSupported => Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar");
/// <summary>
/// Gets Color for StatusBar.BackgroundColor
/// </summary>
/// <param name="page">The <see cref="Page"/></param>
/// <returns>Color</returns>
public static Color GetBackgroundColor(Page page)
{
Color color;
var statusBar = GetStatusBar();
if (statusBar != null)
{
color = statusBar.BackgroundColor.GetValueOrDefault();
}
return color;
}
/// <summary>
/// Sets Color to StatusBar.BackgroundColor
/// </summary>
/// <param name="page">The <see cref="Page"/></param>
/// <param name="value">Color</param>
public static void SetBackgroundColor(Page page, Color value)
{
var statusBar = GetStatusBar();
if (statusBar != null)
{
statusBar.BackgroundColor = value;
}
}
/// <summary>
/// Gets Color from StatusBar.ForegroundColor
/// </summary>
/// <param name="page">The <see cref="Page"/></param>
/// <returns>Color</returns>
public static Color GetForegroundColor(Page page)
{
Color color;
var statusBar = GetStatusBar();
if (statusBar != null)
{
color = statusBar.ForegroundColor.GetValueOrDefault();
}
return color;
}
/// <summary>
/// Sets Color to StatusBar.ForegroundColor
/// </summary>
/// <param name="page">The <see cref="Page"/></param>
/// <param name="value"> Color</param>
public static void SetForegroundColor(Page page, Color value)
{
var statusBar = GetStatusBar();
if (statusBar != null)
{
statusBar.ForegroundColor = value;
}
}
/// <summary>
/// Gets <see cref="double"/> from StatusBar.BackgroundOpacity
/// </summary>
/// <param name="page">The <see cref="Page"/></param>
/// <returns><see cref="double"/></returns>
public static double GetBackgroundOpacity(Page page)
{
return GetStatusBar()?.BackgroundOpacity ?? 0;
}
/// <summary>
/// Sets <see cref="double"/> to StatusBar.BackgroundOpacity
/// </summary>
/// <param name="page">The <see cref="Page"/></param>
/// <param name="value"><see cref="double"/></param>
public static void SetBackgroundOpacity(Page page, double value)
{
var statusBar = GetStatusBar();
if (statusBar != null)
{
statusBar.BackgroundOpacity = value;
}
}
/// <summary>
/// Gets <see cref="bool"/> indicating whether <see cref="StatusBar"/> is visible or not.
/// </summary>
/// <param name="page">The <see cref="Page"/></param>
/// <returns><see cref="bool"/></returns>
public static bool GetIsVisible(Page page)
{
var statusBar = GetStatusBar();
return statusBar?.OccludedRect.Height > 0;
}
/// <summary>
/// Sets a <see cref="bool"/> resulting in <see cref="StatusBar"/> becoming visible or invisible.
/// </summary>
/// <param name="page">The <see cref="Page"/></param>
/// <param name="value"><see cref="bool"/></param>
public static void SetIsVisible(Page page, bool value)
{
page.SetValue(IsVisibleProperty, value);
}
/// <summary>
/// Using a DependencyProperty as the backing store for IsVisible. This enables animation, styling, binding, etc...
/// </summary>
public static readonly DependencyProperty IsVisibleProperty =
DependencyProperty.RegisterAttached("IsVisible", typeof(bool), typeof(StatusBarExtensions), new PropertyMetadata(true, OnIsVisibleChanged));
private static async void OnIsVisibleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var statusBar = GetStatusBar();
if (statusBar == null)
{
return;
}
bool isVisible = (bool)e.NewValue;
if (isVisible)
{
await statusBar.ShowAsync();
}
else
{
await statusBar.HideAsync();
}
}
private static Windows.UI.ViewManagement.StatusBar GetStatusBar()
{
return IsStatusBarSupported ? Windows.UI.ViewManagement.StatusBar.GetForCurrentView() : null;
}
}
}

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

@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Windows.Foundation.Metadata;
using Windows.UI.Input;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
@ -230,11 +229,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Extensions
{
get
{
if (!ApiInformation.IsTypePresent("Windows.UI.Input.RadialController"))
{
return false;
}
if (!RadialController.IsSupported())
{
return false;

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

@ -13,11 +13,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Extensions
/// </summary>
public static class TitleBarExtensions
{
/// <summary>
/// Gets a value indicating whether TitleBar is supported or not.
/// </summary>
public static bool IsTitleBarSupported => Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.ApplicationViewTitleBar");
/// <summary>
/// Gets Color for <see cref="ApplicationViewTitleBar.BackgroundColor"/>
/// </summary>
@ -404,7 +399,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Extensions
private static ApplicationViewTitleBar GetTitleBar()
{
return IsTitleBarSupported ? ApplicationView.GetForCurrentView()?.TitleBar : null;
return ApplicationView.GetForCurrentView()?.TitleBar;
}
}
}

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

@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
using System;
using System.Reflection;
namespace Microsoft.Toolkit.Uwp.UI
{
@ -55,24 +54,7 @@ namespace Microsoft.Toolkit.Uwp.UI
/// <returns>True if called from code running inside a XAML designer that targets the Windows 10 Fall Creators Update, or later; otherwise false.</returns>
private static bool InitializeDesignMode2()
{
bool designMode2Enabled = false;
try
{
// The reflection below prevents the code to take a direct dependency on Fall Creators Update SDK
if (Windows.Foundation.Metadata.ApiInformation.IsPropertyPresent("Windows.ApplicationModel.DesignMode", "DesignMode2Enabled"))
{
var prop = typeof(Windows.ApplicationModel.DesignMode).GetProperty("DesignMode2Enabled");
if (prop != null && prop.PropertyType == typeof(bool))
{
designMode2Enabled = (bool)prop.GetValue(null);
}
}
}
catch
{
}
return designMode2Enabled;
return Windows.ApplicationModel.DesignMode.DesignMode2Enabled;
}
}
}

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

@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<TargetFramework>uap10.0.16299</TargetFramework>
<TargetFramework>uap10.0.17763</TargetFramework>
<LangVersion>8.0</LangVersion>
<Title>Windows Community Toolkit UI</Title>
<Description>
@ -30,7 +30,6 @@
- ScaleTransformExtensions: Extension methods for ScaleTransform.
- ScrollViewerExtensions: Provides attached dependency properties for the ListViewBase
- SkewTransformExtensions: Extension methods for SkewTransform.
- StatusBarExtensions: Provides attached dependency properties for interacting with the StatusBar on a window (app view).
- SurfaceDialTextbox: Helper class that provides attached properties to enable any TextBox with the Surface Dial.
- TextBoxMask: TextBox mask property allows a user to more easily enter fixed width text in TextBox control.
- TextBoxRegex: TextBoxRegex allows text validation using a regular expression.
@ -47,9 +46,6 @@
<PackageTags>UWP Toolkit Windows UI Converters XAML extensions helpers</PackageTags>
<UseWindowsDesktopSdk>true</UseWindowsDesktopSdk>
<!-- For StatusBar -->
<UseWindowsMobileSdk>true</UseWindowsMobileSdk>
</PropertyGroup>
<ItemGroup>

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

@ -131,10 +131,7 @@ namespace Microsoft.Toolkit.Uwp.Helpers
if (PreviewFrameSource != null)
{
_frameReader = await _mediaCapture.CreateFrameReaderAsync(PreviewFrameSource);
if (Windows.Foundation.Metadata.ApiInformation.IsPropertyPresent("Windows.Media.Capture.Frames.MediaFrameReader", "AcquisitionMode"))
{
_frameReader.AcquisitionMode = MediaFrameReaderAcquisitionMode.Realtime;
}
_frameReader.FrameArrived += Reader_FrameArrived;

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

@ -4,7 +4,6 @@
using System;
using System.Threading;
using Windows.Foundation.Metadata;
using Windows.Graphics.Imaging;
using Windows.Media;
@ -29,9 +28,7 @@ namespace Microsoft.Toolkit.Uwp.Helpers
_semaphore.Wait();
// The VideoFrame could be disposed at any time so we need to create a copy we can use.
// This API is only available on 17134 so we return the original VideoFrame on older versions.
if (_videoFrameCopy == null &&
ApiInformation.IsMethodPresent("Windows.Media.VideoFrame", "CreateWithSoftwareBitmap", 1) &&
_videoFrame != null &&
_videoFrame.SoftwareBitmap != null)
{

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

@ -6,10 +6,8 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Windows.Foundation.Metadata;
using Windows.System;
using Windows.System.RemoteSystems;
using Windows.System.Threading;
namespace Microsoft.Toolkit.Uwp.Helpers
{
@ -73,18 +71,7 @@ namespace Microsoft.Toolkit.Uwp.Helpers
_remoteSystemWatcher.RemoteSystemAdded += RemoteSystemWatcher_RemoteSystemAdded;
_remoteSystemWatcher.RemoteSystemRemoved += RemoteSystemWatcher_RemoteSystemRemoved;
_remoteSystemWatcher.RemoteSystemUpdated += RemoteSystemWatcher_RemoteSystemUpdated;
if (ApiInformation.IsEventPresent("Windows.System.RemoteSystems.RemoteSystemWatcher", "EnumerationCompleted"))
{
_remoteSystemWatcher.EnumerationCompleted += RemoteSystemWatcher_EnumerationCompleted;
}
else
{
ThreadPoolTimer.CreateTimer(
(e) =>
{
RemoteSystemWatcher_EnumerationCompleted(_remoteSystemWatcher, null);
}, TimeSpan.FromSeconds(2));
}
_remoteSystemWatcher.Start();
}

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

@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras">
<PropertyGroup>
<TargetFramework>uap10.0.16299</TargetFramework>
<TargetFramework>uap10.0.17763</TargetFramework>
<Title>Windows Community Toolkit</Title>
<Description>This package includes code only helpers such as Colors conversion tool, Storage file handling, a Stream helper class, etc.</Description>
<PackageTags>UWP Toolkit Windows</PackageTags>

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

@ -77,6 +77,87 @@ namespace UnitTests.HighPerformance.Helpers
Assert.AreEqual(flag, BitHelper.HasLookupFlag(mask, x, 40));
}
[TestCategory("BitHelper")]
[TestMethod]
[DataRow(0x0000_0000u, true)]
[DataRow(0x0000_0001u, true)]
[DataRow(0x0000_0011u, true)]
[DataRow(0x0011_1111u, true)]
[DataRow(0x1100_1111u, true)]
[DataRow(0x1011_0011u, true)]
[DataRow(0x1755_0055u, true)]
[DataRow(0x0055_B255u, true)]
[DataRow(0x1755_B200u, true)]
[DataRow(0x1111_1111u, false)]
[DataRow(0x1755_B255u, false)]
[DataRow(0x1705_B255u, false)]
[DataRow(0x1755_B055u, false)]
public void Test_BitHelper_HasZeroByte_UInt32(uint x, bool result)
{
Assert.AreEqual(result, BitHelper.HasZeroByte(x));
}
[TestCategory("BitHelper")]
[TestMethod]
[DataRow(0x0000_0000_0000_0000ul, true)]
[DataRow(0x0000_0000_0000_0001ul, true)]
[DataRow(0x0000_0000_0000_0011ul, true)]
[DataRow(0x0011_1111_1111_1111ul, true)]
[DataRow(0x1111_0011_1111_1111ul, true)]
[DataRow(0x7234_AB00_DEAD_BEEFul, true)]
[DataRow(0x7234_A542_DEAD_BEEFul, false)]
[DataRow(0x1111_1111_1111_1111ul, false)]
[DataRow(0x7234_A542_DEAD_B0EFul, false)]
[DataRow(0x7030_A040_0E0D_B0E0ul, false)]
public void Test_BitHelper_HasZeroByte_UInt64(ulong x, bool result)
{
Assert.AreEqual(result, BitHelper.HasZeroByte(x));
}
[TestCategory("BitHelper")]
[TestMethod]
[DataRow(0x0000_0000u, 0x7B, false)]
[DataRow(0x0000_0001u, 0x7B, false)]
[DataRow(0x0000_1010u, 0x7B, false)]
[DataRow(0x0111_7A00u, 0x7B, false)]
[DataRow(0x0000_07B0u, 0x7B, false)]
[DataRow(0x1111_1111u, 0x7B, false)]
[DataRow(0x0000_FEFEu, 0xFF, false)]
[DataRow(0xF00F_0FF0u, 0xFF, false)]
[DataRow(0x0000_0000u, 0x00, true)]
[DataRow(0x0000_007Bu, 0x7B, true)]
[DataRow(0x0000_7B7Bu, 0x7B, true)]
[DataRow(0x7B00_0110u, 0x7B, true)]
[DataRow(0x00FF_0000u, 0xFF, true)]
[DataRow(0xFFFF_FFFFu, 0xFF, true)]
[DataRow(0x1515_1515u, 0x15, true)]
public void Test_BitHelper_HasByteEqualTo_UInt32(uint x, int target, bool result)
{
Assert.AreEqual(result, BitHelper.HasByteEqualTo(x, unchecked((byte)target)));
}
[TestCategory("BitHelper")]
[TestMethod]
[DataRow(0x0000_0000_0000_0000u, 0x7B, false)]
[DataRow(0x0000_0000_0000_0001u, 0x7B, false)]
[DataRow(0x0000_0000_0000_1010u, 0x7B, false)]
[DataRow(0x0111_0000_0000_7A00u, 0x7B, false)]
[DataRow(0x0000_0000_0000_07B0u, 0x7B, false)]
[DataRow(0x1111_1111_0000_0000u, 0x7B, false)]
[DataRow(0x0000_FEFE_0000_0000u, 0xFF, false)]
[DataRow(0xF00F_0000_0000_0FF0u, 0xFF, false)]
[DataRow(0x0000_0000_0000_0000u, 0x00, true)]
[DataRow(0x0000_0000_0000_007Bu, 0x7B, true)]
[DataRow(0x0000_7B7B_0000_0000u, 0x7B, true)]
[DataRow(0x7B00_0110_0000_0000u, 0x7B, true)]
[DataRow(0x00FF_0000_0000_0000u, 0xFF, true)]
[DataRow(0xFFFF_FFFF_FFFF_FFFFu, 0xFF, true)]
[DataRow(0x1515_1515_1515_1515u, 0x15, true)]
public void Test_BitHelper_HasByteEqualTo_UInt64(ulong x, int target, bool result)
{
Assert.AreEqual(result, BitHelper.HasByteEqualTo(x, unchecked((byte)target)));
}
[TestCategory("BitHelper")]
[TestMethod]
public void Test_BitHelper_SetFlag_UInt32()

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

@ -11,8 +11,8 @@
<AssemblyName>UnitTests.HighPerformance.UWP</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.17763.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

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

@ -11,8 +11,8 @@
<AssemblyName>UnitTests.Notifications.UWP</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

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

@ -11,8 +11,8 @@
<AssemblyName>UnitTests.Notifications.WinRT</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

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

@ -11,8 +11,8 @@
<AssemblyName>UnitTests.UWP</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше