diff options
Diffstat (limited to 'general/WinHEC 2017 Lab/Toaster Support App')
39 files changed, 3687 insertions, 0 deletions
diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App.sln b/general/WinHEC 2017 Lab/Toaster Support App/App.sln new file mode 100644 index 00000000..8d28827e --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CustomCapability", "App\CustomCapability\cpp\CustomCapability.vcxproj", "{0213712B-62E6-5546-8D25-79B90244FFA9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0213712B-62E6-5546-8D25-79B90244FFA9}.Debug|ARM.ActiveCfg = Debug|ARM + {0213712B-62E6-5546-8D25-79B90244FFA9}.Debug|ARM.Build.0 = Debug|ARM + {0213712B-62E6-5546-8D25-79B90244FFA9}.Debug|ARM.Deploy.0 = Debug|ARM + {0213712B-62E6-5546-8D25-79B90244FFA9}.Debug|x64.ActiveCfg = Debug|x64 + {0213712B-62E6-5546-8D25-79B90244FFA9}.Debug|x64.Build.0 = Debug|x64 + {0213712B-62E6-5546-8D25-79B90244FFA9}.Debug|x64.Deploy.0 = Debug|x64 + {0213712B-62E6-5546-8D25-79B90244FFA9}.Debug|x86.ActiveCfg = Debug|Win32 + {0213712B-62E6-5546-8D25-79B90244FFA9}.Debug|x86.Build.0 = Debug|Win32 + {0213712B-62E6-5546-8D25-79B90244FFA9}.Debug|x86.Deploy.0 = Debug|Win32 + {0213712B-62E6-5546-8D25-79B90244FFA9}.Release|ARM.ActiveCfg = Release|ARM + {0213712B-62E6-5546-8D25-79B90244FFA9}.Release|ARM.Build.0 = Release|ARM + {0213712B-62E6-5546-8D25-79B90244FFA9}.Release|ARM.Deploy.0 = Release|ARM + {0213712B-62E6-5546-8D25-79B90244FFA9}.Release|x64.ActiveCfg = Release|x64 + {0213712B-62E6-5546-8D25-79B90244FFA9}.Release|x64.Build.0 = Release|x64 + {0213712B-62E6-5546-8D25-79B90244FFA9}.Release|x64.Deploy.0 = Release|x64 + {0213712B-62E6-5546-8D25-79B90244FFA9}.Release|x86.ActiveCfg = Release|Win32 + {0213712B-62E6-5546-8D25-79B90244FFA9}.Release|x86.Build.0 = Release|Win32 + {0213712B-62E6-5546-8D25-79B90244FFA9}.Release|x86.Deploy.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/CustomCapability.SCCD b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/CustomCapability.SCCD new file mode 100644 index 00000000..cad58db2 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/CustomCapability.SCCD @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<CustomCapabilityDescriptor xmlns="http://schemas.microsoft.com/appx/2016/sccd" xmlns:s="http://schemas.microsoft.com/appx/2016/sccd"> + <CustomCapabilities> + <CustomCapability Name="microsoft.hsaTestCustomCapability_q536wpkpf5cy2"></CustomCapability> + </CustomCapabilities> + <AuthorizedEntities> + <AuthorizedEntity AppPackageFamilyName="Microsoft.SDKSamples.CustomCapability.CPP_8wekyb3d8bbwe" CertificateSignatureHash="ca9fc964db7e0c2938778f4559946833e7a8cfde0f3eaa07650766d4764e86c4"></AuthorizedEntity> + <AuthorizedEntity AppPackageFamilyName="Microsoft.SDKSamples.CustomCapability.CPP_8wekyb3d8bbwe" CertificateSignatureHash="279cd652c4e252bfbe5217ac722205d7729ba409148cfa9e6d9e5b1cb94eaff1"></AuthorizedEntity> + </AuthorizedEntities> + <Catalog>xxxx</Catalog> +</CustomCapabilityDescriptor> diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/CustomCapability.vcxproj b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/CustomCapability.vcxproj new file mode 100644 index 00000000..8efaa78d --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/CustomCapability.vcxproj @@ -0,0 +1,287 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup Label="Globals"> + <ProjectGuid>{0213712b-62e6-5546-8d25-79b90244ffa9}</ProjectGuid> + <RootNamespace>SDKTemplate</RootNamespace> + <DefaultLanguage>en-US</DefaultLanguage> + <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion> + <AppContainerApplication>true</AppContainerApplication> + <ApplicationType>Windows Store</ApplicationType> + <WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion> + <WindowsTargetPlatformMinVersion>10.0.15063.0</WindowsTargetPlatformMinVersion> + <ApplicationTypeRevision>10.0</ApplicationTypeRevision> + <ProjectName>CustomCapability</ProjectName> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|ARM"> + <Configuration>Debug</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|ARM"> + <Configuration>Release</Configuration> + <Platform>ARM</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v141</PlatformToolset> + <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v141</PlatformToolset> + <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + <PlatformToolset>v141</PlatformToolset> + <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props')" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props')" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props" Condition="exists('$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPlatformExtensionSDKLocation(`WindowsDesktop, Version=10.0.15063.0`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), $(SDKReferenceDirectoryRoot), $(SDKExtensionDirectoryRoot), $(SDKReferenceRegistryRoot)))\DesignTime\CommonConfiguration\Neutral\WindowsDesktop.props')" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <IncludePath>$(IncludePath);..\..\..\SharedContent\cpp</IncludePath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(MSBuildProjectName)\</OutDir> + <IntDir>$(Platform)\$(Configuration)\</IntDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <DisableSpecificWarnings>4453;28204</DisableSpecificWarnings> + <AdditionalIncludeDirectories>$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories);$(OutDir)..</AdditionalIncludeDirectories> + <ShowIncludes>false</ShowIncludes> + </ClCompile> + <Link> + <AdditionalDependencies>vccorlib.lib;WindowsApp.lib;%(AdditionalDependencies);rpcrt4.lib</AdditionalDependencies> + <OptimizeReferences>false</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'"> + <ClCompile> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <DisableSpecificWarnings>4453;28204</DisableSpecificWarnings> + <AdditionalIncludeDirectories>$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories);$(OutDir)..</AdditionalIncludeDirectories> + <ShowIncludes>false</ShowIncludes> + </ClCompile> + <Link> + <AdditionalDependencies>vccorlib.lib;WindowsApp.lib;%(AdditionalDependencies);rpcrt4.lib</AdditionalDependencies> + <OptimizeReferences>false</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <DisableSpecificWarnings>4453;28204</DisableSpecificWarnings> + <AdditionalIncludeDirectories>$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories);$(OutDir)..</AdditionalIncludeDirectories> + <ShowIncludes>false</ShowIncludes> + </ClCompile> + <Link> + <AdditionalDependencies>vccorlib.lib;WindowsApp.lib;%(AdditionalDependencies);rpcrt4.lib</AdditionalDependencies> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'"> + <ClCompile> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <DisableSpecificWarnings>4453;28204</DisableSpecificWarnings> + <AdditionalIncludeDirectories>$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories);$(OutDir)..</AdditionalIncludeDirectories> + <ShowIncludes>false</ShowIncludes> + </ClCompile> + <Link> + <AdditionalDependencies>vccorlib.lib;WindowsApp.lib;%(AdditionalDependencies);rpcrt4.lib</AdditionalDependencies> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <DisableSpecificWarnings>4453;28204</DisableSpecificWarnings> + <AdditionalIncludeDirectories>$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories);$(OutDir)..</AdditionalIncludeDirectories> + <ShowIncludes>false</ShowIncludes> + </ClCompile> + <Link> + <AdditionalDependencies>vccorlib.lib;WindowsApp.lib;%(AdditionalDependencies);rpcrt4.lib</AdditionalDependencies> + <OptimizeReferences>false</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions> + <DisableSpecificWarnings>4453;28204</DisableSpecificWarnings> + <AdditionalIncludeDirectories>$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories);$(OutDir)..</AdditionalIncludeDirectories> + <ShowIncludes>false</ShowIncludes> + </ClCompile> + <Link> + <AdditionalDependencies>vccorlib.lib;WindowsApp.lib;%(AdditionalDependencies);rpcrt4.lib</AdditionalDependencies> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="ServiceViewModel.h" /> + <ClInclude Include="pch.h" /> + <ClInclude Include="..\..\..\SharedContent\cpp\App.xaml.h"> + <DependentUpon>..\..\..\SharedContent\xaml\App.xaml</DependentUpon> + </ClInclude> + <ClInclude Include="..\..\..\SharedContent\cpp\MainPage.xaml.h"> + <DependentUpon>..\..\..\SharedContent\cpp\MainPage.xaml</DependentUpon> + </ClInclude> + <ClInclude Include="Scenario1_MeteringData.xaml.h"> + <DependentUpon>Scenario1_MeteringData.xaml</DependentUpon> + </ClInclude> + <ClInclude Include="RpcClient.h" /> + <ClInclude Include="SampleConfiguration.h" /> + </ItemGroup> + <ItemGroup> + <ApplicationDefinition Include="..\..\..\SharedContent\xaml\App.xaml"> + <SubType>Designer</SubType> + </ApplicationDefinition> + <Page Include="..\..\..\SharedContent\xaml\Styles.xaml"> + <Link>Styles\Styles.xaml</Link> + </Page> + <Page Include="..\..\..\SharedContent\cpp\MainPage.xaml"> + <SubType>Designer</SubType> + </Page> + <Page Include="Scenario1_MeteringData.xaml"> + <SubType>Designer</SubType> + </Page> + </ItemGroup> + <ItemGroup> + <AppxManifest Include="Package.appxmanifest"> + <SubType>Designer</SubType> + </AppxManifest> + </ItemGroup> + <ItemGroup> + <Image Include="..\..\..\SharedContent\media\microsoft-sdk.png"> + <Link>Assets\microsoft-sdk.png</Link> + </Image> + <Image Include="..\..\..\SharedContent\media\smalltile-sdk.png"> + <Link>Assets\smalltile-sdk.png</Link> + </Image> + <Image Include="..\..\..\SharedContent\media\splash-sdk.png"> + <Link>Assets\splash-sdk.png</Link> + </Image> + <Image Include="..\..\..\SharedContent\media\squaretile-sdk.png"> + <Link>Assets\squaretile-sdk.png</Link> + </Image> + <Image Include="..\..\..\SharedContent\media\storelogo-sdk.png"> + <Link>Assets\storelogo-sdk.png</Link> + </Image> + <Image Include="..\..\..\SharedContent\media\tile-sdk.png"> + <Link>Assets\tile-sdk.png</Link> + </Image> + <Image Include="..\..\..\SharedContent\media\windows-sdk.png"> + <Link>Assets\windows-sdk.png</Link> + </Image> + </ItemGroup> + <ItemGroup> + <ClCompile Include="RpcInterface.c"> + <CompileAsWinRT>false</CompileAsWinRT> + <PrecompiledHeader>NotUsing</PrecompiledHeader> + </ClCompile> + <ClCompile Include="..\..\..\SharedContent\cpp\App.xaml.cpp"> + <DependentUpon>..\..\..\SharedContent\xaml\App.xaml</DependentUpon> + </ClCompile> + <ClCompile Include="..\..\..\SharedContent\cpp\MainPage.xaml.cpp"> + <DependentUpon>..\..\..\SharedContent\cpp\MainPage.xaml</DependentUpon> + </ClCompile> + <ClCompile Include="ServiceViewModel.cpp" /> + <ClCompile Include="Scenario1_MeteringData.xaml.cpp"> + <DependentUpon>Scenario1_MeteringData.xaml</DependentUpon> + </ClCompile> + <ClCompile Include="SampleConfiguration.cpp" /> + <ClCompile Include="pch.cpp"> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> + </ClCompile> + <ClCompile Include="RpcClient.cpp"> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">NotUsing</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">NotUsing</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader> + </ClCompile> + </ItemGroup> + <ItemGroup> + <SDKReference Include="WindowsDesktop, Version=10.0.15063.0" /> + </ItemGroup> + <ItemGroup> + <None Include="..\..\..\..\Toaster Driver\Service\RpcInterface.acf" /> + </ItemGroup> + <ItemGroup> + <Midl Include="..\..\..\..\Toaster Driver\Service\RpcInterface.Idl" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/CustomCapability.vcxproj.filters b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/CustomCapability.vcxproj.filters new file mode 100644 index 00000000..af84bc38 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/CustomCapability.vcxproj.filters @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Common"> + <UniqueIdentifier>81d95eea-286c-4a5e-98f1-eef612020bf0</UniqueIdentifier> + </Filter> + <Filter Include="Assets"> + <UniqueIdentifier>85b464d3-9e56-4242-b58b-1f226dd034b4</UniqueIdentifier> + <Extensions>bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png</Extensions> + </Filter> + <Filter Include="ViewModel"> + <UniqueIdentifier>{1c0f2943-52c2-4a54-93a2-971c14e7c8ec}</UniqueIdentifier> + </Filter> + <Filter Include="Model"> + <UniqueIdentifier>{33085be2-4c37-4eab-8f6e-6add0cffe2d4}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ApplicationDefinition Include="..\..\..\SharedContent\xaml\App.xaml" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="pch.cpp" /> + <ClCompile Include="RpcClient.cpp"> + <Filter>Model</Filter> + </ClCompile> + <ClCompile Include="SampleConfiguration.cpp"> + <Filter>Common</Filter> + </ClCompile> + <ClCompile Include="Scenario1_MeteringData.xaml.cpp" /> + <ClCompile Include="..\..\..\SharedContent\cpp\App.xaml.cpp" /> + <ClCompile Include="..\..\..\SharedContent\cpp\MainPage.xaml.cpp" /> + <ClCompile Include="ServiceViewModel.cpp"> + <Filter>ViewModel</Filter> + </ClCompile> + <ClCompile Include="RpcInterface.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="pch.h" /> + <ClInclude Include="RpcClient.h"> + <Filter>Model</Filter> + </ClInclude> + <ClInclude Include="SampleConfiguration.h"> + <Filter>Common</Filter> + </ClInclude> + <ClInclude Include="Scenario1_MeteringData.xaml.h" /> + <ClInclude Include="..\..\..\SharedContent\cpp\App.xaml.h" /> + <ClInclude Include="..\..\..\SharedContent\cpp\MainPage.xaml.h" /> + <ClInclude Include="ServiceViewModel.h"> + <Filter>ViewModel</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <Image Include="..\..\..\SharedContent\media\microsoft-sdk.png"> + <Filter>Assets</Filter> + </Image> + <Image Include="..\..\..\SharedContent\media\smalltile-sdk.png"> + <Filter>Assets</Filter> + </Image> + <Image Include="..\..\..\SharedContent\media\splash-sdk.png"> + <Filter>Assets</Filter> + </Image> + <Image Include="..\..\..\SharedContent\media\squaretile-sdk.png"> + <Filter>Assets</Filter> + </Image> + <Image Include="..\..\..\SharedContent\media\storelogo-sdk.png"> + <Filter>Assets</Filter> + </Image> + <Image Include="..\..\..\SharedContent\media\tile-sdk.png"> + <Filter>Assets</Filter> + </Image> + <Image Include="..\..\..\SharedContent\media\windows-sdk.png"> + <Filter>Assets</Filter> + </Image> + </ItemGroup> + <ItemGroup> + <AppxManifest Include="Package.appxmanifest" /> + </ItemGroup> + <ItemGroup> + <Page Include="Scenario1_MeteringData.xaml" /> + <Page Include="..\..\..\SharedContent\xaml\Styles.xaml" /> + <Page Include="..\..\..\SharedContent\cpp\MainPage.xaml" /> + </ItemGroup> + <ItemGroup> + <None Include="..\..\..\..\Toaster Driver\Service\RpcInterface.acf" /> + </ItemGroup> + <ItemGroup> + <Midl Include="..\..\..\..\Toaster Driver\Service\RpcInterface.Idl" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/DeviceList.cpp b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/DeviceList.cpp new file mode 100644 index 00000000..cb3a7a8e --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/DeviceList.cpp @@ -0,0 +1,244 @@ +#include "pch.h" +#include "DeviceList.h" +#include "MainPage.xaml.h" +#include "App.xaml.h" + +using namespace SDKTemplate; + +using namespace Platform; +using namespace Platform::Collections; +using namespace Windows::ApplicationModel; +using namespace Windows::Devices::Enumeration; +using namespace Windows::Devices::Custom; +using namespace Windows::Foundation; +using namespace Windows::UI::Core; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Documents; + +DeviceList^ DeviceList::_Current = nullptr; + +DeviceList^ DeviceList::Current::get() +{ + if (DeviceList::_Current == nullptr) + { + DeviceList::_Current = ref new DeviceList(); + } + return DeviceList::_Current; +} + +DeviceList::DeviceList() : m_WatcherStarted(false), m_WatcherSuspended(false) +{ + m_Fx2Watcher = nullptr; + m_List = ref new Vector<DeviceListEntry^>(); + InitDeviceWatcher(); + + // Register for app suspend/resume handlers + App::Current->Suspending += ref new SuspendingEventHandler(this, &DeviceList::SuspendDeviceWatcher); + App::Current->Resuming += ref new EventHandler<Object^>(this, &DeviceList::ResumeDeviceWatcher); +} + +void DeviceList::InitDeviceWatcher() +{ + // Define the selector to enumerate all of the fx2 device interface class instances. + // Use the DeviceInterfaceGuid provided by the driver (Fx2Driver, in this case). + auto selector = CustomDevice::GetDeviceSelector(Fx2Driver::DeviceInterfaceGuid); + + // Set of properties to retrieve + auto properties = ref new Vector<String^>({ "System.Devices.DeviceInstanceId" }); + + // Create a device watcher to look for instances of the fx2 device interface. + m_Fx2Watcher = DeviceInformation::CreateWatcher(selector, properties); + + m_Fx2Watcher->Added += ref new TypedEventHandler<DeviceWatcher^, DeviceInformation^>(this, &DeviceList::OnFx2Added); + m_Fx2Watcher->Removed += ref new TypedEventHandler<DeviceWatcher^, DeviceInformationUpdate^>(this, &DeviceList::OnFx2Removed); + m_Fx2Watcher->EnumerationCompleted += ref new TypedEventHandler<DeviceWatcher^, Object^>(this, &DeviceList::OnFx2EnumerationComplete); +} + +void DeviceList::StartFx2Watcher() +{ + MainPage::Current->NotifyUser("starting device watcher", NotifyType::StatusMessage); + + std::for_each( + begin(m_List), + end(m_List), + [](DeviceListEntry^ Entry) { + Entry->Matched = false; + }); + + WatcherStarted = true; + m_Fx2Watcher->Start(); +} + +void DeviceList::StopFx2Watcher() +{ + MainPage::Current->NotifyUser("stopping fx2 watcher", NotifyType::StatusMessage); + m_Fx2Watcher->Stop(); + WatcherStarted = false; +} + +void DeviceList::CreateBooleanTable( + InlineCollection^ Table, + const Platform::Array<bool>^ NewValues, + const Platform::Array<bool>^ OldValues, + String^ /* IndexTitle */, + String^ /* ValueTitle */, + String^ TrueValue, + String^ FalseValue) +{ + Table->Clear(); + + for (int i = 0; i < (int)NewValues->Length; i += 1) + { + auto line = ref new Span(); + auto block = ref new Run(); + block->Text = (i + 1).ToString(); + line->Inlines->Append(block); + + block = ref new Run(); + block->Text = " "; + line->Inlines->Append(block); + + block = ref new Run(); + block->Text = NewValues[i] ? TrueValue : FalseValue; + + if ((OldValues != nullptr) && (OldValues[i] != NewValues[i])) + { + auto bold = ref new Bold(); + bold->Inlines->Append(block); + line->Inlines->Append(bold); + } + else + { + line->Inlines->Append(block); + } + + line->Inlines->Append(ref new LineBreak()); + + Table->Append(line); + } +} + +DeviceListEntry^ DeviceList::FindDevice(String^ Id) +{ + auto i = std::find_if( + begin(m_List), + end(m_List), + [Id](DeviceListEntry^ e) {return e->Id == Id; }); + + if (i == end(m_List)) + { + return nullptr; + } + else + { + return *i; + } +} + +void DeviceList::OnFx2Added(DeviceWatcher ^ /* Sender */, DeviceInformation^ DevInterface) +{ + MainPage::Current->Dispatcher->RunAsync( + CoreDispatcherPriority::Normal, + ref new DispatchedHandler( + [this, DevInterface]()->void + { + MainPage::Current->NotifyUser("OnFx2Added: " + DevInterface->Id, NotifyType::StatusMessage); + + // search the device list for a device with a matching interface ID + auto match = FindDevice(DevInterface->Id); + + // If we found a match then mark it as verified and return + if (match != nullptr) + { + match->Matched = true; + return; + } + + // Create a new elemetn for this device interface, and queue up the query of its + // device information + match = ref new DeviceListEntry(DevInterface); + + // Add the new element to the end of the list of devices + m_List->Append(match); + })); +} + +void DeviceList::OnFx2Removed(DeviceWatcher ^ /* Sender */, DeviceInformationUpdate^ DevInterface) +{ + auto deviceId = DevInterface->Id; + + MainPage::Current->Dispatcher->RunAsync( + CoreDispatcherPriority::Normal, + ref new DispatchedHandler( + [this, deviceId]() + { + MainPage::Current->NotifyUser("OnFx2Removed: " + deviceId, NotifyType::StatusMessage); + + // Search the list of devices for one with a matching ID. Move the matched + // item to the end of the list. + auto i = std::remove_if( + begin(m_List), + end(m_List), + [deviceId](DeviceListEntry^ e) {return e->Id == deviceId; }); + + // if there's no match return. + if (i == end(m_List)) + { + return; + } + + // Remove the last item from the list. + MainPage::Current->NotifyUser("OnFx2Removed: " + deviceId + " removed", NotifyType::StatusMessage); + m_List->RemoveAtEnd(); + })); +} + +void DeviceList::OnFx2EnumerationComplete(DeviceWatcher ^ /* Sender */, Object ^ /* o */) +{ + MainPage::Current->Dispatcher->RunAsync( + CoreDispatcherPriority::Normal, + ref new DispatchedHandler( + [this]() + { + MainPage::Current->NotifyUser("OnFx2EnumerationComplete", NotifyType::StatusMessage); + + DeviceList^ me = this; + + // Move all the unmatched elements to the end of the list + auto i = std::remove_if( + begin(m_List), + end(m_List), + [](DeviceListEntry^ e) { return e->Matched == false; }); + + // Determine the number of unmatched entries + auto unmatchedCount = end(m_List) - i; + + while (unmatchedCount > 0) + { + m_List->RemoveAtEnd(); + unmatchedCount -= 1; + } + })); +} + +void DeviceList::SuspendDeviceWatcher(Object^, SuspendingEventArgs^) +{ + if (WatcherStarted) + { + m_WatcherSuspended = true; + StopFx2Watcher(); + } + else + { + m_WatcherSuspended = false; + } +} + +void DeviceList::ResumeDeviceWatcher(Object^, Object^) +{ + if (m_WatcherSuspended) + { + m_WatcherSuspended = false; + StartFx2Watcher(); + } +} diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Package.appxmanifest b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Package.appxmanifest new file mode 100644 index 00000000..0ec45a07 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Package.appxmanifest @@ -0,0 +1,41 @@ +<?xml version='1.0' encoding='utf-8'?> +<Package + xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" + xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" + xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" + xmlns:uap4="http://schemas.microsoft.com/appx/manifest/uap/windows10/4" + IgnorableNamespaces="uap mp uap4" + > + <Identity Name="Microsoft.SDKSamples.CustomCapability.CPP" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" Version="1.0.0.0" /> + <mp:PhoneIdentity PhoneProductId="26388851-6c33-4124-b1e5-96e859da28bf" PhonePublisherId="00000000-0000-0000-0000-000000000000"/> + <Properties> + <DisplayName>Custom Capability C++ Sample</DisplayName> + <PublisherDisplayName>Microsoft Corporation</PublisherDisplayName> + <Logo>Assets\StoreLogo-sdk.png</Logo> + </Properties> + <Dependencies> + <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.15063.0" MaxVersionTested="10.0.15063.0"/> + </Dependencies> + <Resources> + <Resource Language="x-generate"/> + </Resources> + <Applications> + <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="CustomCapability.App"> + <uap:VisualElements + DisplayName="Custom Capability C++ sample" + Square150x150Logo="Assets\squareTile-sdk.png" + Square44x44Logo="Assets\smallTile-sdk.png" + Description="Hsa C++ sample" + BackgroundColor="#00B2F0" + > + <uap:SplashScreen Image="Assets\splash-sdk.png"/> + <uap:DefaultTile> + <uap:ShowNameOnTiles> + <uap:ShowOn Tile="square150x150Logo"/> + </uap:ShowNameOnTiles> + </uap:DefaultTile> + </uap:VisualElements> + </Application> + </Applications> + +</Package> diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcClient.cpp b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcClient.cpp new file mode 100644 index 00000000..870d6306 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcClient.cpp @@ -0,0 +1,177 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +// There is an error in the system header files that incorrectly +// places RpcStringBindingCompose in the app partition. +// Work around it by changing the WINAPI_FAMILY to desktop temporarily. +#pragma push_macro("WINAPI_FAMILY") +#undef WINAPI_FAMILY +#define WINAPI_FAMILY WINAPI_FAMILY_DESKTOP_APP +#include "RpcClient.h" +#pragma pop_macro("WINAPI_FAMILY") + +using namespace SDKTemplate; + +__int64 RpcClient::Initialize() +{ + RPC_STATUS status; + RPC_WSTR pszStringBinding = nullptr; + + status = RpcStringBindingCompose( + NULL, + reinterpret_cast<RPC_WSTR>(L"ncalrpc"), + NULL, + reinterpret_cast<RPC_WSTR>(RPC_STATIC_ENDPOINT), + NULL, + &pszStringBinding); + + if (status) + { + goto error_status; + } + + status = RpcBindingFromStringBinding( + pszStringBinding, + &hRpcBinding); + + if (status) + { + goto error_status; + } + + status = RpcStringFree(&pszStringBinding); + + if (status) + { + goto error_status; + } + + RpcTryExcept + { + ::RemoteOpen(hRpcBinding, &phContext); + } + RpcExcept(1) + { + status = RpcExceptionCode(); + } + RpcEndExcept + +error_status: + + return status; +} + +// +// Make RPC call to start metering. This is a blocking call and +// will return only after StopMetering is called. +// +__int64 RpcClient::StartMeteringAndWaitForStop(__int64 samplePeriod) +{ + __int64 ulCode = 0; + CallbackCount = 0; + MeteringData = 0; + + RpcTryExcept + { + ::StartMetering(phContext, samplePeriod, (__int64)this); + } + RpcExcept(1) + { + ulCode = RpcExceptionCode(); + } + RpcEndExcept + + return ulCode; +} + + +// +// Make rpc call SetSampleRate +// +__int64 RpcClient::SetSampleRate(int rate) +{ + __int64 ulCode = 0; + RpcTryExcept + { + ::SetSamplePeriod(phContext, rate); + } + RpcExcept(1) + { + ulCode = RpcExceptionCode(); + } + RpcEndExcept + return ulCode; +} + +// +// Make rpc call StopMetering +// +__int64 RpcClient::StopMetering() +{ + __int64 ulCode = 0; + RpcTryExcept + { + ::StopMetering(phContext); + } + RpcExcept(1) + { + ulCode = RpcExceptionCode(); + } + RpcEndExcept + return ulCode; +} + +RpcClient::~RpcClient() +{ + RPC_STATUS status; + + if (hRpcBinding != NULL) + { + RpcTryExcept + { + ::RemoteClose(&phContext); + } + RpcExcept(1) + { + // Ignoring the result of RemoteClose as nothing can be + // done on the client side with this return code + status = RpcExceptionCode(); + } + RpcEndExcept + + status = RpcBindingFree(&hRpcBinding); + hRpcBinding = NULL; + } +} + +// +// Metering rpc callback +// +void MeteringDataEvent(__int64 data, __int64 context) +{ + RpcClient* client = static_cast<RpcClient*>((PVOID)context); + client->MeteringData = data; + ++client->CallbackCount; +} + +///******************************************************/ +///* MIDL allocate and free */ +///******************************************************/ + +void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len) +{ + return(malloc(len)); +} + +void __RPC_USER midl_user_free(void __RPC_FAR * ptr) +{ + free(ptr); +}
\ No newline at end of file diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcClient.h b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcClient.h new file mode 100644 index 00000000..0ee5ff78 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcClient.h @@ -0,0 +1,30 @@ +// +// RpcClient.h +// + +#pragma once + +#define RPC_STATIC_ENDPOINT L"HsaSampleRpcEndpoint" + +#include "RpcInterface_h.h" + +namespace SDKTemplate +{ + /// <summary> + /// Client side RPC implementation + /// </summary> + private class RpcClient sealed + { + public: + ~RpcClient(); + __int64 Initialize(); + __int64 StartMeteringAndWaitForStop(__int64 samplePeriod); + __int64 StopMetering(); + __int64 SetSampleRate(int rate); + int CallbackCount; + __int64 MeteringData; + private: + handle_t hRpcBinding; + PCONTEXT_HANDLE_TYPE phContext; + }; +} diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface.c b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface.c new file mode 100644 index 00000000..0f988533 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface.c @@ -0,0 +1,6 @@ +// RpcInterface_c.c expects _ARM_ to be set when building for ARM. +#ifdef _M_ARM +#define _ARM_ 1 +#endif + +#include "RpcInterface_c.c" diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface_c.c b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface_c.c new file mode 100644 index 00000000..8b05c1ea --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface_c.c @@ -0,0 +1,476 @@ + + +/* this ALWAYS GENERATED file contains the RPC client stubs */ + + + /* File created by MIDL compiler version 8.01.0622 */ +/* at Mon Jan 18 19:14:07 2038 + */ +/* Compiler settings for C:\WinHEC 2017 Lab\Toaster Driver\Service\RpcInterface.Idl: + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.01.0622 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#if defined(_M_AMD64) + + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif + +#pragma warning( disable: 4211 ) /* redefine extern to static */ +#pragma warning( disable: 4232 ) /* dllimport identity*/ +#pragma warning( disable: 4024 ) /* array to pointer mapping*/ + +#include <string.h> + +#include "RpcInterface_h.h" + +#define TYPE_FORMAT_STRING_SIZE 23 +#define PROC_FORMAT_STRING_SIZE 245 +#define EXPR_FORMAT_STRING_SIZE 1 +#define TRANSMIT_AS_TABLE_SIZE 0 +#define WIRE_MARSHAL_TABLE_SIZE 0 + +typedef struct _RpcInterface_MIDL_TYPE_FORMAT_STRING + { + short Pad; + unsigned char Format[ TYPE_FORMAT_STRING_SIZE ]; + } RpcInterface_MIDL_TYPE_FORMAT_STRING; + +typedef struct _RpcInterface_MIDL_PROC_FORMAT_STRING + { + short Pad; + unsigned char Format[ PROC_FORMAT_STRING_SIZE ]; + } RpcInterface_MIDL_PROC_FORMAT_STRING; + +typedef struct _RpcInterface_MIDL_EXPR_FORMAT_STRING + { + long Pad; + unsigned char Format[ EXPR_FORMAT_STRING_SIZE ]; + } RpcInterface_MIDL_EXPR_FORMAT_STRING; + + +static const RPC_SYNTAX_IDENTIFIER _RpcTransferSyntax = +{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}}; + + +extern const RpcInterface_MIDL_TYPE_FORMAT_STRING RpcInterface__MIDL_TypeFormatString; +extern const RpcInterface_MIDL_PROC_FORMAT_STRING RpcInterface__MIDL_ProcFormatString; +extern const RpcInterface_MIDL_EXPR_FORMAT_STRING RpcInterface__MIDL_ExprFormatString; + +#define GENERIC_BINDING_TABLE_SIZE 0 + + +/* Standard interface: RpcInterface, ver. 1.0, + GUID={0x906B0CE0,0xC70B,0x1067,{0xB3,0x17,0x00,0xDD,0x01,0x06,0x62,0xDA}} */ + + +extern const MIDL_SERVER_INFO RpcInterface_ServerInfo; + + +extern const RPC_DISPATCH_TABLE RpcInterface_v1_0_DispatchTable; + +static const RPC_CLIENT_INTERFACE RpcInterface___RpcClientInterface = + { + sizeof(RPC_CLIENT_INTERFACE), + {{0x906B0CE0,0xC70B,0x1067,{0xB3,0x17,0x00,0xDD,0x01,0x06,0x62,0xDA}},{1,0}}, + {{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}}, + (RPC_DISPATCH_TABLE*)&RpcInterface_v1_0_DispatchTable, + 0, + 0, + 0, + &RpcInterface_ServerInfo, + 0x04000000 + }; +RPC_IF_HANDLE RpcInterface_v1_0_c_ifspec = (RPC_IF_HANDLE)& RpcInterface___RpcClientInterface; + +extern const MIDL_STUB_DESC RpcInterface_StubDesc; + +static RPC_BINDING_HANDLE RpcInterface__MIDL_AutoBindHandle; + + +void RemoteOpen( + /* [in] */ handle_t hBinding, + /* [out] */ PPCONTEXT_HANDLE_TYPE pphContext) +{ + + NdrClientCall2( + ( PMIDL_STUB_DESC )&RpcInterface_StubDesc, + (PFORMAT_STRING) &RpcInterface__MIDL_ProcFormatString.Format[0], + hBinding, + pphContext); + +} + + +void RemoteClose( + /* [out][in] */ PPCONTEXT_HANDLE_TYPE pphContext) +{ + + NdrClientCall2( + ( PMIDL_STUB_DESC )&RpcInterface_StubDesc, + (PFORMAT_STRING) &RpcInterface__MIDL_ProcFormatString.Format[36], + pphContext); + +} + + +void StartMetering( + /* [in] */ PCONTEXT_HANDLE_TYPE phContext, + /* [in] */ __int64 samplePeriod, + /* [optional][in] */ __int64 context) +{ + + NdrClientCall2( + ( PMIDL_STUB_DESC )&RpcInterface_StubDesc, + (PFORMAT_STRING) &RpcInterface__MIDL_ProcFormatString.Format[74], + phContext, + samplePeriod, + context); + +} + + +void SetSamplePeriod( + /* [in] */ PCONTEXT_HANDLE_TYPE phContext, + /* [in] */ __int64 samplePeriod) +{ + + NdrClientCall2( + ( PMIDL_STUB_DESC )&RpcInterface_StubDesc, + (PFORMAT_STRING) &RpcInterface__MIDL_ProcFormatString.Format[124], + phContext, + samplePeriod); + +} + + +void StopMetering( + /* [in] */ PCONTEXT_HANDLE_TYPE phContext) +{ + + NdrClientCall2( + ( PMIDL_STUB_DESC )&RpcInterface_StubDesc, + (PFORMAT_STRING) &RpcInterface__MIDL_ProcFormatString.Format[168], + phContext); + +} + + +#if !defined(__RPC_WIN64__) +#error Invalid build platform for this stub. +#endif + +static const RpcInterface_MIDL_PROC_FORMAT_STRING RpcInterface__MIDL_ProcFormatString = + { + 0, + { + + /* Procedure RemoteOpen */ + + 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 2 */ NdrFcLong( 0x0 ), /* 0 */ +/* 6 */ NdrFcShort( 0x0 ), /* 0 */ +/* 8 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 10 */ 0x32, /* FC_BIND_PRIMITIVE */ + 0x0, /* 0 */ +/* 12 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 14 */ NdrFcShort( 0x0 ), /* 0 */ +/* 16 */ NdrFcShort( 0x38 ), /* 56 */ +/* 18 */ 0x40, /* Oi2 Flags: has ext, */ + 0x1, /* 1 */ +/* 20 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 22 */ NdrFcShort( 0x0 ), /* 0 */ +/* 24 */ NdrFcShort( 0x0 ), /* 0 */ +/* 26 */ NdrFcShort( 0x0 ), /* 0 */ +/* 28 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter pphContext */ + +/* 30 */ NdrFcShort( 0x110 ), /* Flags: out, simple ref, */ +/* 32 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 34 */ NdrFcShort( 0x6 ), /* Type Offset=6 */ + + /* Procedure RemoteClose */ + +/* 36 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 38 */ NdrFcLong( 0x0 ), /* 0 */ +/* 42 */ NdrFcShort( 0x1 ), /* 1 */ +/* 44 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 46 */ 0x30, /* FC_BIND_CONTEXT */ + 0xe0, /* Ctxt flags: via ptr, in, out, */ +/* 48 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 50 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 52 */ NdrFcShort( 0x38 ), /* 56 */ +/* 54 */ NdrFcShort( 0x38 ), /* 56 */ +/* 56 */ 0x40, /* Oi2 Flags: has ext, */ + 0x1, /* 1 */ +/* 58 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 60 */ NdrFcShort( 0x0 ), /* 0 */ +/* 62 */ NdrFcShort( 0x0 ), /* 0 */ +/* 64 */ NdrFcShort( 0x0 ), /* 0 */ +/* 66 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter pphContext */ + +/* 68 */ NdrFcShort( 0x118 ), /* Flags: in, out, simple ref, */ +/* 70 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 72 */ NdrFcShort( 0xe ), /* Type Offset=14 */ + + /* Procedure StartMetering */ + +/* 74 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 76 */ NdrFcLong( 0x0 ), /* 0 */ +/* 80 */ NdrFcShort( 0x2 ), /* 2 */ +/* 82 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ +/* 84 */ 0x30, /* FC_BIND_CONTEXT */ + 0x40, /* Ctxt flags: in, */ +/* 86 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 88 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 90 */ NdrFcShort( 0x44 ), /* 68 */ +/* 92 */ NdrFcShort( 0x0 ), /* 0 */ +/* 94 */ 0x40, /* Oi2 Flags: has ext, */ + 0x3, /* 3 */ +/* 96 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 98 */ NdrFcShort( 0x0 ), /* 0 */ +/* 100 */ NdrFcShort( 0x0 ), /* 0 */ +/* 102 */ NdrFcShort( 0x0 ), /* 0 */ +/* 104 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter phContext */ + +/* 106 */ NdrFcShort( 0x8 ), /* Flags: in, */ +/* 108 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 110 */ NdrFcShort( 0x12 ), /* Type Offset=18 */ + + /* Parameter samplePeriod */ + +/* 112 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 114 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 116 */ 0xb, /* FC_HYPER */ + 0x0, /* 0 */ + + /* Parameter context */ + +/* 118 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 120 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 122 */ 0xb, /* FC_HYPER */ + 0x0, /* 0 */ + + /* Procedure SetSamplePeriod */ + +/* 124 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 126 */ NdrFcLong( 0x0 ), /* 0 */ +/* 130 */ NdrFcShort( 0x3 ), /* 3 */ +/* 132 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 134 */ 0x30, /* FC_BIND_CONTEXT */ + 0x40, /* Ctxt flags: in, */ +/* 136 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 138 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 140 */ NdrFcShort( 0x34 ), /* 52 */ +/* 142 */ NdrFcShort( 0x0 ), /* 0 */ +/* 144 */ 0x40, /* Oi2 Flags: has ext, */ + 0x2, /* 2 */ +/* 146 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 148 */ NdrFcShort( 0x0 ), /* 0 */ +/* 150 */ NdrFcShort( 0x0 ), /* 0 */ +/* 152 */ NdrFcShort( 0x0 ), /* 0 */ +/* 154 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter phContext */ + +/* 156 */ NdrFcShort( 0x8 ), /* Flags: in, */ +/* 158 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 160 */ NdrFcShort( 0x12 ), /* Type Offset=18 */ + + /* Parameter samplePeriod */ + +/* 162 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 164 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 166 */ 0xb, /* FC_HYPER */ + 0x0, /* 0 */ + + /* Procedure StopMetering */ + +/* 168 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 170 */ NdrFcLong( 0x0 ), /* 0 */ +/* 174 */ NdrFcShort( 0x4 ), /* 4 */ +/* 176 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 178 */ 0x30, /* FC_BIND_CONTEXT */ + 0x40, /* Ctxt flags: in, */ +/* 180 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 182 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 184 */ NdrFcShort( 0x24 ), /* 36 */ +/* 186 */ NdrFcShort( 0x0 ), /* 0 */ +/* 188 */ 0x40, /* Oi2 Flags: has ext, */ + 0x1, /* 1 */ +/* 190 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 192 */ NdrFcShort( 0x0 ), /* 0 */ +/* 194 */ NdrFcShort( 0x0 ), /* 0 */ +/* 196 */ NdrFcShort( 0x0 ), /* 0 */ +/* 198 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter phContext */ + +/* 200 */ NdrFcShort( 0x8 ), /* Flags: in, */ +/* 202 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 204 */ NdrFcShort( 0x12 ), /* Type Offset=18 */ + + /* Procedure MeteringDataEvent */ + +/* 206 */ 0x34, /* FC_CALLBACK_HANDLE */ + 0x48, /* Old Flags: */ +/* 208 */ NdrFcLong( 0x0 ), /* 0 */ +/* 212 */ NdrFcShort( 0x0 ), /* 0 */ +/* 214 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 216 */ NdrFcShort( 0x20 ), /* 32 */ +/* 218 */ NdrFcShort( 0x0 ), /* 0 */ +/* 220 */ 0x40, /* Oi2 Flags: has ext, */ + 0x2, /* 2 */ +/* 222 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 224 */ NdrFcShort( 0x0 ), /* 0 */ +/* 226 */ NdrFcShort( 0x0 ), /* 0 */ +/* 228 */ NdrFcShort( 0x0 ), /* 0 */ +/* 230 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter data */ + +/* 232 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 234 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 236 */ 0xb, /* FC_HYPER */ + 0x0, /* 0 */ + + /* Parameter context */ + +/* 238 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 240 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 242 */ 0xb, /* FC_HYPER */ + 0x0, /* 0 */ + + 0x0 + } + }; + +static const RpcInterface_MIDL_TYPE_FORMAT_STRING RpcInterface__MIDL_TypeFormatString = + { + 0, + { + NdrFcShort( 0x0 ), /* 0 */ +/* 2 */ + 0x11, 0x4, /* FC_RP [alloced_on_stack] */ +/* 4 */ NdrFcShort( 0x2 ), /* Offset= 2 (6) */ +/* 6 */ 0x30, /* FC_BIND_CONTEXT */ + 0xa0, /* Ctxt flags: via ptr, out, */ +/* 8 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 10 */ + 0x11, 0x4, /* FC_RP [alloced_on_stack] */ +/* 12 */ NdrFcShort( 0x2 ), /* Offset= 2 (14) */ +/* 14 */ 0x30, /* FC_BIND_CONTEXT */ + 0xe1, /* Ctxt flags: via ptr, in, out, can't be null */ +/* 16 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 18 */ 0x30, /* FC_BIND_CONTEXT */ + 0x41, /* Ctxt flags: in, can't be null */ +/* 20 */ 0x0, /* 0 */ + 0x0, /* 0 */ + + 0x0 + } + }; + +static const unsigned short RpcInterface_FormatStringOffsetTable[] = + { + 0, + 36, + 74, + 124, + 168, + }; + + +static const unsigned short _callbackRpcInterface_FormatStringOffsetTable[] = + { + 206 + }; + + +static const MIDL_STUB_DESC RpcInterface_StubDesc = + { + (void *)& RpcInterface___RpcClientInterface, + MIDL_user_allocate, + MIDL_user_free, + &RpcInterface__MIDL_AutoBindHandle, + 0, + 0, + 0, + 0, + RpcInterface__MIDL_TypeFormatString.Format, + 1, /* -error bounds_check flag */ + 0x50002, /* Ndr library version */ + 0, + 0x801026e, /* MIDL Version 8.1.622 */ + 0, + 0, + 0, /* notify & notify_flag routine table */ + 0x1, /* MIDL flag */ + 0, /* cs routines */ + 0, /* proxy/server info */ + 0 + }; + +static const RPC_DISPATCH_FUNCTION RpcInterface_table[] = + { + NdrServerCall2, + 0 + }; +static const RPC_DISPATCH_TABLE RpcInterface_v1_0_DispatchTable = + { + 1, + (RPC_DISPATCH_FUNCTION*)RpcInterface_table + }; + +static const SERVER_ROUTINE RpcInterface_ServerRoutineTable[] = + { + (SERVER_ROUTINE)MeteringDataEvent + }; + +static const MIDL_SERVER_INFO RpcInterface_ServerInfo = + { + &RpcInterface_StubDesc, + RpcInterface_ServerRoutineTable, + RpcInterface__MIDL_ProcFormatString.Format, + _callbackRpcInterface_FormatStringOffsetTable, + 0, + 0, + 0, + 0}; +#if _MSC_VER >= 1200 +#pragma warning(pop) +#endif + + +#endif /* defined(_M_AMD64)*/ + diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface_h.h b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface_h.h new file mode 100644 index 00000000..a0e2dcac --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface_h.h @@ -0,0 +1,112 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 8.01.0622 */ +/* at Mon Jan 18 19:14:07 2038 + */ +/* Compiler settings for C:\WinHEC 2017 Lab\Toaster Driver\Service\RpcInterface.Idl: + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.01.0622 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the <rpcndr.h> version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of <rpcndr.h> +#endif /* __RPCNDR_H_VERSION__ */ + + +#ifndef __RpcInterface_h_h__ +#define __RpcInterface_h_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +#if defined(__cplusplus) +#if defined(__MIDL_USE_C_ENUM) +#define MIDL_ENUM enum +#else +#define MIDL_ENUM enum class +#endif +#endif + + +/* Forward Declarations */ + +/* header files for imported files */ +#include "oaidl.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + +#ifndef __RpcInterface_INTERFACE_DEFINED__ +#define __RpcInterface_INTERFACE_DEFINED__ + +/* interface RpcInterface */ +/* [unique][version][uuid] */ + +typedef /* [context_handle] */ void *PCONTEXT_HANDLE_TYPE; + +typedef /* [ref] */ PCONTEXT_HANDLE_TYPE *PPCONTEXT_HANDLE_TYPE; + +void RemoteOpen( + /* [in] */ handle_t hBinding, + /* [out] */ PPCONTEXT_HANDLE_TYPE pphContext); + +void RemoteClose( + /* [out][in] */ PPCONTEXT_HANDLE_TYPE pphContext); + +void StartMetering( + /* [in] */ PCONTEXT_HANDLE_TYPE phContext, + /* [in] */ __int64 samplePeriod, + /* [optional][in] */ __int64 context); + +void SetSamplePeriod( + /* [in] */ PCONTEXT_HANDLE_TYPE phContext, + /* [in] */ __int64 samplePeriod); + +void StopMetering( + /* [in] */ PCONTEXT_HANDLE_TYPE phContext); + +/* [callback] */ void MeteringDataEvent( + /* [in] */ __int64 data, + /* [optional][in] */ __int64 context); + + + +extern RPC_IF_HANDLE RpcInterface_v1_0_c_ifspec; +extern RPC_IF_HANDLE RpcInterface_v1_0_s_ifspec; +#endif /* __RpcInterface_INTERFACE_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +void __RPC_USER PCONTEXT_HANDLE_TYPE_rundown( PCONTEXT_HANDLE_TYPE ); + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface_s.c b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface_s.c new file mode 100644 index 00000000..ec58170d --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/RpcInterface_s.c @@ -0,0 +1,430 @@ + + +/* this ALWAYS GENERATED file contains the RPC server stubs */ + + + /* File created by MIDL compiler version 8.01.0622 */ +/* at Mon Jan 18 19:14:07 2038 + */ +/* Compiler settings for C:\WinHEC 2017 Lab\Toaster Driver\Service\RpcInterface.Idl: + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.01.0622 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#if defined(_M_AMD64) + + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ +#if _MSC_VER >= 1200 +#pragma warning(push) +#endif + +#pragma warning( disable: 4211 ) /* redefine extern to static */ +#pragma warning( disable: 4232 ) /* dllimport identity*/ +#pragma warning( disable: 4024 ) /* array to pointer mapping*/ + +#include <string.h> +#include "RpcInterface_h.h" + +#define TYPE_FORMAT_STRING_SIZE 23 +#define PROC_FORMAT_STRING_SIZE 245 +#define EXPR_FORMAT_STRING_SIZE 1 +#define TRANSMIT_AS_TABLE_SIZE 0 +#define WIRE_MARSHAL_TABLE_SIZE 0 + +typedef struct _RpcInterface_MIDL_TYPE_FORMAT_STRING + { + short Pad; + unsigned char Format[ TYPE_FORMAT_STRING_SIZE ]; + } RpcInterface_MIDL_TYPE_FORMAT_STRING; + +typedef struct _RpcInterface_MIDL_PROC_FORMAT_STRING + { + short Pad; + unsigned char Format[ PROC_FORMAT_STRING_SIZE ]; + } RpcInterface_MIDL_PROC_FORMAT_STRING; + +typedef struct _RpcInterface_MIDL_EXPR_FORMAT_STRING + { + long Pad; + unsigned char Format[ EXPR_FORMAT_STRING_SIZE ]; + } RpcInterface_MIDL_EXPR_FORMAT_STRING; + + +static const RPC_SYNTAX_IDENTIFIER _RpcTransferSyntax = +{{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}}; + +extern const RpcInterface_MIDL_TYPE_FORMAT_STRING RpcInterface__MIDL_TypeFormatString; +extern const RpcInterface_MIDL_PROC_FORMAT_STRING RpcInterface__MIDL_ProcFormatString; +extern const RpcInterface_MIDL_EXPR_FORMAT_STRING RpcInterface__MIDL_ExprFormatString; + +/* Standard interface: RpcInterface, ver. 1.0, + GUID={0x906B0CE0,0xC70B,0x1067,{0xB3,0x17,0x00,0xDD,0x01,0x06,0x62,0xDA}} */ + + +extern const MIDL_SERVER_INFO RpcInterface_ServerInfo; + +extern const RPC_DISPATCH_TABLE RpcInterface_v1_0_DispatchTable; + +static const RPC_SERVER_INTERFACE RpcInterface___RpcServerInterface = + { + sizeof(RPC_SERVER_INTERFACE), + {{0x906B0CE0,0xC70B,0x1067,{0xB3,0x17,0x00,0xDD,0x01,0x06,0x62,0xDA}},{1,0}}, + {{0x8A885D04,0x1CEB,0x11C9,{0x9F,0xE8,0x08,0x00,0x2B,0x10,0x48,0x60}},{2,0}}, + (RPC_DISPATCH_TABLE*)&RpcInterface_v1_0_DispatchTable, + 0, + 0, + 0, + &RpcInterface_ServerInfo, + 0x04000000 + }; +RPC_IF_HANDLE RpcInterface_v1_0_s_ifspec = (RPC_IF_HANDLE)& RpcInterface___RpcServerInterface; + +extern const MIDL_STUB_DESC RpcInterface_StubDesc; + + extern const MIDL_STUBLESS_PROXY_INFO RpcInterface_ProxyInfo; + +/* [callback] */ void MeteringDataEvent( + /* [in] */ __int64 data, + /* [optional][in] */ __int64 context) +{ + + NdrClientCall2( + ( PMIDL_STUB_DESC )&RpcInterface_StubDesc, + (PFORMAT_STRING) &RpcInterface__MIDL_ProcFormatString.Format[206], + data, + context); + +} + +extern const NDR_RUNDOWN RundownRoutines[]; + +#if !defined(__RPC_WIN64__) +#error Invalid build platform for this stub. +#endif + +static const RpcInterface_MIDL_PROC_FORMAT_STRING RpcInterface__MIDL_ProcFormatString = + { + 0, + { + + /* Procedure RemoteOpen */ + + 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 2 */ NdrFcLong( 0x0 ), /* 0 */ +/* 6 */ NdrFcShort( 0x0 ), /* 0 */ +/* 8 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 10 */ 0x32, /* FC_BIND_PRIMITIVE */ + 0x0, /* 0 */ +/* 12 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 14 */ NdrFcShort( 0x0 ), /* 0 */ +/* 16 */ NdrFcShort( 0x38 ), /* 56 */ +/* 18 */ 0x40, /* Oi2 Flags: has ext, */ + 0x1, /* 1 */ +/* 20 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 22 */ NdrFcShort( 0x0 ), /* 0 */ +/* 24 */ NdrFcShort( 0x0 ), /* 0 */ +/* 26 */ NdrFcShort( 0x0 ), /* 0 */ +/* 28 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter pphContext */ + +/* 30 */ NdrFcShort( 0x110 ), /* Flags: out, simple ref, */ +/* 32 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 34 */ NdrFcShort( 0x6 ), /* Type Offset=6 */ + + /* Procedure RemoteClose */ + +/* 36 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 38 */ NdrFcLong( 0x0 ), /* 0 */ +/* 42 */ NdrFcShort( 0x1 ), /* 1 */ +/* 44 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 46 */ 0x30, /* FC_BIND_CONTEXT */ + 0xe0, /* Ctxt flags: via ptr, in, out, */ +/* 48 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 50 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 52 */ NdrFcShort( 0x38 ), /* 56 */ +/* 54 */ NdrFcShort( 0x38 ), /* 56 */ +/* 56 */ 0x40, /* Oi2 Flags: has ext, */ + 0x1, /* 1 */ +/* 58 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 60 */ NdrFcShort( 0x0 ), /* 0 */ +/* 62 */ NdrFcShort( 0x0 ), /* 0 */ +/* 64 */ NdrFcShort( 0x0 ), /* 0 */ +/* 66 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter pphContext */ + +/* 68 */ NdrFcShort( 0x118 ), /* Flags: in, out, simple ref, */ +/* 70 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 72 */ NdrFcShort( 0xe ), /* Type Offset=14 */ + + /* Procedure StartMetering */ + +/* 74 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 76 */ NdrFcLong( 0x0 ), /* 0 */ +/* 80 */ NdrFcShort( 0x2 ), /* 2 */ +/* 82 */ NdrFcShort( 0x18 ), /* X64 Stack size/offset = 24 */ +/* 84 */ 0x30, /* FC_BIND_CONTEXT */ + 0x40, /* Ctxt flags: in, */ +/* 86 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 88 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 90 */ NdrFcShort( 0x44 ), /* 68 */ +/* 92 */ NdrFcShort( 0x0 ), /* 0 */ +/* 94 */ 0x40, /* Oi2 Flags: has ext, */ + 0x3, /* 3 */ +/* 96 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 98 */ NdrFcShort( 0x0 ), /* 0 */ +/* 100 */ NdrFcShort( 0x0 ), /* 0 */ +/* 102 */ NdrFcShort( 0x0 ), /* 0 */ +/* 104 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter phContext */ + +/* 106 */ NdrFcShort( 0x8 ), /* Flags: in, */ +/* 108 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 110 */ NdrFcShort( 0x12 ), /* Type Offset=18 */ + + /* Parameter samplePeriod */ + +/* 112 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 114 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 116 */ 0xb, /* FC_HYPER */ + 0x0, /* 0 */ + + /* Parameter context */ + +/* 118 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 120 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 122 */ 0xb, /* FC_HYPER */ + 0x0, /* 0 */ + + /* Procedure SetSamplePeriod */ + +/* 124 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 126 */ NdrFcLong( 0x0 ), /* 0 */ +/* 130 */ NdrFcShort( 0x3 ), /* 3 */ +/* 132 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 134 */ 0x30, /* FC_BIND_CONTEXT */ + 0x40, /* Ctxt flags: in, */ +/* 136 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 138 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 140 */ NdrFcShort( 0x34 ), /* 52 */ +/* 142 */ NdrFcShort( 0x0 ), /* 0 */ +/* 144 */ 0x40, /* Oi2 Flags: has ext, */ + 0x2, /* 2 */ +/* 146 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 148 */ NdrFcShort( 0x0 ), /* 0 */ +/* 150 */ NdrFcShort( 0x0 ), /* 0 */ +/* 152 */ NdrFcShort( 0x0 ), /* 0 */ +/* 154 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter phContext */ + +/* 156 */ NdrFcShort( 0x8 ), /* Flags: in, */ +/* 158 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 160 */ NdrFcShort( 0x12 ), /* Type Offset=18 */ + + /* Parameter samplePeriod */ + +/* 162 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 164 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 166 */ 0xb, /* FC_HYPER */ + 0x0, /* 0 */ + + /* Procedure StopMetering */ + +/* 168 */ 0x0, /* 0 */ + 0x48, /* Old Flags: */ +/* 170 */ NdrFcLong( 0x0 ), /* 0 */ +/* 174 */ NdrFcShort( 0x4 ), /* 4 */ +/* 176 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 178 */ 0x30, /* FC_BIND_CONTEXT */ + 0x40, /* Ctxt flags: in, */ +/* 180 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 182 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 184 */ NdrFcShort( 0x24 ), /* 36 */ +/* 186 */ NdrFcShort( 0x0 ), /* 0 */ +/* 188 */ 0x40, /* Oi2 Flags: has ext, */ + 0x1, /* 1 */ +/* 190 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 192 */ NdrFcShort( 0x0 ), /* 0 */ +/* 194 */ NdrFcShort( 0x0 ), /* 0 */ +/* 196 */ NdrFcShort( 0x0 ), /* 0 */ +/* 198 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter phContext */ + +/* 200 */ NdrFcShort( 0x8 ), /* Flags: in, */ +/* 202 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 204 */ NdrFcShort( 0x12 ), /* Type Offset=18 */ + + /* Procedure MeteringDataEvent */ + +/* 206 */ 0x34, /* FC_CALLBACK_HANDLE */ + 0x48, /* Old Flags: */ +/* 208 */ NdrFcLong( 0x0 ), /* 0 */ +/* 212 */ NdrFcShort( 0x0 ), /* 0 */ +/* 214 */ NdrFcShort( 0x10 ), /* X64 Stack size/offset = 16 */ +/* 216 */ NdrFcShort( 0x20 ), /* 32 */ +/* 218 */ NdrFcShort( 0x0 ), /* 0 */ +/* 220 */ 0x40, /* Oi2 Flags: has ext, */ + 0x2, /* 2 */ +/* 222 */ 0xa, /* 10 */ + 0x1, /* Ext Flags: new corr desc, */ +/* 224 */ NdrFcShort( 0x0 ), /* 0 */ +/* 226 */ NdrFcShort( 0x0 ), /* 0 */ +/* 228 */ NdrFcShort( 0x0 ), /* 0 */ +/* 230 */ NdrFcShort( 0x0 ), /* 0 */ + + /* Parameter data */ + +/* 232 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 234 */ NdrFcShort( 0x0 ), /* X64 Stack size/offset = 0 */ +/* 236 */ 0xb, /* FC_HYPER */ + 0x0, /* 0 */ + + /* Parameter context */ + +/* 238 */ NdrFcShort( 0x48 ), /* Flags: in, base type, */ +/* 240 */ NdrFcShort( 0x8 ), /* X64 Stack size/offset = 8 */ +/* 242 */ 0xb, /* FC_HYPER */ + 0x0, /* 0 */ + + 0x0 + } + }; + +static const RpcInterface_MIDL_TYPE_FORMAT_STRING RpcInterface__MIDL_TypeFormatString = + { + 0, + { + NdrFcShort( 0x0 ), /* 0 */ +/* 2 */ + 0x11, 0x4, /* FC_RP [alloced_on_stack] */ +/* 4 */ NdrFcShort( 0x2 ), /* Offset= 2 (6) */ +/* 6 */ 0x30, /* FC_BIND_CONTEXT */ + 0xa0, /* Ctxt flags: via ptr, out, */ +/* 8 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 10 */ + 0x11, 0x4, /* FC_RP [alloced_on_stack] */ +/* 12 */ NdrFcShort( 0x2 ), /* Offset= 2 (14) */ +/* 14 */ 0x30, /* FC_BIND_CONTEXT */ + 0xe1, /* Ctxt flags: via ptr, in, out, can't be null */ +/* 16 */ 0x0, /* 0 */ + 0x0, /* 0 */ +/* 18 */ 0x30, /* FC_BIND_CONTEXT */ + 0x41, /* Ctxt flags: in, can't be null */ +/* 20 */ 0x0, /* 0 */ + 0x0, /* 0 */ + + 0x0 + } + }; + +static const NDR_RUNDOWN RundownRoutines[] = + { + PCONTEXT_HANDLE_TYPE_rundown + }; + + +static const unsigned short RpcInterface_FormatStringOffsetTable[] = + { + 0, + 36, + 74, + 124, + 168, + }; + + +static const unsigned short _callbackRpcInterface_FormatStringOffsetTable[] = + { + 206 + }; + + +static const MIDL_STUB_DESC RpcInterface_StubDesc = + { + (void *)& RpcInterface___RpcServerInterface, + MIDL_user_allocate, + MIDL_user_free, + 0, + RundownRoutines, + 0, + 0, + 0, + RpcInterface__MIDL_TypeFormatString.Format, + 1, /* -error bounds_check flag */ + 0x50002, /* Ndr library version */ + 0, + 0x801026e, /* MIDL Version 8.1.622 */ + 0, + 0, + 0, /* notify & notify_flag routine table */ + 0x1, /* MIDL flag */ + 0, /* cs routines */ + 0, /* proxy/server info */ + 0 + }; + +static const RPC_DISPATCH_FUNCTION RpcInterface_table[] = + { + NdrServerCall2, + NdrServerCall2, + NdrServerCall2, + NdrServerCall2, + NdrServerCall2, + 0 + }; +static const RPC_DISPATCH_TABLE RpcInterface_v1_0_DispatchTable = + { + 5, + (RPC_DISPATCH_FUNCTION*)RpcInterface_table + }; + +static const SERVER_ROUTINE RpcInterface_ServerRoutineTable[] = + { + (SERVER_ROUTINE)RemoteOpen, + (SERVER_ROUTINE)RemoteClose, + (SERVER_ROUTINE)StartMetering, + (SERVER_ROUTINE)SetSamplePeriod, + (SERVER_ROUTINE)StopMetering, + }; + +static const MIDL_SERVER_INFO RpcInterface_ServerInfo = + { + &RpcInterface_StubDesc, + RpcInterface_ServerRoutineTable, + RpcInterface__MIDL_ProcFormatString.Format, + RpcInterface_FormatStringOffsetTable, + 0, + 0, + 0, + 0}; +#if _MSC_VER >= 1200 +#pragma warning(pop) +#endif + + +#endif /* defined(_M_AMD64)*/ + diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/SampleConfiguration.cpp b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/SampleConfiguration.cpp new file mode 100644 index 00000000..a808cf83 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/SampleConfiguration.cpp @@ -0,0 +1,21 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +#include "pch.h" +#include "MainPage.xaml.h" +#include "SampleConfiguration.h" + +using namespace SDKTemplate; + +Platform::Array<Scenario>^ MainPage::scenariosInner = ref new Platform::Array<Scenario> +{ + { "Connect to an NT Service", "SDKTemplate.MeteringData" }, +}; diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/SampleConfiguration.h b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/SampleConfiguration.h new file mode 100644 index 00000000..22581275 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/SampleConfiguration.h @@ -0,0 +1,47 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +#pragma once +#include "pch.h" + +namespace SDKTemplate +{ + value struct Scenario; + + partial ref class MainPage + { + internal: + static property Platform::String^ FEATURE_NAME + { + Platform::String^ get() + { + return "Custom Capability C++ sample"; + } + } + + static property Platform::Array<Scenario>^ scenarios + { + Platform::Array<Scenario>^ get() + { + return scenariosInner; + } + } + + private: + static Platform::Array<Scenario>^ scenariosInner; + }; + + public value struct Scenario + { + Platform::String^ Title; + Platform::String^ ClassName; + }; +} diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Scenario1_MeteringData.xaml b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Scenario1_MeteringData.xaml new file mode 100644 index 00000000..0636f74d --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Scenario1_MeteringData.xaml @@ -0,0 +1,68 @@ +<!-- +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* +--> +<Page + x:Class="SDKTemplate.MeteringData" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + mc:Ignorable="d"> + + <ScrollViewer Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Padding="12,10,12,12"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="*"/> + </Grid.RowDefinitions> + <StackPanel Margin="0,0,0,10"> + <TextBlock Text="Description:" Style="{StaticResource SampleHeaderTextStyle}"/> + <TextBlock Style="{StaticResource ScenarioDescriptionTextStyle}" TextWrapping="Wrap"> + This scenario demonstrates RPC communication between an app and an NT service. For demonstration purposes, the service reads data from an imaginary device. + </TextBlock> + <StackPanel BorderThickness="2" BorderBrush="{ThemeResource ButtonBorderThemeBrush}" Margin="0,10,0,0" Padding="5"> + <TextBlock TextWrapping="Wrap"> + <Run FontWeight="Bold" Text="Step 1: Choose a period at which the samples will be pushed from the NT service"/> + </TextBlock> + <TextBlock TextWrapping="Wrap" Margin="0,10,5,0"> + Sample Period (ms): <Run Text="{x:Bind SamplePeriodSlider.Value, Mode=OneWay}"/> + </TextBlock> + <Slider x:Name="SamplePeriodSlider" HorizontalAlignment="Left" Width="300" IsEnabled="{x:Bind ViewModel.SliderEnabled, Mode=OneWay}" VerticalAlignment="Top" Minimum="1" Maximum="1000" ValueChanged="slider_ValueChanged" FontSize="20" Value="{x:Bind ViewModel.SliderValue, Mode=OneWay}"/> + </StackPanel> + <StackPanel BorderThickness="2" BorderBrush="{ThemeResource ButtonBorderThemeBrush}" Margin="0,10,0,0" Padding="5"> + <TextBlock TextWrapping="Wrap"> + <Run FontWeight="Bold" Text="Step 2: Click start to receive samples from the NT service"/> + </TextBlock> + <StackPanel Orientation="Horizontal" Margin="0,10,0,0"> + <Button IsEnabled="{x:Bind ViewModel.StartButtonEnabled, Mode=OneWay}" Content="Start" Click="button_Click_StartMetering"/> + <Button IsEnabled="{x:Bind ViewModel.StopButtonEnabled, Mode=OneWay}" Content="Stop" Click="button_Click_StopMetering" Margin="10,0,0,0"/> + </StackPanel> + </StackPanel> + <StackPanel BorderThickness="2" BorderBrush="{ThemeResource ButtonBorderThemeBrush}" Margin="0,10,0,0" Padding="5"> + <TextBlock TextWrapping="Wrap"> + <Run FontWeight="Bold" Text="Step 3: Observe the expected and actual incoming sample rate"/> + </TextBlock> + <TextBlock Margin="0,10,0,0"> + Expected Sample Rate: <Run Text="{x:Bind ViewModel.ExpectedRpcCallbackRate, Mode=OneWay}"/> + </TextBlock> + <TextBlock Margin="0,10,0,0"> + Actual Sample Rate: <Run Text="{x:Bind ViewModel.ActualRpcCallbackRate, Mode=OneWay}"/> + </TextBlock> + </StackPanel> + <TextBlock FontWeight="Bold" Margin="0,10,0,0" Text="Samples:"/> + </StackPanel> + <ScrollViewer Grid.Row="2" HorizontalAlignment="Stretch" Margin="0,10,0,0" VerticalAlignment="Stretch"> + <TextBox Height="400" IsReadOnly="true" HorizontalAlignment="Stretch" Text="{x:Bind ViewModel.SampleMessage, Mode=OneWay}" BorderThickness="0"/> + </ScrollViewer> + </Grid> + </ScrollViewer> +</Page> diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Scenario1_MeteringData.xaml.cpp b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Scenario1_MeteringData.xaml.cpp new file mode 100644 index 00000000..3a9e1f48 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Scenario1_MeteringData.xaml.cpp @@ -0,0 +1,47 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +#include "pch.h" +#include "Scenario1_MeteringData.xaml.h" + +using namespace SDKTemplate; + +using namespace Platform; +using namespace Windows::Foundation; +using namespace Windows::Foundation::Collections; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls::Primitives; + +MeteringData::MeteringData() +{ + InitializeComponent(); + ViewModel = ref new ServiceViewModel(); +} + +void SDKTemplate::MeteringData::button_Click_StartMetering(Object^ sender, RoutedEventArgs^ e) +{ + ViewModel->StartMetering((int)SamplePeriodSlider->Value); +} + +void SDKTemplate::MeteringData::button_Click_StopMetering(Object^ sender, RoutedEventArgs^ e) +{ + ViewModel->StopMetering(); +} + +void SDKTemplate::MeteringData::slider_ValueChanged(Object^ sender, RangeBaseValueChangedEventArgs^ e) +{ + // Ignore slider value changes prior to ViewModel initialization. + if (ViewModel != nullptr) + { + // Update the sample period in response to slider change. + ViewModel->SetSamplePeriod((int)SamplePeriodSlider->Value); + } +} diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Scenario1_MeteringData.xaml.h b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Scenario1_MeteringData.xaml.h new file mode 100644 index 00000000..79faa4f3 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/Scenario1_MeteringData.xaml.h @@ -0,0 +1,31 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +#pragma once + +#include "Scenario1_MeteringData.g.h" +#include "ServiceViewModel.h" + +namespace SDKTemplate +{ + [Windows::Foundation::Metadata::WebHostHidden] + public ref class MeteringData sealed + { + public: + MeteringData(); + property ServiceViewModel^ ViewModel; + + private: + void button_Click_StartMetering(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void button_Click_StopMetering(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void slider_ValueChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::Primitives::RangeBaseValueChangedEventArgs^ e); + }; +} diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/ServiceViewModel.cpp b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/ServiceViewModel.cpp new file mode 100644 index 00000000..9f9674c4 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/ServiceViewModel.cpp @@ -0,0 +1,282 @@ +#include "pch.h" +#include "ServiceViewModel.h" +#include "MainPage.xaml.h" + +using namespace Concurrency; +using namespace Platform; +using namespace SDKTemplate; +using namespace Windows::System::Threading; +using namespace Windows::UI::Xaml::Data; + +ServiceViewModel::ServiceViewModel() +{ + // Set default rate + samplePeriod = 100; + + // Initialize UI state + startButtonEnabled = true; + stopButtonEnabled = false; + sliderEnabled = true; + sliderValue = samplePeriod; + actualRpcCallbackRate = "0"; + expectedRpcCallbackRate = "0"; + + meteringOn = false; + + // Get the dispatcher for notifying property change + dispatcher = Windows::UI::Core::CoreWindow::GetForCurrentThread()->Dispatcher; + + sampleArray = ref new Platform::Array<__int64>(1000); +} + +// +// if errCode represents an error, then display a message and return true. +// +inline bool ServiceViewModel::NotifyIfAnyError(__int64 errCode) +{ + if (errCode != 0) + { + meteringOn = false; + NotifyStatusMessage("Error occured while communicating with RPC server: " + errCode.ToString(), NotifyType::ErrorMessage); + + // Reset button state + StartButtonEnabled = true; + StopButtonEnabled = false; + return true; + } + return false; +} + +// Bindable properties +#pragma region BindableProperties + +String^ ServiceViewModel::ExpectedRpcCallbackRate::get() { return expectedRpcCallbackRate; } +void ServiceViewModel::ExpectedRpcCallbackRate::set(String^ value) +{ + if (expectedRpcCallbackRate != value) + { + expectedRpcCallbackRate = value; + NotifyPropertyChanged("ExpectedRpcCallbackRate"); + } +} + +String^ ServiceViewModel::ActualRpcCallbackRate::get() { return actualRpcCallbackRate; } +void ServiceViewModel::ActualRpcCallbackRate::set(String^ value) +{ + if (actualRpcCallbackRate != value) + { + actualRpcCallbackRate = value; + NotifyPropertyChanged("ActualRpcCallbackRate"); + } +} + +String^ ServiceViewModel::SampleMessage::get() { return sampleMessage; } +void ServiceViewModel::SampleMessage::set(String^ value) +{ + if (sampleMessage != value) + { + sampleMessage = value; + NotifyPropertyChanged("SampleMessage"); + } +} + +bool ServiceViewModel::StartButtonEnabled::get() { return startButtonEnabled; } +void ServiceViewModel::StartButtonEnabled::set(bool value) +{ + if (startButtonEnabled != value) + { + startButtonEnabled = value; + NotifyPropertyChanged("StartButtonEnabled"); + } +} + +bool ServiceViewModel::StopButtonEnabled::get() { return stopButtonEnabled; } +void ServiceViewModel::StopButtonEnabled::set(bool value) +{ + if (stopButtonEnabled != value) + { + stopButtonEnabled = value; + NotifyPropertyChanged("StopButtonEnabled"); + } +} + +bool ServiceViewModel::SliderEnabled::get() { return sliderEnabled; } +void ServiceViewModel::SliderEnabled::set(bool value) +{ + if (sliderEnabled != value) + { + sliderEnabled = value; + NotifyPropertyChanged("SliderEnabled"); + } +} + +double ServiceViewModel::SliderValue::get() { return sliderValue; } +void ServiceViewModel::SliderValue::set(double value) +{ + if (sliderValue != value) + { + sliderValue = value; + NotifyPropertyChanged("SliderValue"); + } +} +#pragma endregion BindableProperties + +void SDKTemplate::ServiceViewModel::NotifyPropertyChanged(Platform::String^ prop) +{ + if (dispatcher != nullptr) + { + dispatcher->RunAsync( + Windows::UI::Core::CoreDispatcherPriority::Normal, + ref new Windows::UI::Core::DispatchedHandler([this, prop]() + { + PropertyChangedEventArgs^ args = + ref new PropertyChangedEventArgs(prop); + PropertyChanged(this, args); + })); + } + // else log error +} + +// +// Initializes rpcclient and metering +// +void ServiceViewModel::StartMetering(int sampleRate) +{ + create_task([this, sampleRate] + { + SampleMessage = ""; + StartButtonEnabled = false; + StopButtonEnabled = true; + stopMeteringRequested = false; + + rpcclient = std::make_unique<RpcClient>(); + if (NotifyIfAnyError(rpcclient->Initialize())) return; + + meteringOn = true; + sampleRefreshCount = 0; + sampleArray[0] = 0; + + // Set the sample rate on server + this->samplePeriod = sampleRate; + __int64 retCode = rpcclient->SetSampleRate(sampleRate); + + FILETIME initialSystemTime; + GetSystemTimeAsFileTime(&initialSystemTime); + lastUpdateTime.LowPart = initialSystemTime.dwLowDateTime; + lastUpdateTime.HighPart = initialSystemTime.dwHighDateTime; + + if (!NotifyIfAnyError(retCode)) + { + // Set up worker for UI update. + Windows::Foundation::TimeSpan span{ 100 * 10000 }; // 100ms refresh rate + + auto timerHandler = ref new TimerElapsedHandler([this](ThreadPoolTimer^) + { + __int64 meteringData = rpcclient->MeteringData; + + // If there is no new data, return + if (sampleArray[0] == meteringData) + { + return; + } + + // Arithmetic subtraction of time + // https://msdn.microsoft.com/en-us/library/ms724950%28VS.85%29.aspx?f=255&MSPPError=-2147217396 + FILETIME currentSystemTime; + ULARGE_INTEGER currentTimeUi; + GetSystemTimeAsFileTime(¤tSystemTime); + currentTimeUi.LowPart = currentSystemTime.dwLowDateTime; + currentTimeUi.HighPart = currentSystemTime.dwHighDateTime; + + // Calculate number of samples received since last callback + __int64 now = rpcclient->CallbackCount; + __int64 diff = now - rpcDataCountOld; + rpcDataCountOld = now; + + // Calculate incoming sample rate + double rate = (double)diff*1E7 / (currentTimeUi.QuadPart - lastUpdateTime.QuadPart); + ExpectedRpcCallbackRate = (1E3 / this->samplePeriod).ToString() + " /sec"; + lastUpdateTime = currentTimeUi; + + ActualRpcCallbackRate = rate.ToString() + " /sec"; + + // Construct the sample data string + String^ sampleMessage = meteringData + "\n"; + unsigned int length = sampleArray->Length; + if (sampleRefreshCount < length) + { + ++sampleRefreshCount; + length = sampleRefreshCount; + } + + // Insert the new data point at the top of the array. + // Old data falls off the end of the array. + for (unsigned int i = 1; i < length; ++i) + { + sampleArray[i] = sampleArray[i - 1]; + sampleMessage += sampleArray[i] + "\n"; + } + sampleArray[0] = meteringData; + + SampleMessage = sampleMessage; + }); + + ThreadPoolTimer^ periodicTimer = ThreadPoolTimer::CreatePeriodicTimer(timerHandler, span); + NotifyStatusMessage("Metering start command sent successfully", NotifyType::StatusMessage); + retCode = this->rpcclient->StartMeteringAndWaitForStop(sampleRate); + meteringOn = false; + periodicTimer->Cancel(); + if (!NotifyIfAnyError(retCode) && !stopMeteringRequested) + { + NotifyStatusMessage("Rpc server connection closed without stop metering being requested", + NotifyType::ErrorMessage); + StartButtonEnabled = true; + StopButtonEnabled = false; + } + } + }); +} + +// +// Stop metering +// +void ServiceViewModel::StopMetering() +{ + create_task([this] + { + StopButtonEnabled = false; + SliderEnabled = false; + stopMeteringRequested = true; + + __int64 retCode = this->rpcclient->StopMetering(); + if (!NotifyIfAnyError(retCode)) + { + NotifyStatusMessage("Metering stop command sent successfully", + NotifyType::StatusMessage); + } + + SliderEnabled = true; + StartButtonEnabled = true; + }); +} + +// +// Set sample period +// +void ServiceViewModel::SetSamplePeriod(int samplePeriod) +{ + create_task([this, samplePeriod] + { + this->samplePeriod = samplePeriod; + if (meteringOn) + { + _int64 retCode = rpcclient->SetSampleRate(samplePeriod); + if (!NotifyIfAnyError(retCode)) + { + NotifyStatusMessage( + "Sample period set to: " + samplePeriod, + NotifyType::StatusMessage); + } + } + }); +}
\ No newline at end of file diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/ServiceViewModel.h b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/ServiceViewModel.h new file mode 100644 index 00000000..c2fcad0c --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/ServiceViewModel.h @@ -0,0 +1,77 @@ +#pragma once + +#include "RpcClient.h" +#include <memory> + +namespace SDKTemplate +{ + [Windows::UI::Xaml::Data::Bindable] + public ref class ServiceViewModel sealed : Windows::UI::Xaml::Data::INotifyPropertyChanged + { + public: + ServiceViewModel(); + void StartMetering(int sampleRate); + void SetSamplePeriod(int rate); + void StopMetering(); + property Platform::String^ ExpectedRpcCallbackRate + { + Platform::String^ get(); + void set(Platform::String^ value); + } + property Platform::String^ ActualRpcCallbackRate + { + Platform::String^ get(); + void set(Platform::String^ value); + } + property Platform::String^ SampleMessage + { + Platform::String^ get(); + void set(Platform::String^ value); + } + property bool StartButtonEnabled + { + bool get(); + void set(bool value); + } + property bool StopButtonEnabled + { + bool get(); + void set(bool value); + } + property bool SliderEnabled + { + bool get(); + void set(bool value); + } + property double SliderValue + { + double get(); + void set(double value); + } + virtual event Windows::UI::Xaml::Data::PropertyChangedEventHandler^ PropertyChanged; + + private: + volatile bool meteringOn; + Windows::UI::Core::ICoreDispatcher^ dispatcher; + int samplePeriod; + ULARGE_INTEGER lastUpdateTime; + __int64 rpcDataCountOld = 0; + unsigned int sampleRefreshCount = 0; + std::unique_ptr<RpcClient> rpcclient; + bool stopMeteringRequested; + bool NotifyIfAnyError(__int64 errCode); + + // Variables backing UI bindings + Platform::String^ sampleMessage; + Platform::String^ expectedRpcCallbackRate; + Platform::String^ actualRpcCallbackRate; + bool startButtonEnabled; + bool stopButtonEnabled; + bool sliderEnabled; + double sliderValue; + + void NotifyPropertyChanged(Platform::String^ prop); + + Platform::Array<__int64>^ sampleArray; + }; +} diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/pch.cpp b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/pch.cpp new file mode 100644 index 00000000..b300c4c0 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/pch.cpp @@ -0,0 +1,60 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +// +// pch.cpp +// Include the standard header and generate the precompiled header. +// + +#include "pch.h" +#include "MainPage.xaml.h" + +#include <robuffer.h> +#include <wrl\client.h> + +using namespace Microsoft::WRL; +using namespace Windows::Storage::Streams; + +byte* GetArrayFromBuffer(Windows::Storage::Streams::IBuffer^ buffer) +{ + ComPtr<IInspectable> base = reinterpret_cast<IInspectable*>(buffer); + ComPtr<IBufferByteAccess> access; + + auto hr = base.As(&access); + + if (FAILED(hr)) + { + throw Platform::Exception::CreateException(hr); + } + + byte* data; + + hr = access->Buffer(&data); + + if (FAILED(hr)) + { + throw Platform::Exception::CreateException(hr); + } + + // The returned buffer is valid as long as the IBuffer passed in + // remains valid. + return data; +} + +void NotifyStatusMessage(Platform::String^ message, SDKTemplate::NotifyType messageType) +{ + SDKTemplate::MainPage::Current->Dispatcher->RunAsync( + Windows::UI::Core::CoreDispatcherPriority::Normal, + ref new Windows::UI::Core::DispatchedHandler( + [message, messageType]() { + SDKTemplate::MainPage::Current->NotifyUser(message, messageType); + })); +} diff --git a/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/pch.h b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/pch.h new file mode 100644 index 00000000..3cec6ca5 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/App/CustomCapability/cpp/pch.h @@ -0,0 +1,27 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +// +// pch.h +// Header for standard system include files. +// + +#pragma once + +#include <collection.h> +#include <ppltasks.h> + +#include "App.xaml.h" +#include "MainPage.xaml.h" + +byte* GetArrayFromBuffer(Windows::Storage::Streams::IBuffer^ buffer); + +void NotifyStatusMessage(Platform::String^ message, SDKTemplate::NotifyType messageType); diff --git a/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/cpp/App.xaml.cpp b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/cpp/App.xaml.cpp new file mode 100644 index 00000000..1abebcb3 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/cpp/App.xaml.cpp @@ -0,0 +1,134 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +#include "pch.h" +#include "MainPage.xaml.h" + +using namespace SDKTemplate; + +using namespace Platform; +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::Foundation; +using namespace Windows::Foundation::Collections; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; +using namespace Windows::UI::Xaml::Controls::Primitives; +using namespace Windows::UI::Xaml::Data; +using namespace Windows::UI::Xaml::Input; +using namespace Windows::UI::Xaml::Interop; +using namespace Windows::UI::Xaml::Media; +using namespace Windows::UI::Xaml::Navigation; + +// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=402347&clcid=0x409 + +// These placeholder functions are used if the sample does not +// implement the corresponding methods. This allows us to simulate +// C# partial methods in C++. + +static void Partial_Construct() { } + +/// <summary> +/// Initializes the singleton application object. This is the first line of authored code +/// executed, and as such is the logical equivalent of main() or WinMain(). +/// </summary> +App::App() +{ + InitializeComponent(); + Partial_Construct(); + Suspending += ref new Windows::UI::Xaml::SuspendingEventHandler(this, &SDKTemplate::App::OnSuspending); +} + +/// <summary> +/// Invoked when the application is launched normally by the end user. Other entry points +/// will be used such as when the application is launched to open a specific file. +/// </summary> +/// <param name="e">Details about the launch request and process.</param> +void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) +{ +#if _DEBUG + // Show graphics profiling information while debugging. + if (IsDebuggerPresent()) + { + // Display the current frame rate counters + DebugSettings->EnableFrameRateCounter = false; + } +#endif + + auto rootFrame = dynamic_cast<Frame^>(Window::Current->Content); + + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active + if (rootFrame == nullptr) + { + // Create a Frame to act as the navigation context and associate it with + // a SuspensionManager key + rootFrame = ref new Frame(); + + // Set the default language + rootFrame->Language = Windows::Globalization::ApplicationLanguages::Languages->GetAt(0); + + rootFrame->NavigationFailed += ref new Windows::UI::Xaml::Navigation::NavigationFailedEventHandler(this, &App::OnNavigationFailed); + + if (e->PreviousExecutionState == ApplicationExecutionState::Terminated) + { + // TODO: Restore the saved session state only when appropriate, scheduling the + // final launch steps after the restore is complete + } + + if (rootFrame->Content == nullptr) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments); + } + // Place the frame in the current Window + Window::Current->Content = rootFrame; + // Ensure the current window is active + Window::Current->Activate(); + } + else + { + if (rootFrame->Content == nullptr) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + rootFrame->Navigate(TypeName(MainPage::typeid), e->Arguments); + } + // Ensure the current window is active + Window::Current->Activate(); + } +} + +/// <summary> +/// Invoked when application execution is being suspended. Application state is saved +/// without knowing whether the application will be terminated or resumed with the contents +/// of memory still intact. +/// </summary> +/// <param name="sender">The source of the suspend request.</param> +/// <param name="e">Details about the suspend request.</param> +void App::OnSuspending(Object^ /* sender */, SuspendingEventArgs^ /* e */) +{ + //TODO: Save application state and stop any background activity +} + + +/// <summary> +/// Invoked when Navigation to a certain page fails +/// </summary> +/// <param name="sender">The Frame which failed navigation</param> +/// <param name="e">Details about the navigation failure</param> +void App::OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e) +{ + throw ref new FailureException("Failed to load Page " + e->SourcePageType.Name); +}
\ No newline at end of file diff --git a/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/cpp/App.xaml.h b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/cpp/App.xaml.h new file mode 100644 index 00000000..e7bd715a --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/cpp/App.xaml.h @@ -0,0 +1,33 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +#pragma once + +#include "App.g.h" + +namespace SDKTemplate +{ + /// <summary> + /// Provides application-specific behavior to supplement the default Application class. + /// </summary> + ref class App sealed + { + protected: + virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override; + + internal: + App(); + + private: + void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e); + void OnNavigationFailed(Platform::Object ^sender, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs ^e); + }; +} diff --git a/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/cpp/DeviceHelpers.h b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/cpp/DeviceHelpers.h new file mode 100644 index 00000000..c2fa82b2 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/cpp/DeviceHelpers.h @@ -0,0 +1,67 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +#pragma once + +namespace SDKTemplate +{ + namespace DeviceHelpers + { + // We use a DeviceWatcher instead of DeviceInformation.FindAllAsync because + // the DeviceWatcher will let us see the devices as they are discovered, + // whereas FindAllAsync returns results only after discovery is complete. + // + // The convertAsync functional is passed a device ID (Platform::String^) and returns a + // Concurrency::task<Something^>. + template<typename Converter> + auto GetFirstDeviceAsync(Platform::String^ selector, Converter convertAsync) + -> decltype(convertAsync(nullptr)) + { + using T = typename decltype(convertAsync(nullptr))::result_type; + Concurrency::task_completion_event<T> completionEvent; + auto pendingTasks = std::make_shared<std::vector<Concurrency::task<void>>>(); + Windows::Devices::Enumeration::DeviceWatcher^ watcher = Windows::Devices::Enumeration::DeviceInformation::CreateWatcher(selector); + + watcher->Added += ref new Windows::Foundation::TypedEventHandler<Windows::Devices::Enumeration::DeviceWatcher^, Windows::Devices::Enumeration::DeviceInformation^>( + [completionEvent, pendingTasks, convertAsync](Windows::Devices::Enumeration::DeviceWatcher^ sender, Windows::Devices::Enumeration::DeviceInformation^ device) + { + auto task = convertAsync(device->Id).then([completionEvent](T t) + { + if (t != nullptr) + { + completionEvent.set(t); + } + }); + pendingTasks->push_back(task); + }); + + watcher->EnumerationCompleted += ref new Windows::Foundation::TypedEventHandler<Windows::Devices::Enumeration::DeviceWatcher^, Platform::Object^>( + [completionEvent, pendingTasks](Windows::Devices::Enumeration::DeviceWatcher^ sender, Platform::Object^ args) + { + // Wait for completion of all the tasks we created in our "Added" event handler. + Concurrency::when_all(pendingTasks->begin(), pendingTasks->end()).then([completionEvent]() + { + // This sets the result to "nullptr" if no task was able to produce a device. + completionEvent.set(nullptr); + }); + }); + + watcher->Start(); + + // Wait for enumeration to complete or for a device to be found, whichever comes first. + return Concurrency::create_task(completionEvent).then([watcher](T result) + { + watcher->Stop(); + return result; + }); + } + } +} diff --git a/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/cpp/MainPage.xaml b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/cpp/MainPage.xaml new file mode 100644 index 00000000..5179f520 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/cpp/MainPage.xaml @@ -0,0 +1,80 @@ +<!-- +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* +--> + +<Page + x:Class="SDKTemplate.MainPage" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="using:SDKTemplate" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + mc:Ignorable="d"> + + <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="*"/> + </Grid.RowDefinitions> + <SplitView x:Name="Splitter" IsPaneOpen="True" Grid.Row="1" DisplayMode="Inline"> + <SplitView.Pane> + <RelativePanel Margin="10,0,0,0"> + <TextBlock x:Name="SampleTitle" Text="Sample Title Here" Style="{StaticResource SampleHeaderTextStyle}" TextWrapping="Wrap" Margin="0,10,0,0"/> + <ListBox x:Name="ScenarioControl" SelectionChanged="ScenarioControl_SelectionChanged" + SelectionMode="Single" HorizontalAlignment="Left" Background="Transparent" BorderThickness="0" + VerticalAlignment="Top" RelativePanel.Below="SampleTitle" Margin="0,10,0,0" RelativePanel.Above="FooterPanel"> + <ListBox.ItemTemplate> + <DataTemplate> + <TextBlock Text="{Binding Converter={StaticResource ScenarioConverter}}"/> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + <StackPanel x:Name="FooterPanel" Orientation="Vertical" RelativePanel.AlignBottomWithPanel="True"> + <Image Source="Assets/microsoft-sdk.png" AutomationProperties.Name="Microsoft Logo" Stretch="None" HorizontalAlignment="Left" Margin="10,0,0,0"/> + <TextBlock x:Name="Copyright" Text="© Microsoft Corporation. All rights reserved." Style="{StaticResource CopyrightTextStyle}" + RelativePanel.Above="LinksPanel" Margin="10,10,0,0" + TextWrapping="Wrap"/> + <StackPanel x:Name="LinksPanel" Orientation="Horizontal" Margin="10,10,0,10"> + <HyperlinkButton Content="Trademarks" Tag="http://go.microsoft.com/fwlink/?LinkID=623755" + Click="Footer_Click" FontSize="12" Style="{StaticResource HyperlinkStyle}" /> + <TextBlock Text="|" Style="{StaticResource SeparatorStyle}" VerticalAlignment="Center" /> + <HyperlinkButton x:Name="PrivacyLink" Content="Privacy" Tag="http://privacy.microsoft.com" Click="Footer_Click" FontSize="12" Style="{StaticResource HyperlinkStyle}"/> + </StackPanel> + </StackPanel> + </RelativePanel> + </SplitView.Pane> + <RelativePanel> + <Frame x:Name="ScenarioFrame" Margin="0,5,0,0" RelativePanel.AlignTopWithPanel="True" RelativePanel.Above="StatusPanel" RelativePanel.AlignRightWithPanel="True" RelativePanel.AlignLeftWithPanel="True"/> + <StackPanel x:Name="StatusPanel" Orientation="Vertical" RelativePanel.AlignBottomWithPanel="True" RelativePanel.AlignRightWithPanel="True" RelativePanel.AlignLeftWithPanel="True"> + <TextBlock x:Name="StatusLabel" Margin="0,0,0,10" TextWrapping="Wrap" Text="Status:" /> + <Border x:Name="StatusBorder" Margin="0,0,0,0" Visibility="Visible" > + <ScrollViewer VerticalScrollMode="Auto" VerticalScrollBarVisibility="Auto" MaxHeight="200"> + <TextBlock x:Name="StatusBlock" FontWeight="Bold" + MaxWidth="{Binding ElementName=Splitter, Path=ActualWidth}" Margin="10,10,10,20" TextWrapping="Wrap" /> + </ScrollViewer> + </Border> + </StackPanel> + </RelativePanel> + </SplitView> + <StackPanel x:Name="HeaderPanel" Orientation="Horizontal"> + <Border Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Grid.Row="0"> + <ToggleButton Style="{StaticResource SymbolButton}" Click="Button_Click" VerticalAlignment="Top" Foreground="{ThemeResource ApplicationForegroundThemeBrush}"> + <ToggleButton.Content> + <FontIcon x:Name="Hamburger" FontFamily="Segoe MDL2 Assets" Glyph="" Margin="0,10,0,0"/> + </ToggleButton.Content> + </ToggleButton> + </Border> + <Image x:Name="WindowsLogo" Stretch="None" Source="Assets/windows-sdk.png" Margin="0,15,0,0" /> + <TextBlock x:Name="Header" Text="Universal Windows Platform sample" Style="{StaticResource TagLineTextStyle}" Margin="0,15,0,0" /> + </StackPanel> + </Grid> +</Page> diff --git a/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/cpp/MainPage.xaml.cpp b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/cpp/MainPage.xaml.cpp new file mode 100644 index 00000000..24c12f68 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/cpp/MainPage.xaml.cpp @@ -0,0 +1,154 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +#include "pch.h" +#include "MainPage.xaml.h" + +using namespace SDKTemplate; +using namespace Platform; +using namespace Windows::Foundation; +using namespace Windows::Foundation::Collections; +using namespace Windows::UI::Core; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; +using namespace Windows::UI::Xaml::Controls::Primitives; +using namespace Windows::UI::Xaml::Data; +using namespace Windows::UI::Xaml::Input; +using namespace Windows::UI::Xaml::Media; +using namespace Windows::UI::Xaml::Navigation; +using namespace Windows::UI::Xaml::Interop; + +// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409 + +MainPage^ MainPage::Current = nullptr; + +MainPage::MainPage() +{ + InitializeComponent(); + SampleTitle->Text = FEATURE_NAME; + + // This is a static public property that allows downstream pages to get a handle to the MainPage instance + // in order to call methods that are in this class. + MainPage::Current = this; +} + +void MainPage::OnNavigatedTo(NavigationEventArgs^ e) +{ + // Populate the ListBox with the scenarios as defined in SampleConfiguration.cpp. + auto itemCollection = ref new Platform::Collections::Vector<Object^>(); + int i = 1; + for (auto const& s : MainPage::Current->scenarios) + { + // Create a textBlock to hold the content and apply the ListItemTextStyle from Styles.xaml + TextBlock^ textBlock = ref new TextBlock(); + ListBoxItem^ item = ref new ListBoxItem(); + auto style = App::Current->Resources->Lookup("ListItemTextStyle"); + + textBlock->Text = (i++).ToString() + ") " + s.Title; + textBlock->Style = safe_cast<Windows::UI::Xaml::Style ^>(style); + + item->Name = s.ClassName; + item->Content = textBlock; + itemCollection->Append(item); + } + + // Set the newly created itemCollection as the ListBox ItemSource. + ScenarioControl->ItemsSource = itemCollection; + int startingScenarioIndex; + + if (Window::Current->Bounds.Width < 640) + { + startingScenarioIndex = -1; + } + else + { + startingScenarioIndex = 0; + } + + ScenarioControl->SelectedIndex = startingScenarioIndex; + ScenarioControl->ScrollIntoView(ScenarioControl->SelectedItem); +} + + +void MainPage::ScenarioControl_SelectionChanged(Object^ sender, SelectionChangedEventArgs^ e) +{ + ListBox^ scenarioListBox = safe_cast<ListBox^>(sender); //as ListBox; + ListBoxItem^ item = dynamic_cast<ListBoxItem^>(scenarioListBox->SelectedItem); + if (item != nullptr) + { + // Clear the status block when changing scenarios + NotifyUser("", NotifyType::StatusMessage); + + // Navigate to the selected scenario. + TypeName scenarioType = { item->Name, TypeKind::Custom }; + ScenarioFrame->Navigate(scenarioType, this); + + if (Window::Current->Bounds.Width < 640) + { + Splitter->IsPaneOpen = false; + } + } +} + +void MainPage::NotifyUser(String^ strMessage, NotifyType type) +{ + if (Dispatcher->HasThreadAccess) + { + UpdateStatus(strMessage, type); + } + else + { + Dispatcher->RunAsync(CoreDispatcherPriority::Normal, ref new DispatchedHandler([strMessage, type, this]() + { + UpdateStatus(strMessage, type); + })); + } +} + +void MainPage::UpdateStatus(String^ strMessage, NotifyType type) +{ + switch (type) + { + case NotifyType::StatusMessage: + StatusBorder->Background = ref new SolidColorBrush(Windows::UI::Colors::Green); + break; + case NotifyType::ErrorMessage: + StatusBorder->Background = ref new SolidColorBrush(Windows::UI::Colors::Red); + break; + default: + break; + } + + StatusBlock->Text = strMessage; + + // Collapse the StatusBlock if it has no text to conserve real estate. + if (StatusBlock->Text != "") + { + StatusBorder->Visibility = Windows::UI::Xaml::Visibility::Visible; + StatusPanel->Visibility = Windows::UI::Xaml::Visibility::Visible; + } + else + { + StatusBorder->Visibility = Windows::UI::Xaml::Visibility::Collapsed; + StatusPanel->Visibility = Windows::UI::Xaml::Visibility::Collapsed; + } +} + +void MainPage::Footer_Click(Object^ sender, RoutedEventArgs^ e) +{ + auto uri = ref new Uri((String^)((HyperlinkButton^)sender)->Tag); + Windows::System::Launcher::LaunchUriAsync(uri); +} + +void MainPage::Button_Click(Object^ sender, RoutedEventArgs^ e) +{ + Splitter->IsPaneOpen = !Splitter->IsPaneOpen; +}
\ No newline at end of file diff --git a/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/cpp/MainPage.xaml.h b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/cpp/MainPage.xaml.h new file mode 100644 index 00000000..e87e24f0 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/cpp/MainPage.xaml.h @@ -0,0 +1,46 @@ +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* + +#pragma once + +#include "MainPage.g.h" +#include "SampleConfiguration.h" + +namespace SDKTemplate +{ + public enum class NotifyType + { + StatusMessage, + ErrorMessage + }; + + /// <summary> + /// An empty page that can be used on its own or navigated to within a Frame. + /// </summary> + public ref class MainPage sealed + { + public: + MainPage(); + + protected: + virtual void OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e) override; + + private: + void ScenarioControl_SelectionChanged(Platform::Object^ sender, Windows::UI::Xaml::Controls::SelectionChangedEventArgs^ e); + void Footer_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void Button_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void UpdateStatus(Platform::String^ strMessage, NotifyType type); + + internal: + static MainPage^ Current; + void NotifyUser(Platform::String^ strMessage, NotifyType type); + }; +} diff --git a/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/Square310x310Logo.png b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/Square310x310Logo.png Binary files differnew file mode 100644 index 00000000..c96f294a --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/Square310x310Logo.png diff --git a/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/microsoft-sdk.png b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/microsoft-sdk.png Binary files differnew file mode 100644 index 00000000..380a0102 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/microsoft-sdk.png diff --git a/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/placeholder-sdk.png b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/placeholder-sdk.png Binary files differnew file mode 100644 index 00000000..01b3138c --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/placeholder-sdk.png diff --git a/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/placeholder.png b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/placeholder.png Binary files differnew file mode 100644 index 00000000..e2d83818 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/placeholder.png diff --git a/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/smalltile-sdk.png b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/smalltile-sdk.png Binary files differnew file mode 100644 index 00000000..ba9a0cde --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/smalltile-sdk.png diff --git a/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/splash-sdk.png b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/splash-sdk.png Binary files differnew file mode 100644 index 00000000..e00df02c --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/splash-sdk.png diff --git a/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/squaretile-sdk.png b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/squaretile-sdk.png Binary files differnew file mode 100644 index 00000000..f97c34a9 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/squaretile-sdk.png diff --git a/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/storelogo-sdk.png b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/storelogo-sdk.png Binary files differnew file mode 100644 index 00000000..5c397dea --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/storelogo-sdk.png diff --git a/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/tile-sdk.png b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/tile-sdk.png Binary files differnew file mode 100644 index 00000000..f72683f2 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/tile-sdk.png diff --git a/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/windows-sdk.png b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/windows-sdk.png Binary files differnew file mode 100644 index 00000000..67268021 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/media/windows-sdk.png diff --git a/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/xaml/App.xaml b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/xaml/App.xaml new file mode 100644 index 00000000..63e80b83 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/xaml/App.xaml @@ -0,0 +1,34 @@ +<!-- +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* +--> +<Application + x:Class="SDKTemplate.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="using:SDKTemplate" + RequestedTheme="Dark"> + + <Application.Resources> + <!-- Application-specific resources --> + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + + <!-- + Styles that define common aspects of the platform look and feel + Required by Visual Studio project and item templates + --> + <ResourceDictionary Source="/Styles/Styles.xaml"/> + </ResourceDictionary.MergedDictionaries> + </ResourceDictionary> + </Application.Resources> + +</Application> diff --git a/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/xaml/Styles.xaml b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/xaml/Styles.xaml new file mode 100644 index 00000000..50602ae5 --- /dev/null +++ b/general/WinHEC 2017 Lab/Toaster Support App/SharedContent/xaml/Styles.xaml @@ -0,0 +1,536 @@ +<!-- +//********************************************************* +// +// Copyright (c) Microsoft. All rights reserved. +// This code is licensed under the MIT License (MIT). +// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF +// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY +// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR +// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. +// +//********************************************************* +--> +<ResourceDictionary + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="using:SDKTemplate"> + + <Style x:Key="SymbolButton" TargetType="ToggleButton"> + <Setter Property="FontSize" Value="16" /> + <Setter Property="FontFamily" Value="{StaticResource SymbolThemeFontFamily}" /> + <Setter Property="MinHeight" Value="48" /> + <Setter Property="MinWidth" Value="48" /> + <Setter Property="Margin" Value="0,4,0,0" /> + <Setter Property="Padding" Value="0" /> + <Setter Property="HorizontalAlignment" Value="Left" /> + <Setter Property="VerticalAlignment" Value="Top" /> + <Setter Property="HorizontalContentAlignment" Value="Center" /> + <Setter Property="VerticalContentAlignment" Value="Center" /> + <Setter Property="Background" Value="Transparent" /> + <Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}" /> + <Setter Property="Content" Value="" /> + <Setter Property="AutomationProperties.Name" Value="Menu" /> + <Setter Property="UseSystemFocusVisuals" Value="True" /> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="ToggleButton"> + <Grid x:Name="LayoutRoot" + Background="{TemplateBinding Background}"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal" /> + <VisualState x:Name="PointerOver"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="(Grid.Background)"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightListLowBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Pressed"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="(Grid.Background)"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightListMediumBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="(TextBlock.Foreground)"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseLowBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Checked"/> + <VisualState x:Name="CheckedPointerOver"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="(Grid.Background)"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightListLowBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="CheckedPressed"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="(Grid.Background)"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightListMediumBrush}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="CheckedDisabled"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="(TextBlock.Foreground)"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseLowBrush}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <ContentPresenter x:Name="ContentPresenter" + Content="{TemplateBinding Content}" + Margin="{TemplateBinding Padding}" + HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" + VerticalAlignment="{TemplateBinding VerticalContentAlignment}" + AutomationProperties.AccessibilityView="Raw" /> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style x:Key="BasicTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BodyTextBlockStyle}"> + <Setter Property="Margin" Value="0,0,0,12"/> + </Style> + + <Style x:Key="TagLineTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BodyTextBlockStyle}"> + </Style> + + <Style x:Key="SampleHeaderTextStyle" TargetType="TextBlock" BasedOn="{StaticResource TitleTextBlockStyle}"> + <Setter Property="FontSize" Value="28"/> + </Style> + + <Style x:Key="ListItemTextStyle" TargetType="TextBlock" BasedOn="{StaticResource SubtitleTextBlockStyle}"> + <Setter Property="FontSize" Value="18"/> + <Setter Property="Margin" Value="10,0,0,0"/> + <Setter Property="Foreground" Value="{StaticResource SystemControlForegroundBaseHighBrush}"/> + </Style> + + <Style x:Key="CopyrightTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}"> + <Setter Property="FontWeight" Value="Normal"/> + </Style> + + <Style x:Key="ScenarioHeaderTextStyle" TargetType="TextBlock" BasedOn="{StaticResource TitleTextBlockStyle}"> + </Style> + + <Style x:Key="ScenarioDescriptionTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BodyTextBlockStyle}"> + </Style> + + <Style x:Key="BaseMessageStyle" TargetType="TextBlock" BasedOn="{StaticResource BodyTextBlockStyle}"> + <Setter Property="Margin" Value="0,0,0,5"/> + </Style> + + <Style x:Key="SeparatorStyle" TargetType="TextBlock" BasedOn="{StaticResource BaseTextBlockStyle}"> + <Setter Property="FontSize" Value="9"/> + <Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}"/> + </Style> + + <Style x:Key="HyperlinkStyle" TargetType="HyperlinkButton"> + <Setter Property="Padding" Value="1"/> + <Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}"/> + <Setter Property="FontSize" Value="12"/> + </Style> + + <Style x:Key="NavMenuItemContainerStyle" TargetType="ListViewItem"> + <Setter Property="MinWidth" Value="{StaticResource SplitViewCompactPaneThemeLength}"/> + <Setter Property="MinHeight" Value="48"/> + <Setter Property="Padding" Value="0"/> + <Setter Property="UseSystemFocusVisuals" Value="False" /> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="ListViewItem"> + <Grid x:Name="ContentBorder" + HorizontalAlignment="Stretch" + Control.IsTemplateFocusTarget="True" + Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}" + RenderTransformOrigin="0.5,0.5"> + <Grid.RenderTransform> + <ScaleTransform x:Name="ContentBorderScale" /> + </Grid.RenderTransform> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"> + <Storyboard> + <PointerUpThemeAnimation Storyboard.TargetName="ContentPresenter" /> + </Storyboard> + </VisualState> + <VisualState x:Name="PointerOver"> + <Storyboard> + <DoubleAnimation Storyboard.TargetName="BorderBackground" + Storyboard.TargetProperty="Opacity" + Duration="0" + To="1"/> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderBackground" Storyboard.TargetProperty="Fill"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightListLowBrush}" /> + </ObjectAnimationUsingKeyFrames> + <PointerUpThemeAnimation Storyboard.TargetName="ContentPresenter" /> + </Storyboard> + </VisualState> + <VisualState x:Name="Pressed"> + <Storyboard> + <DoubleAnimation Storyboard.TargetName="BorderBackground" + Storyboard.TargetProperty="Opacity" + Duration="0" + To="1"/> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderBackground" Storyboard.TargetProperty="Fill"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightListMediumBrush}" /> + </ObjectAnimationUsingKeyFrames> + <PointerDownThemeAnimation TargetName="ContentPresenter" /> + </Storyboard> + </VisualState> + <VisualState x:Name="Selected"> + <Storyboard> + <DoubleAnimation Storyboard.TargetName="BorderBackground" + Storyboard.TargetProperty="Opacity" + Duration="0" + To="1"/> + <DoubleAnimation Storyboard.TargetName="SelectedPipe" + Storyboard.TargetProperty="Opacity" + Duration="0" + To="1"/> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderBackground" Storyboard.TargetProperty="Fill"> + <DiscreteObjectKeyFrame KeyTime="0" Value="Transparent" /> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlForegroundAccentBrush}" /> + </ObjectAnimationUsingKeyFrames> + <PointerUpThemeAnimation Storyboard.TargetName="ContentPresenter" /> + </Storyboard> + </VisualState> + <VisualState x:Name="PointerOverSelected"> + <Storyboard> + <DoubleAnimation Storyboard.TargetName="BorderBackground" + Storyboard.TargetProperty="Opacity" + Duration="0" + To="1"/> + <DoubleAnimation Storyboard.TargetName="SelectedPipe" + Storyboard.TargetProperty="Opacity" + Duration="0" + To="1"/> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderBackground" Storyboard.TargetProperty="Fill"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightListLowBrush}" /> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlForegroundAccentBrush}" /> + </ObjectAnimationUsingKeyFrames> + <PointerUpThemeAnimation Storyboard.TargetName="ContentPresenter" /> + </Storyboard> + </VisualState> + <VisualState x:Name="PressedSelected"> + <Storyboard> + <DoubleAnimation Storyboard.TargetName="BorderBackground" + Storyboard.TargetProperty="Opacity" + Duration="0" + To="1"/> + <DoubleAnimation Storyboard.TargetName="SelectedPipe" + Storyboard.TargetProperty="Opacity" + Duration="0" + To="1"/> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderBackground" Storyboard.TargetProperty="Fill"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightListMediumBrush}" /> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlForegroundAccentBrush}" /> + </ObjectAnimationUsingKeyFrames> + <PointerDownThemeAnimation TargetName="ContentPresenter" /> + </Storyboard> + </VisualState> + </VisualStateGroup> + <VisualStateGroup x:Name="DisabledStates"> + <VisualState x:Name="Enabled"/> + <VisualState x:Name="Disabled"> + <Storyboard> + <DoubleAnimation Storyboard.TargetName="ContentBorder" + Storyboard.TargetProperty="Opacity" + Duration="0" + To="{ThemeResource ListViewItemDisabledThemeOpacity}"/> + </Storyboard> + </VisualState> + </VisualStateGroup> + <VisualStateGroup x:Name="FocusStates"> + <VisualState x:Name="Unfocused"/> + <VisualState x:Name="Focused"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FocusBackground" Storyboard.TargetProperty="Fill"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightListLowBrush}" /> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Rectangle x:Name="BorderBackground" + IsHitTestVisible="False" + Fill="Transparent" + Opacity="1" + Control.IsTemplateFocusTarget="True" /> + <Rectangle x:Name="FocusBackground" + IsHitTestVisible="False" + Fill="Transparent" + Opacity="1" + Control.IsTemplateFocusTarget="True"/> + <Rectangle x:Name="SelectedPipe" + Opacity="0" + Width="4" + Height="24" + Fill="{ThemeResource SystemControlForegroundAccentBrush}" + VerticalAlignment="Center" + HorizontalAlignment="Left"/> + <ContentPresenter x:Name="ContentPresenter" + ContentTransitions="{TemplateBinding ContentTransitions}" + ContentTemplate="{TemplateBinding ContentTemplate}" + Content="{TemplateBinding Content}" + HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" + VerticalAlignment="{TemplateBinding VerticalContentAlignment}" + Margin="16,0,0,0" /> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <!-- Default style for Windows.UI.Xaml.Controls.ListBoxItem --> + <Style x:Key="ListBoxItemStyle" TargetType="ListBoxItem"> + <Setter Property="Background" Value="Transparent" /> + <Setter Property="TabNavigation" Value="Local" /> + <Setter Property="Padding" Value="8,10" /> + <Setter Property="HorizontalContentAlignment" Value="Left" /> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="ListBoxItem"> + <Border x:Name="LayoutRoot" + Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal" /> + <VisualState x:Name="PointerOver"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" + Storyboard.TargetProperty="Background"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ListBoxItemPointerOverBackgroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" + Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ListBoxItemPointerOverForegroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" + Storyboard.TargetProperty="Background"> + <DiscreteObjectKeyFrame KeyTime="0" Value="Transparent" /> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" + Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ListBoxItemDisabledForegroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Pressed"> + <Storyboard> + <DoubleAnimation Storyboard.TargetName="PressedBackground" + Storyboard.TargetProperty="Opacity" + To="1" + Duration="0" /> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" + Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ListBoxItemPressedForegroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + <VisualStateGroup x:Name="SelectionStates"> + <VisualState x:Name="Unselected" /> + <VisualState x:Name="Selected"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="InnerGrid" + Storyboard.TargetProperty="Background"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ListBoxItemSelectedBackgroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" + Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ListBoxItemSelectedForegroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="SelectedUnfocused"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="InnerGrid" + Storyboard.TargetProperty="Background"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ListBoxItemSelectedBackgroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" + Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ListBoxItemSelectedForegroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="SelectedDisabled"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="InnerGrid" + Storyboard.TargetProperty="Background"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ListBoxItemSelectedDisabledBackgroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" + Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ListBoxItemSelectedDisabledForegroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="SelectedPointerOver"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="InnerGrid" + Storyboard.TargetProperty="Background"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ListBoxItemSelectedPointerOverBackgroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" + Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ListBoxItemSelectedForegroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="SelectedPressed"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="InnerGrid" + Storyboard.TargetProperty="Background"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ListBoxItemSelectedBackgroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" + Storyboard.TargetProperty="Foreground"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource ListBoxItemSelectedForegroundThemeBrush}" /> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + <VisualStateGroup x:Name="FocusStates"> + <VisualState x:Name="Focused"> + <Storyboard> + <DoubleAnimation Storyboard.TargetName="FocusVisualWhite" + Storyboard.TargetProperty="Opacity" + To="1" + Duration="0" /> + <DoubleAnimation Storyboard.TargetName="FocusVisualBlack" + Storyboard.TargetProperty="Opacity" + To="1" + Duration="0" /> + </Storyboard> + </VisualState> + <VisualState x:Name="Unfocused" /> + <VisualState x:Name="PointerFocused" /> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <Grid x:Name="InnerGrid" + Background="Transparent"> + <Rectangle x:Name="PressedBackground" + Fill="{ThemeResource ListBoxItemPressedBackgroundThemeBrush}" + Opacity="0" /> + <ContentPresenter x:Name="ContentPresenter" + Content="{TemplateBinding Content}" + ContentTransitions="{TemplateBinding ContentTransitions}" + ContentTemplate="{TemplateBinding ContentTemplate}" + HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" + VerticalAlignment="{TemplateBinding VerticalContentAlignment}" + Margin="{TemplateBinding Padding}" /> + <Rectangle x:Name="FocusVisualWhite" + Stroke="{ThemeResource FocusVisualWhiteStrokeThemeBrush}" + StrokeEndLineCap="Square" + StrokeDashArray="1,1" + Opacity="0" + StrokeDashOffset=".5" /> + <Rectangle x:Name="FocusVisualBlack" + Stroke="{ThemeResource FocusVisualBlackStrokeThemeBrush}" + StrokeEndLineCap="Square" + StrokeDashArray="1,1" + Opacity="0" + StrokeDashOffset="1.5" /> + </Grid> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style x:Key="ScenarioListBoxStyle" TargetType="ListBox"> + <Setter Property="Foreground" Value="{ThemeResource ListBoxForegroundThemeBrush}"/> + <Setter Property="Background" Value="Transparent"/> + <Setter Property="BorderBrush" Value="Transparent"/> + <Setter Property="BorderThickness" Value="{ThemeResource ListBoxBorderThemeThickness}"/> + <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/> + <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/> + <Setter Property="ScrollViewer.HorizontalScrollMode" Value="Disabled"/> + <Setter Property="ScrollViewer.IsHorizontalRailEnabled" Value="True"/> + <Setter Property="ScrollViewer.VerticalScrollMode" Value="Enabled"/> + <Setter Property="ScrollViewer.IsVerticalRailEnabled" Value="True"/> + <Setter Property="ScrollViewer.ZoomMode" Value="Disabled"/> + <Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False"/> + <Setter Property="ScrollViewer.BringIntoViewOnFocusChange" Value="True"/> + <Setter Property="IsTabStop" Value="False"/> + <Setter Property="TabNavigation" Value="Once"/> + <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/> + <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/> + <Setter Property="ItemsPanel"> + <Setter.Value> + <ItemsPanelTemplate> + <VirtualizingStackPanel Background="Transparent"/> + </ItemsPanelTemplate> + </Setter.Value> + </Setter> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="ListBox"> + <Border x:Name="LayoutRoot" BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" Background="Transparent"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"/> + <VisualState x:Name="Disabled"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="LayoutRoot"> + <DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + <VisualStateGroup x:Name="FocusStates"> + <VisualState x:Name="Focused"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="LayoutRoot"> + <DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Unfocused"/> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <ScrollViewer x:Name="ScrollViewer" AutomationProperties.AccessibilityView="Raw" BringIntoViewOnFocusChange="{TemplateBinding ScrollViewer.BringIntoViewOnFocusChange}" HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}" IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}" IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}" Padding="{TemplateBinding Padding}" TabNavigation="{TemplateBinding TabNavigation}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}" ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}"> + <ItemsPresenter/> + </ScrollViewer> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + +</ResourceDictionary> |
