diff --git a/README.md b/README.md index 9086ab3627..3da77f4f28 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,7 @@ For additional Windows samples, see [Windows on GitHub](http://microsoft.github. WebView control (HTML) + WebView control (XAML) Window resizing @@ -453,31 +454,32 @@ For additional Windows samples, see [Windows on GitHub](http://microsoft.github. + - + - + - + - + - +
Advertising Background transfer DatagramSocketExchange Active Sync (EAS)
Exchange Active Sync (EAS) HttpClient JSONMobile broadband
Mobile broadband Radios RSS reader end-to-end (JavaScript)Socket activity trigger stream socket
Socket activity trigger stream socket StreamSocket SyndicationUSSD protocol
USSD protocol WebSocket Wi-Fi DirectWi-Fi Direct services
Wi-Fi Direct services Wi-Fi scanning
diff --git a/Samples/Accelerometer/cpp/Accelerometer.vcxproj b/Samples/Accelerometer/cpp/Accelerometer.vcxproj index efa0c1e474..d2969e716f 100644 --- a/Samples/Accelerometer/cpp/Accelerometer.vcxproj +++ b/Samples/Accelerometer/cpp/Accelerometer.vcxproj @@ -8,7 +8,7 @@ true Windows Store 10.0 - 10.0.10240.0 + 10.0.10586.0 10.0.10240.0 true diff --git a/Samples/Accelerometer/cs/Accelerometer.csproj b/Samples/Accelerometer/cs/Accelerometer.csproj index acdee0a749..8a1d68b280 100644 --- a/Samples/Accelerometer/cs/Accelerometer.csproj +++ b/Samples/Accelerometer/cs/Accelerometer.csproj @@ -11,7 +11,7 @@ Accelerometer en-US UAP - 10.0.10240.0 + 10.0.10586.0 10.0.10240.0 14 true diff --git a/Samples/Accelerometer/js/Accelerometer.jsproj b/Samples/Accelerometer/js/Accelerometer.jsproj index 50a74a1841..ecfb340f63 100644 --- a/Samples/Accelerometer/js/Accelerometer.jsproj +++ b/Samples/Accelerometer/js/Accelerometer.jsproj @@ -45,7 +45,7 @@ UAP - 10.0.10240.0 + 10.0.10586.0 10.0.10240.0 $(VersionNumberMajor).$(VersionNumberMinor) en-US diff --git a/Samples/Accelerometer/vb/Accelerometer.vbproj b/Samples/Accelerometer/vb/Accelerometer.vbproj index a6a30b0bd0..881d12e141 100644 --- a/Samples/Accelerometer/vb/Accelerometer.vbproj +++ b/Samples/Accelerometer/vb/Accelerometer.vbproj @@ -11,7 +11,7 @@ Accelerometer en-US UAP - 10.0.10240.0 + 10.0.10586.0 10.0.10240.0 14 true diff --git a/Samples/ActivitySensor/cpp/ActivitySensor.vcxproj b/Samples/ActivitySensor/cpp/ActivitySensor.vcxproj index c23a65d4d2..f96e1e9fec 100644 --- a/Samples/ActivitySensor/cpp/ActivitySensor.vcxproj +++ b/Samples/ActivitySensor/cpp/ActivitySensor.vcxproj @@ -8,7 +8,7 @@ true Windows Store 10.0 - 10.0.10240.0 + 10.0.10586.0 10.0.10240.0 true diff --git a/Samples/ActivitySensor/cpp/Tasks/ActivitySensorTasks.vcxproj b/Samples/ActivitySensor/cpp/Tasks/ActivitySensorTasks.vcxproj index 92bcbadac4..f2f65b045b 100644 --- a/Samples/ActivitySensor/cpp/Tasks/ActivitySensorTasks.vcxproj +++ b/Samples/ActivitySensor/cpp/Tasks/ActivitySensorTasks.vcxproj @@ -8,10 +8,10 @@ true Windows Store 10.0 - 10.0.10240.0 + 10.0.10586.0 10.0.10240.0 true - 10.0.10240.0 + 10.0.10586.0 diff --git a/Samples/ActivitySensor/cs/ActivitySensor.csproj b/Samples/ActivitySensor/cs/ActivitySensor.csproj index 5ae149ceda..b6b3005350 100644 --- a/Samples/ActivitySensor/cs/ActivitySensor.csproj +++ b/Samples/ActivitySensor/cs/ActivitySensor.csproj @@ -11,7 +11,7 @@ ActivitySensor en-US UAP - 10.0.10240.0 + 10.0.10586.0 10.0.10240.0 14 true diff --git a/Samples/ActivitySensor/cs/Tasks/ActivitySensorTasks.csproj b/Samples/ActivitySensor/cs/Tasks/ActivitySensorTasks.csproj index 50f9ca5440..a03bc01328 100644 --- a/Samples/ActivitySensor/cs/Tasks/ActivitySensorTasks.csproj +++ b/Samples/ActivitySensor/cs/Tasks/ActivitySensorTasks.csproj @@ -11,7 +11,7 @@ ActivitySensorTasksCS en-US UAP - 10.0.10240.0 + 10.0.10586.0 10.0.10240.0 14 true diff --git a/Samples/ActivitySensor/vb/ActivitySensor.vbproj b/Samples/ActivitySensor/vb/ActivitySensor.vbproj index b933aef062..dfeb499215 100644 --- a/Samples/ActivitySensor/vb/ActivitySensor.vbproj +++ b/Samples/ActivitySensor/vb/ActivitySensor.vbproj @@ -11,7 +11,7 @@ ActivitySensor en-US UAP - 10.0.10240.0 + 10.0.10586.0 10.0.10240.0 14 true diff --git a/Samples/ActivitySensor/vb/Tasks/ActivitySensorTasks.vbproj b/Samples/ActivitySensor/vb/Tasks/ActivitySensorTasks.vbproj index 22e6a17e73..684d529615 100644 --- a/Samples/ActivitySensor/vb/Tasks/ActivitySensorTasks.vbproj +++ b/Samples/ActivitySensor/vb/Tasks/ActivitySensorTasks.vbproj @@ -11,7 +11,7 @@ ActivitySensorTasksCS en-US UAP - 10.0.10240.0 + 10.0.10586.0 10.0.10240.0 14 true diff --git a/Samples/AdaptiveStreaming/cs/AdaptiveStreaming.csproj b/Samples/AdaptiveStreaming/cs/AdaptiveStreaming.csproj index cca9a1799b..a7227a5271 100644 --- a/Samples/AdaptiveStreaming/cs/AdaptiveStreaming.csproj +++ b/Samples/AdaptiveStreaming/cs/AdaptiveStreaming.csproj @@ -11,7 +11,7 @@ AdaptiveStreaming en-US UAP - 10.0.10240.0 + 10.0.10586.0 10.0.10240.0 14 true diff --git a/Samples/AdaptiveStreaming/js/AdaptiveStreaming.jsproj b/Samples/AdaptiveStreaming/js/AdaptiveStreaming.jsproj index 10c5647ca5..1227967965 100644 --- a/Samples/AdaptiveStreaming/js/AdaptiveStreaming.jsproj +++ b/Samples/AdaptiveStreaming/js/AdaptiveStreaming.jsproj @@ -45,7 +45,7 @@ UAP - 10.0.10240.0 + 10.0.10586.0 10.0.10240.0 $(VersionNumberMajor).$(VersionNumberMinor) en-US diff --git a/Samples/AdaptiveStreaming/vb/AdaptiveStreaming.vbproj b/Samples/AdaptiveStreaming/vb/AdaptiveStreaming.vbproj index 52730c125a..9fa3e0723b 100644 --- a/Samples/AdaptiveStreaming/vb/AdaptiveStreaming.vbproj +++ b/Samples/AdaptiveStreaming/vb/AdaptiveStreaming.vbproj @@ -11,7 +11,7 @@ AdaptiveStreaming en-US UAP - 10.0.10240.0 + 10.0.10586.0 10.0.10240.0 14 true diff --git a/Samples/AdvancedCasting/cs/AdvancedCasting.csproj b/Samples/AdvancedCasting/cs/AdvancedCasting.csproj index d8cfad76b6..cea5d4debd 100644 --- a/Samples/AdvancedCasting/cs/AdvancedCasting.csproj +++ b/Samples/AdvancedCasting/cs/AdvancedCasting.csproj @@ -11,7 +11,7 @@ ScreenCasting en-US UAP - 10.0.10240.0 + 10.0.10586.0 10.0.10240.0 14 true diff --git a/Samples/AdvancedCasting/vb/AdvancedCasting.vbproj b/Samples/AdvancedCasting/vb/AdvancedCasting.vbproj index 8669452adf..a82806bbae 100644 --- a/Samples/AdvancedCasting/vb/AdvancedCasting.vbproj +++ b/Samples/AdvancedCasting/vb/AdvancedCasting.vbproj @@ -11,7 +11,7 @@ ScreenCasting en-US UAP - 10.0.10240.0 + 10.0.10586.0 10.0.10240.0 14 true 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..0b89b31bae --- /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.10586.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..df966e05d3 --- /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.10586.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..9220ed4f99 --- /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.10586.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 0000000000..67268021df Binary files /dev/null and b/Samples/Advertising/js/images/windows-sdk.png differ 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 diff --git a/Samples/XmlDocument/cs/XmlDocument.csproj b/Samples/XmlDocument/cs/XmlDocument.csproj index 0df0575d45..df94bbcc88 100644 --- a/Samples/XmlDocument/cs/XmlDocument.csproj +++ b/Samples/XmlDocument/cs/XmlDocument.csproj @@ -11,7 +11,7 @@ Xml en-US UAP - 10.0.10240.0 + 10.0.10586.0 10.0.10240.0 14 true diff --git a/Samples/XmlDocument/js/XmlDocument.jsproj b/Samples/XmlDocument/js/XmlDocument.jsproj index c7ea39f882..0d0f1b386a 100644 --- a/Samples/XmlDocument/js/XmlDocument.jsproj +++ b/Samples/XmlDocument/js/XmlDocument.jsproj @@ -45,7 +45,7 @@ UAP - 10.0.10240.0 + 10.0.10586.0 10.0.10240.0 $(VersionNumberMajor).$(VersionNumberMinor) en-US diff --git a/Samples/XmlLite/cpp/XmlLite.vcxproj b/Samples/XmlLite/cpp/XmlLite.vcxproj index 192da5f75a..4c1c346e9f 100644 --- a/Samples/XmlLite/cpp/XmlLite.vcxproj +++ b/Samples/XmlLite/cpp/XmlLite.vcxproj @@ -8,7 +8,7 @@ true Windows Store 10.0 - 10.0.10240.0 + 10.0.10586.0 10.0.10240.0 true