From 1709b21276c11b8d4726d458b258b9b4e42e4be3 Mon Sep 17 00:00:00 2001 From: Raymond Chen Date: Wed, 20 Jan 2016 12:30:12 -0800 Subject: [PATCH] Windows 10 RTM Release - January 2016 Update --- README.md | 12 +- Samples/Advertising/README.md | 65 +++++ Samples/Advertising/cpp/Advertising.sln | 40 +++ Samples/Advertising/cpp/Advertising.vcxproj | 228 +++++++++++++++++ .../cpp/Advertising.vcxproj.filters | 68 +++++ Samples/Advertising/cpp/Package.appxmanifest | 42 +++ .../Advertising/cpp/SampleConfiguration.cpp | 23 ++ Samples/Advertising/cpp/SampleConfiguration.h | 47 ++++ .../cpp/Scenario1_XamlAdControl.xaml.cpp | 39 +++ .../cpp/Scenario1_XamlAdControl.xaml.h | 33 +++ .../Scenario2_ProgramaticAdControl.xaml.cpp | 67 +++++ .../cpp/Scenario2_ProgramaticAdControl.xaml.h | 33 +++ .../cpp/Scenario3_InterstitialAd.xaml.cpp | 70 +++++ .../cpp/Scenario3_InterstitialAd.xaml.h | 35 +++ Samples/Advertising/cpp/pch.cpp | 5 + Samples/Advertising/cpp/pch.h | 10 + Samples/Advertising/cs/Advertising.csproj | 198 ++++++++++++++ Samples/Advertising/cs/Advertising.sln | 40 +++ Samples/Advertising/cs/Package.appxmanifest | 42 +++ Samples/Advertising/cs/SampleConfiguration.cs | 35 +++ .../cs/Scenario1_XamlAdControl.xaml.cs | 42 +++ .../cs/Scenario2_ProgramaticAdControl.xaml.cs | 69 +++++ .../cs/Scenario3_InterstitialAd.xaml.cs | 72 ++++++ Samples/Advertising/cs/project.json | 16 ++ Samples/Advertising/js/Advertising.jsproj | 147 +++++++++++ Samples/Advertising/js/Advertising.sln | 48 ++++ .../Microsoft.WinJS.4.0/css/placeholder.txt | 0 .../Microsoft.WinJS.4.0/fonts/placeholder.txt | 0 .../js/en-US/placeholder.txt | 0 Samples/Advertising/js/css/placeholder.txt | 0 Samples/Advertising/js/html/scenario1.html | 29 +++ Samples/Advertising/js/html/scenario2.html | 26 ++ Samples/Advertising/js/html/scenario3.html | 24 ++ Samples/Advertising/js/images/windows-sdk.png | Bin 0 -> 2997 bytes .../Advertising/js/js/sample-configuration.js | 18 ++ Samples/Advertising/js/js/scenario1.js | 26 ++ Samples/Advertising/js/js/scenario2.js | 44 ++++ Samples/Advertising/js/js/scenario3.js | 54 ++++ Samples/Advertising/js/package.appxmanifest | 42 +++ .../js/sample-utils/placeholder.txt | 0 .../shared/Scenario1_XamlAdControl.xaml | 39 +++ .../Scenario2_ProgramaticAdControl.xaml | 28 ++ .../shared/Scenario3_InterstitialAd.xaml | 28 ++ .../cs/Scenario1_PreviewSettings.xaml.cs | 2 +- Samples/Nfc/Nfc/CardReader.xaml.cs | 175 +++++++------ Samples/Store/README.md | 4 + ...LOutOfProcessWinRTComponent_server.vcxproj | 2 +- .../cpp/cpp/Package.appxmanifest | 7 +- .../cpp/Scenario4_CustomExceptionWRL.xaml.cpp | 2 +- .../cpp/cs/Package.appxmanifest | 7 +- ...utOfProcessWinRTComponent_client_cs.csproj | 8 +- Samples/XamlListView/README.md | 1 + Samples/XamlListView/cs/ListView.csproj | 7 + .../ScrollIntoViewSample.xaml | 85 ++++++ .../ScrollIntoViewSample.xaml.cs | 43 ++++ Samples/XamlListView/cs/SamplesPane.xaml | 5 + Samples/XamlListView/cs/SamplesPane.xaml.cs | 5 + Samples/XamlWebView/README.md | 96 +++++++ Samples/XamlWebView/cs/Package.appxmanifest | 42 +++ Samples/XamlWebView/cs/SampleConfiguration.cs | 51 ++++ .../cs/Scenario10_UnviewableContent.xaml | 42 +++ .../cs/Scenario10_UnviewableContent.xaml.cs | 56 ++++ .../XamlWebView/cs/Scenario1_NavToUrl.xaml | 61 +++++ .../XamlWebView/cs/Scenario1_NavToUrl.xaml.cs | 199 +++++++++++++++ .../XamlWebView/cs/Scenario2_NavToString.xaml | 53 ++++ .../cs/Scenario2_NavToString.xaml.cs | 41 +++ .../cs/Scenario3_InvokeScript.xaml | 58 +++++ .../cs/Scenario3_InvokeScript.xaml.cs | 70 +++++ .../cs/Scenario4_ScriptNotify.xaml | 48 ++++ .../cs/Scenario4_ScriptNotify.xaml.cs | 53 ++++ .../XamlWebView/cs/Scenario5_NavToFiles.xaml | 47 ++++ .../cs/Scenario5_NavToFiles.xaml.cs | 61 +++++ .../XamlWebView/cs/Scenario6_NavToStream.xaml | 39 +++ .../cs/Scenario6_NavToStream.xaml.cs | 107 ++++++++ Samples/XamlWebView/cs/Scenario7_Share.xaml | 44 ++++ .../XamlWebView/cs/Scenario7_Share.xaml.cs | 124 +++++++++ .../cs/Scenario8_CaptureBitmap.xaml | 41 +++ .../cs/Scenario8_CaptureBitmap.xaml.cs | 89 +++++++ .../Scenario9_ContainsFullScreenElement.xaml | 42 +++ ...cenario9_ContainsFullScreenElement.xaml.cs | 51 ++++ Samples/XamlWebView/cs/XamlWebView.csproj | 241 ++++++++++++++++++ Samples/XamlWebView/cs/XamlWebView.sln | 40 +++ Samples/XamlWebView/cs/html/html_example.html | 9 + .../XamlWebView/cs/html/html_example2.html | 16 ++ .../cs/html/scriptNotify_example.html | 9 + .../XamlWebView/cs/html/script_example.html | 14 + .../XamlWebView/cs/html/stream_example.html | 14 + Samples/XamlWebView/cs/project.json | 16 ++ 88 files changed, 4003 insertions(+), 108 deletions(-) create mode 100644 Samples/Advertising/README.md create mode 100644 Samples/Advertising/cpp/Advertising.sln create mode 100644 Samples/Advertising/cpp/Advertising.vcxproj create mode 100644 Samples/Advertising/cpp/Advertising.vcxproj.filters create mode 100644 Samples/Advertising/cpp/Package.appxmanifest create mode 100644 Samples/Advertising/cpp/SampleConfiguration.cpp create mode 100644 Samples/Advertising/cpp/SampleConfiguration.h create mode 100644 Samples/Advertising/cpp/Scenario1_XamlAdControl.xaml.cpp create mode 100644 Samples/Advertising/cpp/Scenario1_XamlAdControl.xaml.h create mode 100644 Samples/Advertising/cpp/Scenario2_ProgramaticAdControl.xaml.cpp create mode 100644 Samples/Advertising/cpp/Scenario2_ProgramaticAdControl.xaml.h create mode 100644 Samples/Advertising/cpp/Scenario3_InterstitialAd.xaml.cpp create mode 100644 Samples/Advertising/cpp/Scenario3_InterstitialAd.xaml.h create mode 100644 Samples/Advertising/cpp/pch.cpp create mode 100644 Samples/Advertising/cpp/pch.h create mode 100644 Samples/Advertising/cs/Advertising.csproj create mode 100644 Samples/Advertising/cs/Advertising.sln create mode 100644 Samples/Advertising/cs/Package.appxmanifest create mode 100644 Samples/Advertising/cs/SampleConfiguration.cs create mode 100644 Samples/Advertising/cs/Scenario1_XamlAdControl.xaml.cs create mode 100644 Samples/Advertising/cs/Scenario2_ProgramaticAdControl.xaml.cs create mode 100644 Samples/Advertising/cs/Scenario3_InterstitialAd.xaml.cs create mode 100644 Samples/Advertising/cs/project.json create mode 100644 Samples/Advertising/js/Advertising.jsproj create mode 100644 Samples/Advertising/js/Advertising.sln create mode 100644 Samples/Advertising/js/Microsoft.WinJS.4.0/css/placeholder.txt create mode 100644 Samples/Advertising/js/Microsoft.WinJS.4.0/fonts/placeholder.txt create mode 100644 Samples/Advertising/js/Microsoft.WinJS.4.0/js/en-US/placeholder.txt create mode 100644 Samples/Advertising/js/css/placeholder.txt create mode 100644 Samples/Advertising/js/html/scenario1.html create mode 100644 Samples/Advertising/js/html/scenario2.html create mode 100644 Samples/Advertising/js/html/scenario3.html create mode 100644 Samples/Advertising/js/images/windows-sdk.png create mode 100644 Samples/Advertising/js/js/sample-configuration.js create mode 100644 Samples/Advertising/js/js/scenario1.js create mode 100644 Samples/Advertising/js/js/scenario2.js create mode 100644 Samples/Advertising/js/js/scenario3.js create mode 100644 Samples/Advertising/js/package.appxmanifest create mode 100644 Samples/Advertising/js/sample-utils/placeholder.txt create mode 100644 Samples/Advertising/shared/Scenario1_XamlAdControl.xaml create mode 100644 Samples/Advertising/shared/Scenario2_ProgramaticAdControl.xaml create mode 100644 Samples/Advertising/shared/Scenario3_InterstitialAd.xaml create mode 100644 Samples/XamlListView/cs/Samples/ScrollIntoViewSample/ScrollIntoViewSample.xaml create mode 100644 Samples/XamlListView/cs/Samples/ScrollIntoViewSample/ScrollIntoViewSample.xaml.cs create mode 100644 Samples/XamlWebView/README.md create mode 100644 Samples/XamlWebView/cs/Package.appxmanifest create mode 100644 Samples/XamlWebView/cs/SampleConfiguration.cs create mode 100644 Samples/XamlWebView/cs/Scenario10_UnviewableContent.xaml create mode 100644 Samples/XamlWebView/cs/Scenario10_UnviewableContent.xaml.cs create mode 100644 Samples/XamlWebView/cs/Scenario1_NavToUrl.xaml create mode 100644 Samples/XamlWebView/cs/Scenario1_NavToUrl.xaml.cs create mode 100644 Samples/XamlWebView/cs/Scenario2_NavToString.xaml create mode 100644 Samples/XamlWebView/cs/Scenario2_NavToString.xaml.cs create mode 100644 Samples/XamlWebView/cs/Scenario3_InvokeScript.xaml create mode 100644 Samples/XamlWebView/cs/Scenario3_InvokeScript.xaml.cs create mode 100644 Samples/XamlWebView/cs/Scenario4_ScriptNotify.xaml create mode 100644 Samples/XamlWebView/cs/Scenario4_ScriptNotify.xaml.cs create mode 100644 Samples/XamlWebView/cs/Scenario5_NavToFiles.xaml create mode 100644 Samples/XamlWebView/cs/Scenario5_NavToFiles.xaml.cs create mode 100644 Samples/XamlWebView/cs/Scenario6_NavToStream.xaml create mode 100644 Samples/XamlWebView/cs/Scenario6_NavToStream.xaml.cs create mode 100644 Samples/XamlWebView/cs/Scenario7_Share.xaml create mode 100644 Samples/XamlWebView/cs/Scenario7_Share.xaml.cs create mode 100644 Samples/XamlWebView/cs/Scenario8_CaptureBitmap.xaml create mode 100644 Samples/XamlWebView/cs/Scenario8_CaptureBitmap.xaml.cs create mode 100644 Samples/XamlWebView/cs/Scenario9_ContainsFullScreenElement.xaml create mode 100644 Samples/XamlWebView/cs/Scenario9_ContainsFullScreenElement.xaml.cs create mode 100644 Samples/XamlWebView/cs/XamlWebView.csproj create mode 100644 Samples/XamlWebView/cs/XamlWebView.sln create mode 100644 Samples/XamlWebView/cs/html/html_example.html create mode 100644 Samples/XamlWebView/cs/html/html_example2.html create mode 100644 Samples/XamlWebView/cs/html/scriptNotify_example.html create mode 100644 Samples/XamlWebView/cs/html/script_example.html create mode 100644 Samples/XamlWebView/cs/html/stream_example.html create mode 100644 Samples/XamlWebView/cs/project.json diff --git a/README.md b/README.md index 99b97ccba9..9222bd0578 100644 --- a/README.md +++ b/README.md @@ -189,6 +189,7 @@ For additional Windows samples, see [Windows on GitHub](http://microsoft.github. WebView control (HTML) + WebView control (XAML) Window resizing @@ -445,31 +446,32 @@ For additional Windows samples, see [Windows on GitHub](http://microsoft.github. Networking and web services + Advertising Background transfer DatagramSocket - Exchange Active Sync (EAS) + Exchange Active Sync (EAS) HttpClient JSON - Mobile broadband + Mobile broadband Radios RSS reader end-to-end (JavaScript) - Socket activity trigger stream socket + Socket activity trigger stream socket StreamSocket Syndication - USSD protocol + USSD protocol WebSocket Wi-Fi Direct - Wi-Fi Direct services + Wi-Fi Direct services Wi-Fi scanning diff --git a/Samples/Advertising/README.md b/Samples/Advertising/README.md new file mode 100644 index 0000000000..a9351ff2f5 --- /dev/null +++ b/Samples/Advertising/README.md @@ -0,0 +1,65 @@ + + +# Advertising sample + +This sample shows how to use the Microsoft Advertising SDK (Microsoft.Advertising) to show display ads and interstitial ads using the following methods: +- Creating an ad control to show display ads using only XAML / HTML markup +- Creating an ad control to show display ads programatically +- Creating an ad control to show interstitial video ads programatically + +## Prerequisites + +This sample requires the [Microsoft Advertising SDK Libraries for XAML or JavaScript](http://go.microsoft.com/fwlink/?LinkID=619694). +[Download it here](http://go.microsoft.com/fwlink/p/?LinkId=518026). +It also requires the [internet client capability](https://msdn.microsoft.com/library/windows/apps/mt270968#general-use_capabilities) to be added to the manifest. + +When you incorporate this sample into your own app, +obtain your own ApplicationId and AdUnitId from the Dev Center. +See [Monetize with Ads](https://msdn.microsoft.com/en-us/library/windows/apps/mt170658.aspx) on MSDN +for more details. + +## Related topics + +### Samples + +[Store in-app purchase](/Samples/Store) + +## Reference + +[Microsoft Advertising Client SDK API Reference](https://msdn.microsoft.com/en-US/library/mt313151(v=msads.30).aspx) + +### See also + +[Getting Started](https://msdn.microsoft.com/en-US/library/mt313197(v=msads.30).aspx) + +[Developer Walkthroughs](https://msdn.microsoft.com/en-US/library/mt313121(v=msads.30).aspx) + +[Interstitial Ads](https://msdn.microsoft.com/en-US/library/mt313191(v=msads.30).aspx) + +## System requirements + +**Client:** Windows 10 + +**Phone:** Windows 10 + +## Build the sample + +1. If you download the samples ZIP, be sure to unzip the entire archive, not just the folder with the sample you want to build. +2. Start Microsoft Visual Studio 2015 and select **File** \> **Open** \> **Project/Solution**. +3. Starting in the folder where you unzipped the samples, go to the Samples subfolder, then the subfolder for this specific sample, then the subfolder for your preferred language (C++, C#, or JavaScript). Double-click the Visual Studio�2015 Solution (.sln) file. +4. Press Ctrl+Shift+B, or select **Build** \> **Build Solution**. + +## Run the sample + +The next steps depend on whether you just want to deploy the sample or you want to both deploy and run it. + +### Deploying the sample + +- Select Build > Deploy Solution. + +### Deploying and running the sample + +- To debug the sample and then run it, press F5 or select Debug > Start Debugging. To run the sample without debugging, press Ctrl+F5 or selectDebug > Start Without Debugging. diff --git a/Samples/Advertising/cpp/Advertising.sln b/Samples/Advertising/cpp/Advertising.sln new file mode 100644 index 0000000000..4d5282297c --- /dev/null +++ b/Samples/Advertising/cpp/Advertising.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Advertising", "Advertising.vcxproj", "{F710B9FD-4E6B-42D7-A99A-6D48888D48B0}" +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 + {F710B9FD-4E6B-42D7-A99A-6D48888D48B0}.Debug|ARM.ActiveCfg = Debug|ARM + {F710B9FD-4E6B-42D7-A99A-6D48888D48B0}.Debug|ARM.Build.0 = Debug|ARM + {F710B9FD-4E6B-42D7-A99A-6D48888D48B0}.Debug|ARM.Deploy.0 = Debug|ARM + {F710B9FD-4E6B-42D7-A99A-6D48888D48B0}.Debug|x64.ActiveCfg = Debug|x64 + {F710B9FD-4E6B-42D7-A99A-6D48888D48B0}.Debug|x64.Build.0 = Debug|x64 + {F710B9FD-4E6B-42D7-A99A-6D48888D48B0}.Debug|x64.Deploy.0 = Debug|x64 + {F710B9FD-4E6B-42D7-A99A-6D48888D48B0}.Debug|x86.ActiveCfg = Debug|Win32 + {F710B9FD-4E6B-42D7-A99A-6D48888D48B0}.Debug|x86.Build.0 = Debug|Win32 + {F710B9FD-4E6B-42D7-A99A-6D48888D48B0}.Debug|x86.Deploy.0 = Debug|Win32 + {F710B9FD-4E6B-42D7-A99A-6D48888D48B0}.Release|ARM.ActiveCfg = Release|ARM + {F710B9FD-4E6B-42D7-A99A-6D48888D48B0}.Release|ARM.Build.0 = Release|ARM + {F710B9FD-4E6B-42D7-A99A-6D48888D48B0}.Release|ARM.Deploy.0 = Release|ARM + {F710B9FD-4E6B-42D7-A99A-6D48888D48B0}.Release|x64.ActiveCfg = Release|x64 + {F710B9FD-4E6B-42D7-A99A-6D48888D48B0}.Release|x64.Build.0 = Release|x64 + {F710B9FD-4E6B-42D7-A99A-6D48888D48B0}.Release|x64.Deploy.0 = Release|x64 + {F710B9FD-4E6B-42D7-A99A-6D48888D48B0}.Release|x86.ActiveCfg = Release|Win32 + {F710B9FD-4E6B-42D7-A99A-6D48888D48B0}.Release|x86.Build.0 = Release|Win32 + {F710B9FD-4E6B-42D7-A99A-6D48888D48B0}.Release|x86.Deploy.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Samples/Advertising/cpp/Advertising.vcxproj b/Samples/Advertising/cpp/Advertising.vcxproj new file mode 100644 index 0000000000..bc2ff05df2 --- /dev/null +++ b/Samples/Advertising/cpp/Advertising.vcxproj @@ -0,0 +1,228 @@ + + + + {f710b9fd-4e6b-42d7-a99a-6d48888d48b0} + SDKTemplate + en-US + 14.0 + true + Windows Store + 10.0 + 10.0.10240.0 + 10.0.10240.0 + + + + + Debug + ARM + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + Win32 + + + Release + x64 + + + + Application + true + v140 + + + Application + true + v140 + + + Application + true + v140 + + + Application + false + true + v140 + + + Application + false + true + v140 + + + Application + false + true + v140 + + + + + + + + + + + + + + + + + + + + + + + + + $(VC_IncludePath);$(UniversalCRT_IncludePath);$(WindowsSDK_IncludePath);..\..\..\SharedContent\cpp + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + /bigobj %(AdditionalOptions) + 4453;28204 + + + + + + ..\..\..\SharedContent\xaml\App.xaml + + + ..\..\..\SharedContent\cpp\MainPage.xaml + + + + ..\shared\Scenario1_XamlAdControl.xaml + + + ..\shared\Scenario2_ProgramaticAdControl.xaml + + + ..\shared\Scenario3_InterstitialAd.xaml + + + + + Designer + + + Designer + + + + + + Styles\Styles.xaml + + + + + Designer + + + + + ..\..\..\SharedContent\xaml\App.xaml + + + ..\..\..\SharedContent\cpp\MainPage.xaml + + + Create + Create + Create + Create + Create + Create + + + + ..\shared\Scenario1_XamlAdControl.xaml + + + ..\shared\Scenario2_ProgramaticAdControl.xaml + + + ..\shared\Scenario3_InterstitialAd.xaml + + + + + Assets\microsoft-sdk.png + + + Assets\smalltile-sdk.png + + + Assets\splash-sdk.png + + + Assets\squaretile-sdk.png + + + Assets\storelogo-sdk.png + + + Assets\tile-sdk.png + + + Assets\windows-sdk.png + + + + + + + + + \ No newline at end of file diff --git a/Samples/Advertising/cpp/Advertising.vcxproj.filters b/Samples/Advertising/cpp/Advertising.vcxproj.filters new file mode 100644 index 0000000000..2e538e7b56 --- /dev/null +++ b/Samples/Advertising/cpp/Advertising.vcxproj.filters @@ -0,0 +1,68 @@ + + + + + 80bfd669-aa83-4537-9611-027cffe0d8af + bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png + + + {c6978fb6-bc64-498d-97c8-f5b53997e54e} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Styles + + + + + + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + \ No newline at end of file diff --git a/Samples/Advertising/cpp/Package.appxmanifest b/Samples/Advertising/cpp/Package.appxmanifest new file mode 100644 index 0000000000..452cff1453 --- /dev/null +++ b/Samples/Advertising/cpp/Package.appxmanifest @@ -0,0 +1,42 @@ + + + + + + Advertising C++ Sample + Microsoft Corporation + Assets\StoreLogo-sdk.png + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Samples/Advertising/cpp/SampleConfiguration.cpp b/Samples/Advertising/cpp/SampleConfiguration.cpp new file mode 100644 index 0000000000..f846ea3f4f --- /dev/null +++ b/Samples/Advertising/cpp/SampleConfiguration.cpp @@ -0,0 +1,23 @@ +//********************************************************* +// +// 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^ MainPage::scenariosInner = ref new Platform::Array +{ + { "Create an ad control in markup", "SDKTemplate.Scenario1_XamlAdControl" }, + { "Create an ad control programatically", "SDKTemplate.Scenario2_ProgramaticAdControl" }, + { "Show an interstitial video ad", "SDKTemplate.Scenario3_InterstitialAd" } +}; diff --git a/Samples/Advertising/cpp/SampleConfiguration.h b/Samples/Advertising/cpp/SampleConfiguration.h new file mode 100644 index 0000000000..aec3c3d870 --- /dev/null +++ b/Samples/Advertising/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 "Advertising C++ sample"; + } + } + + static property Platform::Array^ scenarios + { + Platform::Array^ get() + { + return scenariosInner; + } + } + + private: + static Platform::Array^ scenariosInner; + }; + + public value struct Scenario + { + Platform::String^ Title; + Platform::String^ ClassName; + }; +} diff --git a/Samples/Advertising/cpp/Scenario1_XamlAdControl.xaml.cpp b/Samples/Advertising/cpp/Scenario1_XamlAdControl.xaml.cpp new file mode 100644 index 0000000000..49691b25eb --- /dev/null +++ b/Samples/Advertising/cpp/Scenario1_XamlAdControl.xaml.cpp @@ -0,0 +1,39 @@ +//********************************************************* +// +// 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_XamlAdControl.xaml.h" + +using namespace SDKTemplate; + +using namespace Microsoft::Advertising::WinRT::UI; +using namespace Platform; +using namespace Windows::Foundation; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; + +Scenario1_XamlAdControl::Scenario1_XamlAdControl() +{ + InitializeComponent(); +} + +// This is an error handler for the ad control. +void Scenario1_XamlAdControl::OnErrorOccurred(Object^ sender, AdErrorEventArgs^ e) +{ + rootPage->NotifyUser("An error occurred. " + e->ErrorCode.ToString() + ": " + e->ErrorMessage, NotifyType::ErrorMessage); +} + +// This is an event handler for the ad control. It's invoked when the ad is refreshed. +void Scenario1_XamlAdControl::OnAdRefreshed(Object^ sender, RoutedEventArgs^ e) +{ + // We increment the ad count so that the message changes at every refresh. + adCount++; + rootPage->NotifyUser("Advertisement #" + adCount.ToString(), NotifyType::StatusMessage); +} \ No newline at end of file diff --git a/Samples/Advertising/cpp/Scenario1_XamlAdControl.xaml.h b/Samples/Advertising/cpp/Scenario1_XamlAdControl.xaml.h new file mode 100644 index 0000000000..c861cb04a0 --- /dev/null +++ b/Samples/Advertising/cpp/Scenario1_XamlAdControl.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 "Scenario1_XamlAdControl.g.h" +#include "MainPage.xaml.h" + +namespace SDKTemplate +{ + [Windows::Foundation::Metadata::WebHostHidden] + public ref class Scenario1_XamlAdControl sealed + { + public: + Scenario1_XamlAdControl(); + + private: + MainPage^ rootPage = MainPage::Current; + int adCount = 0; + + void OnErrorOccurred(Platform::Object^ sender, Microsoft::Advertising::WinRT::UI::AdErrorEventArgs^ args); + void OnAdRefreshed(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ args); + + } +} diff --git a/Samples/Advertising/cpp/Scenario2_ProgramaticAdControl.xaml.cpp b/Samples/Advertising/cpp/Scenario2_ProgramaticAdControl.xaml.cpp new file mode 100644 index 0000000000..ab3fa725a6 --- /dev/null +++ b/Samples/Advertising/cpp/Scenario2_ProgramaticAdControl.xaml.cpp @@ -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. +// +//********************************************************* + +#include "pch.h" +#include "Scenario2_ProgramaticAdControl.xaml.h" + +using namespace SDKTemplate; + +using namespace Microsoft::Advertising::WinRT::UI; +using namespace Platform; +using namespace Windows::Foundation; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; + +Scenario2_ProgramaticAdControl::Scenario2_ProgramaticAdControl() +{ + InitializeComponent(); +} + +void Scenario2_ProgramaticAdControl::CreateAdControl_Click(Object^ sender, RoutedEventArgs^ e) +{ + auto button = safe_cast(sender); + button->IsEnabled = false; + + // Programatically create an ad control. This must be done from the UI thread. + auto adControl = ref new AdControl(); + + // Set the application id and ad unit id + // The application id and ad unit id can be obtained from Dev Center. + // See "Monetize with Ads" at https ://msdn.microsoft.com/en-us/library/windows/apps/mt170658.aspx + adControl->ApplicationId = L"d25517cb-12d4-4699-8bdc-52040c712cab"; + adControl->AdUnitId = L"10043134"; + + // Set the dimensions + adControl->Width = 160; + adControl->Height = 600; + + // Add event handlers if you want + adControl->ErrorOccurred += ref new EventHandler(this, &Scenario2_ProgramaticAdControl::OnErrorOccurred); + adControl->AdRefreshed += ref new EventHandler(this, &Scenario2_ProgramaticAdControl::OnAdRefreshed); + + // Add the ad control to the page + auto parent = safe_cast(button->Parent); + parent->Children->Append(adControl); +} + +// This is an error handler for the ad control. +void Scenario2_ProgramaticAdControl::OnErrorOccurred(Object^ sender, AdErrorEventArgs^ e) +{ + rootPage->NotifyUser("An error occurred. " + e->ErrorCode.ToString() + ": " + e->ErrorMessage, NotifyType::ErrorMessage); +} + +// This is an event handler for the ad control. It's invoked when the ad is refreshed. +void Scenario2_ProgramaticAdControl::OnAdRefreshed(Object^ sender, RoutedEventArgs^ e) +{ + // We increment the ad count so that the message changes at every refresh. + adCount++; + rootPage->NotifyUser("Advertisement #" + adCount.ToString(), NotifyType::StatusMessage); +} diff --git a/Samples/Advertising/cpp/Scenario2_ProgramaticAdControl.xaml.h b/Samples/Advertising/cpp/Scenario2_ProgramaticAdControl.xaml.h new file mode 100644 index 0000000000..86f695bcdc --- /dev/null +++ b/Samples/Advertising/cpp/Scenario2_ProgramaticAdControl.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 "Scenario2_ProgramaticAdControl.g.h" +#include "MainPage.xaml.h" + +namespace SDKTemplate +{ + [Windows::Foundation::Metadata::WebHostHidden] + public ref class Scenario2_ProgramaticAdControl sealed + { + public: + Scenario2_ProgramaticAdControl(); + + private: + MainPage^ rootPage = MainPage::Current; + int adCount = 0; + + void CreateAdControl_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void OnErrorOccurred(Platform::Object^ sender, Microsoft::Advertising::WinRT::UI::AdErrorEventArgs^ e); + void OnAdRefreshed(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + }; +} diff --git a/Samples/Advertising/cpp/Scenario3_InterstitialAd.xaml.cpp b/Samples/Advertising/cpp/Scenario3_InterstitialAd.xaml.cpp new file mode 100644 index 0000000000..7c9324c44e --- /dev/null +++ b/Samples/Advertising/cpp/Scenario3_InterstitialAd.xaml.cpp @@ -0,0 +1,70 @@ +//********************************************************* +// +// 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 "Scenario3_InterstitialAd.xaml.h" + +using namespace SDKTemplate; + +using namespace Microsoft::Advertising::WinRT::UI; +using namespace Platform; +using namespace Windows::Foundation; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; + +Scenario3_InterstitialAd::Scenario3_InterstitialAd() : rootPage(MainPage::Current) +{ + InitializeComponent(); + + // Instantiate the interstitial ad + interstitialAd = ref new InterstitialAd(); + + // Attach event handlers + interstitialAd->ErrorOccurred += ref new EventHandler(this, &Scenario3_InterstitialAd::OnErrorOccurred); + interstitialAd->AdReady += ref new EventHandler(this, &Scenario3_InterstitialAd::OnAdReady); + interstitialAd->Cancelled += ref new EventHandler(this, &Scenario3_InterstitialAd::OnAdCancelled); + interstitialAd->Completed += ref new EventHandler(this, &Scenario3_InterstitialAd::OnAdCompleted); +} + +void Scenario3_InterstitialAd::RunInterstitialAd(Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e) +{ + // Request an ad. When the ad is ready to show, the AdReady event will fire. + // The application id and ad unit are passed in here. + // The application id and ad unit id can be obtained from Dev Center. + // See "Monetize with Ads" at https://msdn.microsoft.com/en-us/library/windows/apps/mt170658.aspx + interstitialAd->RequestAd(AdType::Video, L"d25517cb-12d4-4699-8bdc-52040c712cab", L"11389925"); + rootPage->NotifyUser("Ad requested", NotifyType::StatusMessage); +} + +// This is an event handler for the interstitial ad. It is triggered when the interstitial ad information has been downloaded and is ready to show. +void Scenario3_InterstitialAd::OnAdReady(Object^ sender, Object^ e) +{ + // The ad is ready to show; show it. + interstitialAd->Show(); +} + +// This is an event handler for the interstitial ad. It is triggered when the interstitial ad is cancelled. +void Scenario3_InterstitialAd::OnAdCancelled(Object^ sender, Object^ e) +{ + rootPage->NotifyUser("Ad cancelled", NotifyType::StatusMessage); +} + +// This is an event handler for the interstitial ad. It is triggered when the interstitial ad has completed playback. +void Scenario3_InterstitialAd::OnAdCompleted(Object^ sender, Object^ e) +{ + rootPage->NotifyUser("Ad completed", NotifyType::StatusMessage); +} + +// This is an error handler for the interstitial ad. +void Scenario3_InterstitialAd::OnErrorOccurred(Object^ sender, AdErrorEventArgs^ e) +{ + rootPage->NotifyUser("An error occurred. " + e->ErrorCode.ToString() + ": " + e->ErrorMessage, NotifyType::ErrorMessage); +} \ No newline at end of file diff --git a/Samples/Advertising/cpp/Scenario3_InterstitialAd.xaml.h b/Samples/Advertising/cpp/Scenario3_InterstitialAd.xaml.h new file mode 100644 index 0000000000..0535ad6758 --- /dev/null +++ b/Samples/Advertising/cpp/Scenario3_InterstitialAd.xaml.h @@ -0,0 +1,35 @@ +//********************************************************* +// +// 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 "Scenario3_InterstitialAd.g.h" +#include "MainPage.xaml.h" + +namespace SDKTemplate +{ + [Windows::Foundation::Metadata::WebHostHidden] + public ref class Scenario3_InterstitialAd sealed + { + public: + Scenario3_InterstitialAd(); + + private: + MainPage^ rootPage = MainPage::Current; + Microsoft::Advertising::WinRT::UI::InterstitialAd^ interstitialAd; + + void RunInterstitialAd(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); + void OnAdReady(Platform::Object^ sender, Platform::Object^ args); + void OnAdCancelled(Platform::Object^ sender, Platform::Object^ args); + void OnAdCompleted(Platform::Object^ sender, Platform::Object^ args); + void OnErrorOccurred(Platform::Object^ sender, Microsoft::Advertising::WinRT::UI::AdErrorEventArgs^ args); + }; +} diff --git a/Samples/Advertising/cpp/pch.cpp b/Samples/Advertising/cpp/pch.cpp new file mode 100644 index 0000000000..ade821753a --- /dev/null +++ b/Samples/Advertising/cpp/pch.cpp @@ -0,0 +1,5 @@ +// +// Include the standard header and generate the precompiled header. +// + +#include "pch.h" diff --git a/Samples/Advertising/cpp/pch.h b/Samples/Advertising/cpp/pch.h new file mode 100644 index 0000000000..1dcc72eba4 --- /dev/null +++ b/Samples/Advertising/cpp/pch.h @@ -0,0 +1,10 @@ +// +// Header for standard system include files. +// + +#pragma once + +#include +#include + +#include "App.xaml.h" diff --git a/Samples/Advertising/cs/Advertising.csproj b/Samples/Advertising/cs/Advertising.csproj new file mode 100644 index 0000000000..c379520f2b --- /dev/null +++ b/Samples/Advertising/cs/Advertising.csproj @@ -0,0 +1,198 @@ + + + + + Debug + x86 + {DC30CE66-DAEE-4CCF-BD02-8837FE918B6F} + AppContainerExe + Properties + SDKTemplate + Advertising + en-US + UAP + 10.0.10240.0 + 10.0.10240.0 + 14 + true + 512 + {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + true + bin\ARM\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + ARM + false + prompt + true + + + bin\ARM\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + ARM + false + prompt + true + true + + + true + bin\x64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + x64 + false + prompt + true + + + bin\x64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + x64 + false + prompt + true + true + + + true + bin\x86\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + x86 + false + prompt + true + + + bin\x86\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + x86 + false + prompt + true + true + + + + + + + App.xaml.cs + App.xaml + + + MainPage.xaml.cs + MainPage.xaml + + + Properties\AssemblyInfo.cs + + + + Scenario1_XamlAdControl.xaml + + + Scenario2_ProgramaticAdControl.xaml + + + Scenario3_InterstitialAd.xaml + + + + + Designer + + + + + App.xaml + MSBuild:Compile + Designer + + + MainPage.xaml + MSBuild:Compile + Designer + + + Scenario1_XamlAdControl.xaml + MSBuild:Compile + Designer + + + Scenario2_ProgramaticAdControl.xaml + MSBuild:Compile + Designer + + + Scenario3_InterstitialAd.xaml + MSBuild:Compile + Designer + + + Styles\Styles.xaml + MSBuild:Compile + Designer + + + + + Properties\Default.rd.xml + + + Assets\microsoft-sdk.png + + + Assets\smallTile-sdk.png + + + Assets\splash-sdk.png + + + Assets\squareTile-sdk.png + + + Assets\storeLogo-sdk.png + + + Assets\tile-sdk.png + + + Assets\windows-sdk.png + + + + + Microsoft Advertising SDK for XAML + + + Visual C++ 2015 Runtime for Universal Windows Platform Apps + + + + 14.0 + + + + \ No newline at end of file diff --git a/Samples/Advertising/cs/Advertising.sln b/Samples/Advertising/cs/Advertising.sln new file mode 100644 index 0000000000..106a851717 --- /dev/null +++ b/Samples/Advertising/cs/Advertising.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Advertising", "Advertising.csproj", "{DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}" +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 + {DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Debug|ARM.ActiveCfg = Debug|ARM + {DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Debug|ARM.Build.0 = Debug|ARM + {DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Debug|ARM.Deploy.0 = Debug|ARM + {DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Debug|x64.ActiveCfg = Debug|x64 + {DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Debug|x64.Build.0 = Debug|x64 + {DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Debug|x64.Deploy.0 = Debug|x64 + {DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Debug|x86.ActiveCfg = Debug|x86 + {DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Debug|x86.Build.0 = Debug|x86 + {DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Debug|x86.Deploy.0 = Debug|x86 + {DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Release|ARM.ActiveCfg = Release|ARM + {DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Release|ARM.Build.0 = Release|ARM + {DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Release|ARM.Deploy.0 = Release|ARM + {DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Release|x64.ActiveCfg = Release|x64 + {DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Release|x64.Build.0 = Release|x64 + {DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Release|x64.Deploy.0 = Release|x64 + {DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Release|x86.ActiveCfg = Release|x86 + {DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Release|x86.Build.0 = Release|x86 + {DC30CE66-DAEE-4CCF-BD02-8837FE918B6F}.Release|x86.Deploy.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Samples/Advertising/cs/Package.appxmanifest b/Samples/Advertising/cs/Package.appxmanifest new file mode 100644 index 0000000000..87f0cebf5e --- /dev/null +++ b/Samples/Advertising/cs/Package.appxmanifest @@ -0,0 +1,42 @@ + + + + + + Advertising C# Sample + Microsoft Corporation + Assets\StoreLogo-sdk.png + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Samples/Advertising/cs/SampleConfiguration.cs b/Samples/Advertising/cs/SampleConfiguration.cs new file mode 100644 index 0000000000..bc27e04bbf --- /dev/null +++ b/Samples/Advertising/cs/SampleConfiguration.cs @@ -0,0 +1,35 @@ +//********************************************************* +// +// 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. +// +//********************************************************* + +using System; +using System.Collections.Generic; +using Windows.UI.Xaml.Controls; + +namespace SDKTemplate +{ + public partial class MainPage : Page + { + public const string FEATURE_NAME = "Advertising C# Sample"; + + List scenarios = new List + { + new Scenario() { Title="Create an ad control in markup", ClassType=typeof(Scenario1_XamlAdControl)}, + new Scenario() { Title="Create an ad control programatically", ClassType=typeof(Scenario2_ProgramaticAdControl)}, + new Scenario() { Title="Show an interstitial video ad", ClassType=typeof(Scenario3_InterstitialAd)} + }; + } + + public class Scenario + { + public string Title { get; set; } + public Type ClassType { get; set; } + } +} diff --git a/Samples/Advertising/cs/Scenario1_XamlAdControl.xaml.cs b/Samples/Advertising/cs/Scenario1_XamlAdControl.xaml.cs new file mode 100644 index 0000000000..5dd46e8653 --- /dev/null +++ b/Samples/Advertising/cs/Scenario1_XamlAdControl.xaml.cs @@ -0,0 +1,42 @@ +//********************************************************* +// +// 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. +// +//********************************************************* + +using Microsoft.Advertising.WinRT.UI; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; + +namespace SDKTemplate +{ + public sealed partial class Scenario1_XamlAdControl : Page + { + private MainPage rootPage = MainPage.Current; + private int adCount = 0; + + public Scenario1_XamlAdControl() + { + this.InitializeComponent(); + } + + // This is an error handler for the interstitial ad. + private void OnErrorOccurred(object sender, AdErrorEventArgs e) + { + rootPage.NotifyUser($"An error occurred. {e.ErrorCode}: {e.ErrorMessage}", NotifyType.ErrorMessage); + } + + // This is an event handler for the ad control. It's invoked when the ad is refreshed. + private void OnAdRefreshed(object sender, RoutedEventArgs e) + { + // We increment the ad count so that the message changes at every refresh. + adCount++; + rootPage.NotifyUser($"Advertisement #{adCount}", NotifyType.StatusMessage); + } + } +} diff --git a/Samples/Advertising/cs/Scenario2_ProgramaticAdControl.xaml.cs b/Samples/Advertising/cs/Scenario2_ProgramaticAdControl.xaml.cs new file mode 100644 index 0000000000..00f2cb0a26 --- /dev/null +++ b/Samples/Advertising/cs/Scenario2_ProgramaticAdControl.xaml.cs @@ -0,0 +1,69 @@ +//********************************************************* +// +// 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. +// +//********************************************************* + +using Microsoft.Advertising.WinRT.UI; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; + +namespace SDKTemplate +{ + public sealed partial class Scenario2_ProgramaticAdControl : Page + { + MainPage rootPage = MainPage.Current; + int adCount = 0; + + public Scenario2_ProgramaticAdControl() + { + this.InitializeComponent(); + } + + private void CreateAdControl_Click(object sender, RoutedEventArgs e) + { + var button = (Button)sender; + button.IsEnabled = false; + + // Programatically create an ad control. This must be done from the UI thread. + var adControl = new AdControl(); + + // Set the application id and ad unit id + // The application id and ad unit id can be obtained from Dev Center. + // See "Monetize with Ads" at https://msdn.microsoft.com/en-us/library/windows/apps/mt170658.aspx + adControl.ApplicationId = "d25517cb-12d4-4699-8bdc-52040c712cab"; + adControl.AdUnitId = "10043134"; + + // Set the dimensions + adControl.Width = 160; + adControl.Height = 600; + + // Add event handlers if you want + adControl.ErrorOccurred += OnErrorOccurred; + adControl.AdRefreshed += OnAdRefreshed; + + // Add the ad control to the page. + var parent = (Panel)button.Parent; + parent.Children.Add(adControl); + } + + // This is an error handler for the interstitial ad. + private void OnErrorOccurred(object sender, AdErrorEventArgs e) + { + rootPage.NotifyUser($"An error occurred. {e.ErrorCode}: {e.ErrorMessage}", NotifyType.ErrorMessage); + } + + // This is an event handler for the ad control. It's invoked when the ad is refreshed. + private void OnAdRefreshed(object sender, RoutedEventArgs e) + { + // We increment the ad count so that the message changes at every refresh. + adCount++; + rootPage.NotifyUser($"Advertisement #{adCount}", NotifyType.StatusMessage); + } + } +} diff --git a/Samples/Advertising/cs/Scenario3_InterstitialAd.xaml.cs b/Samples/Advertising/cs/Scenario3_InterstitialAd.xaml.cs new file mode 100644 index 0000000000..25704ff2b9 --- /dev/null +++ b/Samples/Advertising/cs/Scenario3_InterstitialAd.xaml.cs @@ -0,0 +1,72 @@ +//********************************************************* +// +// 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. +// +//********************************************************* + +using Microsoft.Advertising.WinRT.UI; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; + +namespace SDKTemplate +{ + public sealed partial class Scenario3_InterstitialAd : Page + { + private MainPage rootPage = MainPage.Current; + private InterstitialAd interstitialAd; + + public Scenario3_InterstitialAd() + { + this.InitializeComponent(); + + // Instantiate the interstitial video ad + interstitialAd = new InterstitialAd(); + + // Attach event handlers + interstitialAd.ErrorOccurred += OnAdError; + interstitialAd.AdReady += OnAdReady; + interstitialAd.Cancelled += OnAdCancelled; + interstitialAd.Completed += OnAdCompleted; + } + + private void RunInterstitialAd(object sender, RoutedEventArgs e) + { + // Request an ad. When the ad is ready to show, the AdReady event will fire. + // The application id and ad unit id are passed in here. + // The application id and ad unit id can be obtained from Dev Center. + // See "Monetize with Ads" at https://msdn.microsoft.com/en-us/library/windows/apps/mt170658.aspx + interstitialAd.RequestAd(AdType.Video, "d25517cb-12d4-4699-8bdc-52040c712cab", "11389925"); + rootPage.NotifyUser("Ad requested", NotifyType.StatusMessage); + } + + // This is an event handler for the interstitial ad. It is triggered when the interstitial ad is ready to play. + private void OnAdReady(object sender, object e) + { + // The ad is ready to show; show it. + interstitialAd.Show(); + } + + // This is an event handler for the interstitial ad. It is triggered when the interstitial ad is cancelled. + private void OnAdCancelled(object sender, object e) + { + rootPage.NotifyUser("Ad cancelled", NotifyType.StatusMessage); + } + + // This is an event handler for the interstitial ad. It is triggered when the interstitial ad has completed playback. + private void OnAdCompleted(object sender, object e) + { + rootPage.NotifyUser("Ad completed", NotifyType.StatusMessage); + } + + // This is an error handler for the interstitial ad. + private void OnAdError(object sender, AdErrorEventArgs e) + { + rootPage.NotifyUser($"An error occurred. {e.ErrorCode}: {e.ErrorMessage}", NotifyType.ErrorMessage); + } + } +} diff --git a/Samples/Advertising/cs/project.json b/Samples/Advertising/cs/project.json new file mode 100644 index 0000000000..c594939270 --- /dev/null +++ b/Samples/Advertising/cs/project.json @@ -0,0 +1,16 @@ +{ + "dependencies": { + "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0" + }, + "frameworks": { + "uap10.0": {} + }, + "runtimes": { + "win10-arm": {}, + "win10-arm-aot": {}, + "win10-x86": {}, + "win10-x86-aot": {}, + "win10-x64": {}, + "win10-x64-aot": {} + } +} \ No newline at end of file diff --git a/Samples/Advertising/js/Advertising.jsproj b/Samples/Advertising/js/Advertising.jsproj new file mode 100644 index 0000000000..e228202518 --- /dev/null +++ b/Samples/Advertising/js/Advertising.jsproj @@ -0,0 +1,147 @@ + + + + + Debug + AnyCPU + + + Debug + ARM + + + Debug + x64 + + + Debug + x86 + + + Release + AnyCPU + + + Release + ARM + + + Release + x64 + + + Release + x86 + + + + c2adb9af-edb3-4e57-8056-9d0531d4a6b2 + + + + 14.0 + + + + + UAP + 10.0.10240.0 + 10.0.10240.0 + $(VersionNumberMajor).$(VersionNumberMinor) + en-US + + + + Designer + + + + + + + + + + default.html + + + images\microsoft-sdk.png + + + images\smallTile-sdk.png + + + images\splash-sdk.png + + + images\storeLogo-sdk.png + + + images\tile-sdk.png + + + images\windows-sdk.png + + + js\default.js + + + css\default.css + + + Microsoft.WinJS.4.0\css\ui-dark.css + + + Microsoft.WinJS.4.0\css\ui-light.css + + + Microsoft.WinJS.4.0\js\en-US\ui.strings.js + + + Microsoft.WinJS.4.0\js\WinJS.intellisense-setup.js + + + Microsoft.WinJS.4.0\js\WinJS.intellisense.js + + + Microsoft.WinJS.4.0\fonts\Symbols.ttf + + + Microsoft.WinJS.4.0\js\base.js + + + Microsoft.WinJS.4.0\js\ui.js + + + sample-utils\footer.html + + + sample-utils\header.html + + + sample-utils\sample-utils.js + + + sample-utils\scenario-select.css + + + sample-utils\scenario-select.html + + + + + + + + + \ No newline at end of file diff --git a/Samples/Advertising/js/Advertising.sln b/Samples/Advertising/js/Advertising.sln new file mode 100644 index 0000000000..0e905b0771 --- /dev/null +++ b/Samples/Advertising/js/Advertising.sln @@ -0,0 +1,48 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{262852C6-CD72-467D-83FE-5EEB1973A190}") = "Advertising", "Advertising.jsproj", "{C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|ARM = Debug|ARM + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|ARM = Release|ARM + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Debug|ARM.ActiveCfg = Debug|ARM + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Debug|ARM.Build.0 = Debug|ARM + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Debug|ARM.Deploy.0 = Debug|ARM + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Debug|x64.ActiveCfg = Debug|x64 + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Debug|x64.Build.0 = Debug|x64 + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Debug|x64.Deploy.0 = Debug|x64 + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Debug|x86.ActiveCfg = Debug|x86 + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Debug|x86.Build.0 = Debug|x86 + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Debug|x86.Deploy.0 = Debug|x86 + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Release|Any CPU.Build.0 = Release|Any CPU + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Release|Any CPU.Deploy.0 = Release|Any CPU + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Release|ARM.ActiveCfg = Release|ARM + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Release|ARM.Build.0 = Release|ARM + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Release|ARM.Deploy.0 = Release|ARM + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Release|x64.ActiveCfg = Release|x64 + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Release|x64.Build.0 = Release|x64 + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Release|x64.Deploy.0 = Release|x64 + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Release|x86.ActiveCfg = Release|x86 + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Release|x86.Build.0 = Release|x86 + {C2ADB9AF-EDB3-4E57-8056-9D0531D4A6B2}.Release|x86.Deploy.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Samples/Advertising/js/Microsoft.WinJS.4.0/css/placeholder.txt b/Samples/Advertising/js/Microsoft.WinJS.4.0/css/placeholder.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Samples/Advertising/js/Microsoft.WinJS.4.0/fonts/placeholder.txt b/Samples/Advertising/js/Microsoft.WinJS.4.0/fonts/placeholder.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Samples/Advertising/js/Microsoft.WinJS.4.0/js/en-US/placeholder.txt b/Samples/Advertising/js/Microsoft.WinJS.4.0/js/en-US/placeholder.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Samples/Advertising/js/css/placeholder.txt b/Samples/Advertising/js/css/placeholder.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Samples/Advertising/js/html/scenario1.html b/Samples/Advertising/js/html/scenario1.html new file mode 100644 index 0000000000..220a7506de --- /dev/null +++ b/Samples/Advertising/js/html/scenario1.html @@ -0,0 +1,29 @@ + + + + + + + + + + + + +

Description:

+
+ Create an ad control in markup +
+ +
+
+ + diff --git a/Samples/Advertising/js/html/scenario2.html b/Samples/Advertising/js/html/scenario2.html new file mode 100644 index 0000000000..0b96b31acf --- /dev/null +++ b/Samples/Advertising/js/html/scenario2.html @@ -0,0 +1,26 @@ + + + + + + + + + + + + +

Description:

+
+ Create an ad control programatically +
+

+ +

+
+ +
+ + diff --git a/Samples/Advertising/js/html/scenario3.html b/Samples/Advertising/js/html/scenario3.html new file mode 100644 index 0000000000..0c7cd03fe8 --- /dev/null +++ b/Samples/Advertising/js/html/scenario3.html @@ -0,0 +1,24 @@ + + + + + + + + + + + + + +

Description:

+
+ Show an interstitial video ad +
+

+ +

+ + diff --git a/Samples/Advertising/js/images/windows-sdk.png b/Samples/Advertising/js/images/windows-sdk.png new file mode 100644 index 0000000000000000000000000000000000000000..67268021df6fbd0dfdd5220f669db5e07d83f620 GIT binary patch literal 2997 zcmV;m3rh5fP);00009a7bBm000id z000id0mpBsWB>pPPiaF#P*7-ZbZ>KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0002sNkl}=C$qwI-NYOoT~TF4nB*YE@uK^dDB zWR30ww$s-POn&BXW+rPygeRt``M?BN0aGCJxdu1^r8s+Rdsm!&%k_ve0V-e%jKx_a z&Kh6@6u`k0^$aBgg{A`b{%e|-{MpA6H~>atXo8lmfjMc|h_j1WOH-MBto3b%xo=ah zD6ZCiGu#1JA7iMs;nIYI&w#sfAynGXP=aR{pby*>2XE7wE-hUGLmy+Pwc&3e3AYq~ rL3F-plJa|oO~TqubZP!GOu=ISd<8xF6%`=M00000NkvXXu0mjfiA9h! literal 0 HcmV?d00001 diff --git a/Samples/Advertising/js/js/sample-configuration.js b/Samples/Advertising/js/js/sample-configuration.js new file mode 100644 index 0000000000..0d565c1d9d --- /dev/null +++ b/Samples/Advertising/js/js/sample-configuration.js @@ -0,0 +1,18 @@ +//// Copyright (c) Microsoft Corporation. All rights reserved + +(function () { + "use strict"; + + var sampleTitle = "Advertising JS sample"; + + var scenarios = [ + { url: "/html/scenario1.html", title: "Create an ad control in markup" }, + { url: "/html/scenario2.html", title: "Create an ad control programatically" }, + { url: "/html/scenario3.html", title: "Show an interstitial video ad" } + ]; + + WinJS.Namespace.define("SdkSample", { + sampleTitle: sampleTitle, + scenarios: new WinJS.Binding.List(scenarios) + }); +})(); \ No newline at end of file diff --git a/Samples/Advertising/js/js/scenario1.js b/Samples/Advertising/js/js/scenario1.js new file mode 100644 index 0000000000..3965c06784 --- /dev/null +++ b/Samples/Advertising/js/js/scenario1.js @@ -0,0 +1,26 @@ +//// Copyright (c) Microsoft Corporation. All rights reserved + +(function () { + "use strict"; + var adCount = 0; + + var page = WinJS.UI.Pages.define("/html/scenario1.html", { + ready: function (element, options) { + var adControl = document.getElementById("adContainer").winControl; + adControl.onErrorOccurred = errorHandler; + adControl.onAdRefreshed = refreshHandler; + } + }); + + // This is an error event handler for the ad control. + function errorHandler(adControl, e) { + WinJS.log && WinJS.log("An error occurred. " + e.errorCode + ": " + e.errorMessage, "samples", "error"); + } + + // This is an event handler for the ad control. It is called when the ad is refreshed with a new ad. + function refreshHandler(adControl) { + // We increment the ad count so that the message changes at every refresh. + adCount++; + WinJS.log && WinJS.log("Advertisement #" + adCount, "samples", "status"); + } +})(); diff --git a/Samples/Advertising/js/js/scenario2.js b/Samples/Advertising/js/js/scenario2.js new file mode 100644 index 0000000000..d773ee8868 --- /dev/null +++ b/Samples/Advertising/js/js/scenario2.js @@ -0,0 +1,44 @@ +//// Copyright (c) Microsoft Corporation. All rights reserved + +(function () { + "use strict"; + var adCount = 0; + var adContainer; + + var page = WinJS.UI.Pages.define("/html/scenario2.html", { + ready: function (element, options) { + adContainer = document.getElementById("adContainer"); + document.getElementById("createAdControlButton").addEventListener("click", createAdControl); + } + }); + + function createAdControl(e) { + e.srcElement.disabled = true; + + // Set the ad container's size and position. + adContainer.style.width = '160px'; + adContainer.style.height = '600px'; + + // Create the ad control and attach event handlers. + // The applicationId and adUnitId can be obtained from Dev Center. + // See "Monetize with Ads" at https://msdn.microsoft.com/en-us/library/windows/apps/mt170658.aspx + var ad = new MicrosoftNSJS.Advertising.AdControl(adContainer, { + applicationId: 'd25517cb-12d4-4699-8bdc-52040c712cab', + adUnitId: '10043134', + onErrorOccurred: errorHandler, + onAdRefreshed: refreshHandler + }); + } + + // This is an error event handler for the ad control. + function errorHandler(adControl, e) { + WinJS.log && WinJS.log("An error occurred. " + e.errorCode + ": " + e.errorMessage, "samples", "error"); + } + + // This is an event handler for the ad control. It is called when the ad is refreshed with a new ad. + function refreshHandler(adControl) { + // We increment the ad count so that the message changes at every refresh. + adCount++; + WinJS.log && WinJS.log("Advertisement #" + adCount, "samples", "status"); + } +})(); diff --git a/Samples/Advertising/js/js/scenario3.js b/Samples/Advertising/js/js/scenario3.js new file mode 100644 index 0000000000..3bb2a2f368 --- /dev/null +++ b/Samples/Advertising/js/js/scenario3.js @@ -0,0 +1,54 @@ +//// Copyright (c) Microsoft Corporation. All rights reserved + +(function () { + "use strict"; + var interstitialAd = null; + + var page = WinJS.UI.Pages.define("/html/scenario3.html", { + ready: function (element, options) { + // Instantiate the ad + interstitialAd = new MicrosoftNSJS.Advertising.InterstitialAd(); + + // Attach the event handlers + interstitialAd.onAdReady = adReadyHandler; + interstitialAd.onErrorOccurredHandler = adErrorHandler; + interstitialAd.onCancelled = adCancelledHandler; + interstitialAd.onCompleted = adCompletedHandler; + + document.getElementById("runInterstitialAdButton").addEventListener("click", requestAdHandler); + } + }); + + function requestAdHandler(e) { + // Request the ad. + // The application id and ad unit id are passed in here. + // The applicationId and adUnitId can be obtained from Dev Center. + // See "Monetize with Ads" at https://msdn.microsoft.com/en-us/library/windows/apps/mt170658.aspx + interstitialAd.requestAd(MicrosoftNSJS.Advertising.InterstitialAdType.video, "d25517cb-12d4-4699-8bdc-52040c712cab", "11389925"); + WinJS.log && WinJS.log("Ad requested", "samples", "status"); + } + + // This is an event handler for the interstitial ad. It is triggered when the interstitial ad information has been downloaded and is ready to show. + function adReadyHandler(adControl) { + // The ad is ready, show it + // In some cases you might choose to request the ad in advance and + // show it at the time of your choosing, rather than calling show() + // in the adReady event handler. This will reduce the user's wait time for the ad. + interstitialAd.show(); + } + + // This is an event handler for the interstitial ad. It is triggered when the interstitial ad has been cancelled. + function adCancelledHandler(adControl) { + WinJS.log && WinJS.log("Ad cancelled", "samples", "status"); + } + + // This is an event handler for the interstitial ad. It is triggered when the interstitial ad playback has completed. + function adCompletedHandler(adControl) { + WinJS.log && WinJS.log("Ad completed", "samples", "status"); + } + + // This is an error handler for the interstitial ad. + function adErrorHandler(adControl, e) { + WinJS.log && WinJS.log("An error occurred. " + e.errorCode + ": " + e.errorMessage, "samples", "error"); + } +})(); diff --git a/Samples/Advertising/js/package.appxmanifest b/Samples/Advertising/js/package.appxmanifest new file mode 100644 index 0000000000..1eedccf71c --- /dev/null +++ b/Samples/Advertising/js/package.appxmanifest @@ -0,0 +1,42 @@ + + + + + + Advertising JS Sample + Microsoft Corporation + images\storelogo-sdk.png + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Samples/Advertising/js/sample-utils/placeholder.txt b/Samples/Advertising/js/sample-utils/placeholder.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Samples/Advertising/shared/Scenario1_XamlAdControl.xaml b/Samples/Advertising/shared/Scenario1_XamlAdControl.xaml new file mode 100644 index 0000000000..b5eb8820e8 --- /dev/null +++ b/Samples/Advertising/shared/Scenario1_XamlAdControl.xaml @@ -0,0 +1,39 @@ + + + + + + + Create an ad control in markup + + + + + + diff --git a/Samples/Advertising/shared/Scenario2_ProgramaticAdControl.xaml b/Samples/Advertising/shared/Scenario2_ProgramaticAdControl.xaml new file mode 100644 index 0000000000..c87c11084b --- /dev/null +++ b/Samples/Advertising/shared/Scenario2_ProgramaticAdControl.xaml @@ -0,0 +1,28 @@ + + + + + + + Create an ad control programatically + + +

+ + diff --git a/Samples/XamlWebView/cs/html/script_example.html b/Samples/XamlWebView/cs/html/script_example.html new file mode 100644 index 0000000000..e11f43948a --- /dev/null +++ b/Samples/XamlWebView/cs/html/script_example.html @@ -0,0 +1,14 @@ + + + + + +

Hello
+ + diff --git a/Samples/XamlWebView/cs/html/stream_example.html b/Samples/XamlWebView/cs/html/stream_example.html new file mode 100644 index 0000000000..d4fe8b1b6a --- /dev/null +++ b/Samples/XamlWebView/cs/html/stream_example.html @@ -0,0 +1,14 @@ + + + + Streamed content + + + +

+ This page was streamed by %. +

+ + + + diff --git a/Samples/XamlWebView/cs/project.json b/Samples/XamlWebView/cs/project.json new file mode 100644 index 0000000000..c594939270 --- /dev/null +++ b/Samples/XamlWebView/cs/project.json @@ -0,0 +1,16 @@ +{ + "dependencies": { + "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0" + }, + "frameworks": { + "uap10.0": {} + }, + "runtimes": { + "win10-arm": {}, + "win10-arm-aot": {}, + "win10-x86": {}, + "win10-x86-aot": {}, + "win10-x64": {}, + "win10-x64-aot": {} + } +} \ No newline at end of file