From ef073ed8a2007d113af1d88eddace479e3bf0e07 Mon Sep 17 00:00:00 2001 From: Raymond Chen Date: Tue, 2 Aug 2016 17:00:00 -0700 Subject: [PATCH] Windows 10 RTM Release - August 2016 Update --- .../cs/Scenario2ViewModel.cs | 44 ++--- .../cs/Scenario2ViewModel.cs | 14 +- Samples/Notifications/js/Notifications.sln | 40 ++++ .../Microsoft.WinJS.4.0/css/placeholder.txt | 0 .../Microsoft.WinJS.4.0/fonts/placeholder | 0 .../js/en-US/placeholder.txt | 0 .../js/Notifications/Notifications.jsproj | 183 ++++++++++++++++++ .../css/scenario1-pinningsecondarytiles.css | 23 +++ .../css/scenario9-unpineverything.css | 7 + .../html/scenario1-pinningsecondarytiles.html | 61 ++++++ .../html/scenario2-updatesecondarytile.html | 31 +++ .../scenario3-primarytilenotifications.html | 28 +++ .../scenario4-secondarytilenotifications.html | 27 +++ .../scenario5-expiringtilenotifications.html | 29 +++ ...scenario6-schedulingtilenotifications.html | 29 +++ .../html/scenario7-primarytilebadges.html | 36 ++++ .../html/scenario8-secondarytilebadges.html | 38 ++++ .../html/scenario9-unpineverything.html | 65 +++++++ .../js/Notifications/images/cancel.png | Bin 0 -> 550 bytes .../js/Notifications/images/check.png | Bin 0 -> 604 bytes .../js/Notifications/js/default.js | 105 ++++++++++ .../Notifications/js/sample-configuration.js | 24 +++ .../js/scenario1-pinningsecondarytiles.js | 72 +++++++ .../js/scenario2-updatesecondarytile.js | 88 +++++++++ .../js/scenario3-primarytilenotifications.js | 66 +++++++ .../scenario4-secondarytilenotifications.js | 87 +++++++++ .../js/scenario5-expiringtilenotifications.js | 83 ++++++++ .../scenario6-schedulingtilenotifications.js | 113 +++++++++++ .../js/scenario7-primarytilebadges.js | 82 ++++++++ .../js/scenario8-secondarytilebadges.js | 133 +++++++++++++ .../js/scenario9-unpineverything.js | 88 +++++++++ .../js/Notifications/package.appxmanifest | 41 ++++ .../js/Notifications/packages.config | 4 + .../sample-utils/placeholder.txt | 0 .../js/WinRTComponent/WinRTSharedObject.cpp | 47 +++-- .../js/WinRTComponent/WinRTSharedObject.h | 31 ++- Samples/WebView/js/css/10_AppWebviewComm.css | 4 + .../WebView/js/html/10_AppWebviewComm.html | 14 +- Samples/WebView/js/js/10_AppWebviewComm.js | 25 ++- Samples/XamlBind/cpp/OtherBindings.xaml | 4 +- Samples/XamlBind/cs/OtherBindings.xaml | 4 +- .../cpp/GameContent/MoveLookController.cpp | 9 +- SharedContent/media/Square310x310Logo.png | Bin 0 -> 6124 bytes 43 files changed, 1709 insertions(+), 70 deletions(-) create mode 100644 Samples/Notifications/js/Notifications.sln create mode 100644 Samples/Notifications/js/Notifications/Microsoft.WinJS.4.0/css/placeholder.txt create mode 100644 Samples/Notifications/js/Notifications/Microsoft.WinJS.4.0/fonts/placeholder create mode 100644 Samples/Notifications/js/Notifications/Microsoft.WinJS.4.0/js/en-US/placeholder.txt create mode 100644 Samples/Notifications/js/Notifications/Notifications.jsproj create mode 100644 Samples/Notifications/js/Notifications/css/scenario1-pinningsecondarytiles.css create mode 100644 Samples/Notifications/js/Notifications/css/scenario9-unpineverything.css create mode 100644 Samples/Notifications/js/Notifications/html/scenario1-pinningsecondarytiles.html create mode 100644 Samples/Notifications/js/Notifications/html/scenario2-updatesecondarytile.html create mode 100644 Samples/Notifications/js/Notifications/html/scenario3-primarytilenotifications.html create mode 100644 Samples/Notifications/js/Notifications/html/scenario4-secondarytilenotifications.html create mode 100644 Samples/Notifications/js/Notifications/html/scenario5-expiringtilenotifications.html create mode 100644 Samples/Notifications/js/Notifications/html/scenario6-schedulingtilenotifications.html create mode 100644 Samples/Notifications/js/Notifications/html/scenario7-primarytilebadges.html create mode 100644 Samples/Notifications/js/Notifications/html/scenario8-secondarytilebadges.html create mode 100644 Samples/Notifications/js/Notifications/html/scenario9-unpineverything.html create mode 100644 Samples/Notifications/js/Notifications/images/cancel.png create mode 100644 Samples/Notifications/js/Notifications/images/check.png create mode 100644 Samples/Notifications/js/Notifications/js/default.js create mode 100644 Samples/Notifications/js/Notifications/js/sample-configuration.js create mode 100644 Samples/Notifications/js/Notifications/js/scenario1-pinningsecondarytiles.js create mode 100644 Samples/Notifications/js/Notifications/js/scenario2-updatesecondarytile.js create mode 100644 Samples/Notifications/js/Notifications/js/scenario3-primarytilenotifications.js create mode 100644 Samples/Notifications/js/Notifications/js/scenario4-secondarytilenotifications.js create mode 100644 Samples/Notifications/js/Notifications/js/scenario5-expiringtilenotifications.js create mode 100644 Samples/Notifications/js/Notifications/js/scenario6-schedulingtilenotifications.js create mode 100644 Samples/Notifications/js/Notifications/js/scenario7-primarytilebadges.js create mode 100644 Samples/Notifications/js/Notifications/js/scenario8-secondarytilebadges.js create mode 100644 Samples/Notifications/js/Notifications/js/scenario9-unpineverything.js create mode 100644 Samples/Notifications/js/Notifications/package.appxmanifest create mode 100644 Samples/Notifications/js/Notifications/packages.config create mode 100644 Samples/Notifications/js/Notifications/sample-utils/placeholder.txt create mode 100644 SharedContent/media/Square310x310Logo.png diff --git a/Samples/AllJoyn/ConsumerExperiences/cs/Scenario2ViewModel.cs b/Samples/AllJoyn/ConsumerExperiences/cs/Scenario2ViewModel.cs index 1b6ab13846..8908dd3d4f 100644 --- a/Samples/AllJoyn/ConsumerExperiences/cs/Scenario2ViewModel.cs +++ b/Samples/AllJoyn/ConsumerExperiences/cs/Scenario2ViewModel.cs @@ -16,6 +16,7 @@ using System.Collections.ObjectModel; using System.ComponentModel; using System.Text; +using System.Threading; using System.Threading.Tasks; using System.Windows.Input; using Windows.Devices.AllJoyn; @@ -59,13 +60,12 @@ class Scenario2ViewModel : INotifyPropertyChanged private bool? m_physicalDeviceIsChecked = null; private bool m_showOnboardeeSsidList = true; private bool m_showOnboarderSsidList = false; - private bool m_isAuthenticated = false; - private bool m_isCredentialsRequested = false; private AllJoynBusAttachment m_busAttachment = null; private OnboardingWatcher m_watcher = null; private OnboardingConsumer m_consumer = null; private OnboardingAuthenticationType m_selectedAuthType = OnboardingAuthenticationType.Any; private TaskCompletionSource m_authenticateClicked = null; + private int m_onboardSessionAlreadyJoined; public Scenario2ViewModel() { @@ -681,9 +681,13 @@ private void ScanForOnboardingInterfaces() { ScenarioCleanup(); + // Allow re-joining of a new session + Interlocked.Exchange(ref m_onboardSessionAlreadyJoined, 0); + m_busAttachment = new AllJoynBusAttachment(); m_busAttachment.StateChanged += BusAttachment_StateChanged; m_busAttachment.AuthenticationMechanisms.Clear(); + m_busAttachment.AuthenticationMechanisms.Add(AllJoynAuthenticationMechanism.EcdheNull); m_busAttachment.AuthenticationMechanisms.Add(AllJoynAuthenticationMechanism.EcdhePsk); m_busAttachment.AuthenticationComplete += BusAttachment_AuthenticationComplete; m_busAttachment.CredentialsRequested += BusAttachment_CredentialsRequested; @@ -713,7 +717,6 @@ private void BusAttachment_AuthenticationComplete(AllJoynBusAttachment sender, A UpdateStatusAsync("Authentication failed.", NotifyType.ErrorMessage); } - m_isAuthenticated = args.Succeeded; EnteredKey = ""; AuthenticationVisibility = Visibility.Collapsed; } @@ -721,7 +724,6 @@ private void BusAttachment_AuthenticationComplete(AllJoynBusAttachment sender, A private async void BusAttachment_CredentialsRequested(AllJoynBusAttachment sender, AllJoynCredentialsRequestedEventArgs args) { Windows.Foundation.Deferral credentialsDeferral = args.GetDeferral(); - m_isCredentialsRequested = true; if (args.Credentials.AuthenticationMechanism == AllJoynAuthenticationMechanism.EcdhePsk) { @@ -741,6 +743,9 @@ private async void BusAttachment_CredentialsRequested(AllJoynBusAttachment sende UpdateStatusAsync("Please enter a key.", NotifyType.ErrorMessage); } } + else if (args.Credentials.AuthenticationMechanism == AllJoynAuthenticationMechanism.EcdheNull) + { + } else { UpdateStatusAsync("Unexpected authentication mechanism.", NotifyType.ErrorMessage); @@ -751,18 +756,25 @@ private async void BusAttachment_CredentialsRequested(AllJoynBusAttachment sende private async void Watcher_Added(OnboardingWatcher sender, AllJoynServiceInfo args) { + // This demo supports a single onboarding producer, if there are multiple onboarding producers found, then they are ignored. + // Another approach would be to create a list of all producers found and then allow the user to choose the one they want + bool bAlreadyJoined = (Interlocked.CompareExchange(ref m_onboardSessionAlreadyJoined, 1, 0) == 1); + if (bAlreadyJoined) + { + return; + } + UpdateStatusAsync("Joining session...", NotifyType.StatusMessage); + OnboardingJoinSessionResult joinSessionResult = await OnboardingConsumer.JoinSessionAsync(args, sender); if (joinSessionResult.Status == AllJoynStatus.Ok) { + UpdateStatusAsync("Session Joined.", NotifyType.ErrorMessage); DisposeConsumer(); m_consumer = joinSessionResult.Consumer; m_consumer.SessionLost += Consumer_SessionLost; - if (!m_isCredentialsRequested || m_isAuthenticated) - { - GetOnboardeeNetworkListAsync(); - } + GetOnboardeeNetworkListAsync(); } else { @@ -869,8 +881,8 @@ private async void AttemptOnboardingAsync(string ssid, string password, short au else { UpdateStatusAsync("Attempting to configure onboardee...", NotifyType.StatusMessage); - // WiFi password must be converted to hex representation of the UTF-8 string. - OnboardingConfigureWiFiResult configureWifiResult = await m_consumer.ConfigureWiFiAsync(ssid, ConvertUtf8ToHex(password), authType); + + OnboardingConfigureWiFiResult configureWifiResult = await m_consumer.ConfigureWiFiAsync(ssid, password, authType); if (configureWifiResult.Status == AllJoynStatus.Ok) { UpdateStatusAsync("Onboardee sucessfully configured.", NotifyType.StatusMessage); @@ -912,18 +924,6 @@ private void Signals_ConnectionResultReceived(OnboardingSignals sender, Onboardi } } - private string ConvertUtf8ToHex(string inputString) - { - if (string.IsNullOrEmpty(inputString)) - { - return string.Empty; - } - else - { - return BitConverter.ToString(Encoding.UTF8.GetBytes(inputString)).Replace("-", string.Empty); - } - } - private void ClearPasswords() { SoftAPPassword = ""; diff --git a/Samples/AllJoyn/ProducerExperiences/cs/Scenario2ViewModel.cs b/Samples/AllJoyn/ProducerExperiences/cs/Scenario2ViewModel.cs index b1fe8a0968..ccc4915224 100644 --- a/Samples/AllJoyn/ProducerExperiences/cs/Scenario2ViewModel.cs +++ b/Samples/AllJoyn/ProducerExperiences/cs/Scenario2ViewModel.cs @@ -334,7 +334,7 @@ private async void OnboardingService_ConnectRequestRecieved(object sender, Event } else { - if (AppData.OnboardingConfigurePassphrase.Equals(ConvertUtf8ToHex(AppData.SampleNetworkPassword), StringComparison.OrdinalIgnoreCase)) + if (AppData.OnboardingConfigurePassphrase.Equals(AppData.SampleNetworkPassword, StringComparison.OrdinalIgnoreCase)) { returnArg.Value1 = (short)ConnectionResultCode.Validated; returnArg.Value2 = "Connected successfully"; @@ -377,18 +377,6 @@ private async void OnboardingService_ConnectRequestRecieved(object sender, Event } } - private string ConvertUtf8ToHex(string inputString) - { - if (string.IsNullOrEmpty(inputString)) - { - return string.Empty; - } - else - { - return BitConverter.ToString(Encoding.UTF8.GetBytes(inputString)).Replace("-", string.Empty); - } - } - private async void UpdateStatusAsync(string status, NotifyType statusType) { await m_dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => diff --git a/Samples/Notifications/js/Notifications.sln b/Samples/Notifications/js/Notifications.sln new file mode 100644 index 0000000000..e84659461b --- /dev/null +++ b/Samples/Notifications/js/Notifications.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25123.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{262852C6-CD72-467D-83FE-5EEB1973A190}") = "Notifications", "Notifications\Notifications.jsproj", "{0DBEEE91-BC29-40A6-B02D-3754DA6C1A72}" +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 + {0DBEEE91-BC29-40A6-B02D-3754DA6C1A72}.Debug|ARM.ActiveCfg = Debug|ARM + {0DBEEE91-BC29-40A6-B02D-3754DA6C1A72}.Debug|ARM.Build.0 = Debug|ARM + {0DBEEE91-BC29-40A6-B02D-3754DA6C1A72}.Debug|ARM.Deploy.0 = Debug|ARM + {0DBEEE91-BC29-40A6-B02D-3754DA6C1A72}.Debug|x64.ActiveCfg = Debug|x64 + {0DBEEE91-BC29-40A6-B02D-3754DA6C1A72}.Debug|x64.Build.0 = Debug|x64 + {0DBEEE91-BC29-40A6-B02D-3754DA6C1A72}.Debug|x64.Deploy.0 = Debug|x64 + {0DBEEE91-BC29-40A6-B02D-3754DA6C1A72}.Debug|x86.ActiveCfg = Debug|x86 + {0DBEEE91-BC29-40A6-B02D-3754DA6C1A72}.Debug|x86.Build.0 = Debug|x86 + {0DBEEE91-BC29-40A6-B02D-3754DA6C1A72}.Debug|x86.Deploy.0 = Debug|x86 + {0DBEEE91-BC29-40A6-B02D-3754DA6C1A72}.Release|ARM.ActiveCfg = Release|ARM + {0DBEEE91-BC29-40A6-B02D-3754DA6C1A72}.Release|ARM.Build.0 = Release|ARM + {0DBEEE91-BC29-40A6-B02D-3754DA6C1A72}.Release|ARM.Deploy.0 = Release|ARM + {0DBEEE91-BC29-40A6-B02D-3754DA6C1A72}.Release|x64.ActiveCfg = Release|x64 + {0DBEEE91-BC29-40A6-B02D-3754DA6C1A72}.Release|x64.Build.0 = Release|x64 + {0DBEEE91-BC29-40A6-B02D-3754DA6C1A72}.Release|x64.Deploy.0 = Release|x64 + {0DBEEE91-BC29-40A6-B02D-3754DA6C1A72}.Release|x86.ActiveCfg = Release|x86 + {0DBEEE91-BC29-40A6-B02D-3754DA6C1A72}.Release|x86.Build.0 = Release|x86 + {0DBEEE91-BC29-40A6-B02D-3754DA6C1A72}.Release|x86.Deploy.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Samples/Notifications/js/Notifications/Microsoft.WinJS.4.0/css/placeholder.txt b/Samples/Notifications/js/Notifications/Microsoft.WinJS.4.0/css/placeholder.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Samples/Notifications/js/Notifications/Microsoft.WinJS.4.0/fonts/placeholder b/Samples/Notifications/js/Notifications/Microsoft.WinJS.4.0/fonts/placeholder new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Samples/Notifications/js/Notifications/Microsoft.WinJS.4.0/js/en-US/placeholder.txt b/Samples/Notifications/js/Notifications/Microsoft.WinJS.4.0/js/en-US/placeholder.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Samples/Notifications/js/Notifications/Notifications.jsproj b/Samples/Notifications/js/Notifications/Notifications.jsproj new file mode 100644 index 0000000000..fedb196172 --- /dev/null +++ b/Samples/Notifications/js/Notifications/Notifications.jsproj @@ -0,0 +1,183 @@ + + + + + Debug + ARM + + + Debug + x64 + + + Debug + x86 + + + Release + ARM + true + + + Release + x64 + true + + + Release + x86 + true + + + + 0dbeee91-bc29-40a6-b02d-3754da6c1a72 + + + + 14.0 + + + + + UAP + 10.0.10240.0 + 10.0.10240.0 + $(VersionNumberMajor).$(VersionNumberMinor) + en-US + + + + Designer + + + default.html + + + 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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + images\microsoft-sdk.png + + + images\Square150x150Logo.png + + + images\Square44x44Logo.png + + + images\Wide310x150Logo.png + + + images\Square310x310Logo.png + + + images\SplashScreen.png + + + images\StoreLogo.png + + + images\windows-sdk.png + + + PreserveNewest + + + PreserveNewest + + + + + ..\packages\NotificationsExtensions.Win10.JavaScript.14332.0.2\lib\Windows\NotificationsExtensions.winmd + true + True + True + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/css/scenario1-pinningsecondarytiles.css b/Samples/Notifications/js/Notifications/css/scenario1-pinningsecondarytiles.css new file mode 100644 index 0000000000..8b99e46969 --- /dev/null +++ b/Samples/Notifications/js/Notifications/css/scenario1-pinningsecondarytiles.css @@ -0,0 +1,23 @@ +#scenario1 img { + background-color: purple; +} + +#scenario1 img.smalltile { + height: 71px; + width: 71px; +} + +#scenario1 img.mediumtile { + height: 150px; + width: 150px; +} + +#scenario1 img.widetile { + height: 150px; + width: 310px; +} + +#scenario1 img.largetile { + height: 310px; + width: 310px; +} diff --git a/Samples/Notifications/js/Notifications/css/scenario9-unpineverything.css b/Samples/Notifications/js/Notifications/css/scenario9-unpineverything.css new file mode 100644 index 0000000000..4f056e002b --- /dev/null +++ b/Samples/Notifications/js/Notifications/css/scenario9-unpineverything.css @@ -0,0 +1,7 @@ +#scenario9 #scenariocontrol { + height: 100%; +} + +#scenario9 .displayname { + font-weight:bold; +} \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/html/scenario1-pinningsecondarytiles.html b/Samples/Notifications/js/Notifications/html/scenario1-pinningsecondarytiles.html new file mode 100644 index 0000000000..ba4c91dc0f --- /dev/null +++ b/Samples/Notifications/js/Notifications/html/scenario1-pinningsecondarytiles.html @@ -0,0 +1,61 @@ + + + + + + + + + + + + +
+

Description:

+
+ Pinning secondary tiles +
+

+ Every app, upon installation, gets its own default primary tile. + Primary tiles are unpinned by default, and it is only up to each individual + user to initiate a request to pin a primary tile to their start menu. + If your app would like to pin tiles to the start menu programatically, + it can do so by creating a secondary tile and prompting the user to authorize + a request to pin that secondary tile to their start menu. +

+ + Secondary Tile Name: +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + +
+ + +
+ + +
+ + + \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/html/scenario2-updatesecondarytile.html b/Samples/Notifications/js/Notifications/html/scenario2-updatesecondarytile.html new file mode 100644 index 0000000000..b1f0643f1e --- /dev/null +++ b/Samples/Notifications/js/Notifications/html/scenario2-updatesecondarytile.html @@ -0,0 +1,31 @@ + + + + + + + + + + + +
+

Description:

+
+ Updating a secondary tile. +
+ +

Properties of secondary tiles, like their display name, logos, arguments, and more, can be updated after a secondary tile has been pinned. This scenario provides an example of updating a secondary tile's name and logos.

+

Step 1:

+

Step 2: Open Start and observe the tile pinned as "Original" with the "X" logo.

+

Step 3:

+

Step 4: Open Start again and observe that the secondary tile's name has changed to "Updated", and the logos on the tile are now check marks.

+
+

+ +
+ + + \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/html/scenario3-primarytilenotifications.html b/Samples/Notifications/js/Notifications/html/scenario3-primarytilenotifications.html new file mode 100644 index 0000000000..af6b0b1604 --- /dev/null +++ b/Samples/Notifications/js/Notifications/html/scenario3-primarytilenotifications.html @@ -0,0 +1,28 @@ + + + + + + + + + + + +
+

Description:

+
+ Sending and clearing notifications for your app's primary tile. +
+ +

Step 1: Manually pin this app's primary tile to your Start screen (if its not already)

+

Step 2:

+

Step 3: Open Start and observe the notification displayed on the primary tile.

+

Step 4:

+

Step 5: Open Start again and observe that the notification has been cleard from the primary tile.

+
+ + + \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/html/scenario4-secondarytilenotifications.html b/Samples/Notifications/js/Notifications/html/scenario4-secondarytilenotifications.html new file mode 100644 index 0000000000..1e84622e1f --- /dev/null +++ b/Samples/Notifications/js/Notifications/html/scenario4-secondarytilenotifications.html @@ -0,0 +1,27 @@ + + + + + + + + + + + +
+

Description:

+
+ Sending notifications to your app's secondary tile. +
+ +

Step 1:

+

Step 2: Open Start and observe the new secondary tile has been pinned.

+

Step 3:

+

Step 4: Open Start and observe notification displayed on the secondary tile.

+
+ + + \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/html/scenario5-expiringtilenotifications.html b/Samples/Notifications/js/Notifications/html/scenario5-expiringtilenotifications.html new file mode 100644 index 0000000000..99b52f55ae --- /dev/null +++ b/Samples/Notifications/js/Notifications/html/scenario5-expiringtilenotifications.html @@ -0,0 +1,29 @@ + + + + + + + + + + + +
+

Description:

+
+ Tile notifications can be set to expire. +
+ +

Step 1:

+

Step 2: Open Start and observe a tile with the name "Expiring Notification" has been pinned.

+

Step 3:

+

Step 4: Open Start and observe a notification appears on the tile. Watch it expire at the specified time.

+ +
+ + + + \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/html/scenario6-schedulingtilenotifications.html b/Samples/Notifications/js/Notifications/html/scenario6-schedulingtilenotifications.html new file mode 100644 index 0000000000..cc8bc14ee5 --- /dev/null +++ b/Samples/Notifications/js/Notifications/html/scenario6-schedulingtilenotifications.html @@ -0,0 +1,29 @@ + + + + + + + + + + + +
+

Description:

+
+ Scheduling tile notifications for the future. +
+ +

Step 1:

+

Step 2: Open Start and observe a tile with the name "Scheduling Notifications" has been pinned.

+

Step 3:

+

Step 4: Open Start and observe a notification has appeared on the tile. Watch the notifications change until the specified time has elapsed.

+
+

+
+ + + \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/html/scenario7-primarytilebadges.html b/Samples/Notifications/js/Notifications/html/scenario7-primarytilebadges.html new file mode 100644 index 0000000000..f647ba0f60 --- /dev/null +++ b/Samples/Notifications/js/Notifications/html/scenario7-primarytilebadges.html @@ -0,0 +1,36 @@ + + + + + + + + + + + +
+

Description:

+
+ Display badges on primary tiles. +
+ +

Step 1: Manually pin this app's primary tile to your Start screen (if its not already)

+

Step 2: Use the controls below to display badges on the primary tile.

+
+

+

+ + +

+

+ + +

+
+ + + + \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/html/scenario8-secondarytilebadges.html b/Samples/Notifications/js/Notifications/html/scenario8-secondarytilebadges.html new file mode 100644 index 0000000000..beb5553b9f --- /dev/null +++ b/Samples/Notifications/js/Notifications/html/scenario8-secondarytilebadges.html @@ -0,0 +1,38 @@ + + + + + + + + + + + +
+

Description:

+
+ Display badges on secondary tiles. +
+ + +

Step 1:

+

Step 2: Use the controls below to display badges on the secondary tile.

+
+

+

+ + +

+

+ + +

+
+

+
+ + + \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/html/scenario9-unpineverything.html b/Samples/Notifications/js/Notifications/html/scenario9-unpineverything.html new file mode 100644 index 0000000000..37eded89b2 --- /dev/null +++ b/Samples/Notifications/js/Notifications/html/scenario9-unpineverything.html @@ -0,0 +1,65 @@ + + + + + + + + + + + + +
+

Description:

+
+ Unpinning all secondary tiles for this app. +
+ +
+ +

+ Your app can programatically unpin its secondary tiles. +

+

+ The above button loops through all secondary tiles using findAllAsync() and calls requestDeleteAsync() on each tile to unpin all secondary tiles. + Listed below are all of the secondary tiles currently pinned for this app. +

+ + + + + +
+
+
+ + + \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/images/cancel.png b/Samples/Notifications/js/Notifications/images/cancel.png new file mode 100644 index 0000000000000000000000000000000000000000..1d7f70b7ccaf721d21bb415c152110632724fda9 GIT binary patch literal 550 zcmeAS@N?(olHy`uVBq!ia0vp^J|N7&1|*M957Y)yk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+7*BY*IEGZ*dULDM_ppILYvLtN3Dq11X#=Mj4HGZ%CNPI3 zH1{z`&oK6C%~D-kyYcalAM;B#g>23Ie6r|mw)OKnvYqD{nGP^8^B5f9NN8YWlSp7O zK;>?TZ7hu~51e!{{Kt-MDtoV->_7PU>7)7+x}gVu_q@|jZaaV1yVm#m=j8n-ZF3pL z64ttLZ;0u*W^#jRnp7_1Yo@i41}hKVJvW2%^_!CbQyu+%)s2kfXp?X dDbL8paIA-Gr?IEGZ*dUNA{ZnJ?v+rtfxZZ9}WnoC;p4sb{=lrCYp z!g-1J1zSmTN^=_X_ka`mDe?)-ZQoV8|1@&gY&<*NyT?%5E1ol%`1vm6*!-PgUoBbJNM`FUHaWYM^^Igs`kSeYWk+vG zl`n0WyTOcW4gY=bOWA8YCZ%ks_2#RV%s!oYzsUZ5`UcNu8yF9ISuU9t%x4t$w61U8 z!9~%NKH1LiORW&s6#F}E59ji0+mkMM3UWs{TjZ{?`Ju(dS|+S9e_F@$f~s{z6LQsA zB5b9*a`pCj2X$R)5#M zuC`y=#)>s!(oTMpqiXxFpSvbuR?8dp(0Gm;?=>df@1lOs8J3;&E6=Dsl=&qg_u{X% z%L@-Qm21E1-C0l~zUo)$oZ>as0_}PUfm_R`{M8QMd-7}ju5%k++_FCPcV)4~+_RHv zTvks{pFOke<(zMf-P<1D5_-F?*ot*S;IG6}Yp(9rHCfHJh)H+$lO+ 768) { + splitView.closedDisplayMode = WinJS.UI.SplitView.ClosedDisplayMode.none; + splitView.openedDisplayMode = WinJS.UI.SplitView.OpenedDisplayMode.inline; + } else { + splitView.closedDisplayMode = WinJS.UI.SplitView.ClosedDisplayMode.none; + splitView.openedDisplayMode = WinJS.UI.SplitView.OpenedDisplayMode.overlay; + splitView.closePane(); + } + } + + nav.addEventListener("navigating", navigating); + app.addEventListener("activated", activated, false); + app.start(); +})(); + +window.onerror = function (E) { + debugger; +} \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/js/sample-configuration.js b/Samples/Notifications/js/Notifications/js/sample-configuration.js new file mode 100644 index 0000000000..4b9641a8e4 --- /dev/null +++ b/Samples/Notifications/js/Notifications/js/sample-configuration.js @@ -0,0 +1,24 @@ +//// Copyright (c) Microsoft Corporation. All rights reserved + +(function () { + "use strict"; + + var sampleTitle = "Notifications JS sample"; + + var scenarios = [ + { url: "/html/scenario1-pinningsecondarytiles.html", title: "Pinning secondary tiles" }, + { url: "/html/scenario2-updatesecondarytile.html", title: "Update secondary tile" }, + { url: "/html/scenario3-primarytilenotifications.html", title: "Primary tile notifications" }, + { url: "/html/scenario4-secondarytilenotifications.html", title: "Secondary tile notifications" }, + { url: "/html/scenario5-expiringtilenotifications.html", title: "Expiring tile notifications" }, + { url: "/html/scenario6-schedulingtilenotifications.html", title: "Scheduling tile notifications" }, + { url: "/html/scenario7-primarytilebadges.html", title: "Primary tile badges" }, + { url: "/html/scenario8-secondarytilebadges.html", title: "Secondary tile badges" }, + { url: "/html/scenario9-unpineverything.html", title: "Unpin everything" }, + ]; + + WinJS.Namespace.define("SdkSample", { + sampleTitle: sampleTitle, + scenarios: new WinJS.Binding.List(scenarios) + }); +})(); \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/js/scenario1-pinningsecondarytiles.js b/Samples/Notifications/js/Notifications/js/scenario1-pinningsecondarytiles.js new file mode 100644 index 0000000000..646531606f --- /dev/null +++ b/Samples/Notifications/js/Notifications/js/scenario1-pinningsecondarytiles.js @@ -0,0 +1,72 @@ +//// Copyright (c) Microsoft Corporation. All rights reserved + +(function () { + "use strict"; + + var SecondaryTile = Windows.UI.StartScreen.SecondaryTile; + var Uri = Windows.Foundation.Uri; + var Colors = Windows.UI.Colors; + + // UI elements on the page + var pinCommand; + var displayNameInput; + var checkBoxSquare71x71Logo; + var checkBoxSquare150x150Logo; + var checkBoxWide310x150Logo; + var checkBoxSquare310x310Logo; + var checkBoxShowNameOnSquare150x150Logo; + var checkBoxShowNameOnWide310x150Logo; + var checkBoxShowNameOnSquare310x310Logo; + + + var page = WinJS.UI.Pages.define("/html/scenario1-pinningsecondarytiles.html", { + ready: function (element, options) { + pinCommand = element.querySelector("#pincommand"); + pinCommand.addEventListener("click", pinTiles); + + displayNameInput = element.querySelector("#displayname"); + displayNameInput.focus(); + + checkBoxSquare71x71Logo = element.querySelector("#checkboxsquare71x71logo"); + checkBoxSquare150x150Logo = element.querySelector("#checkboxsquare150x150logo"); + checkBoxWide310x150Logo = element.querySelector("#checkboxwide310x150logo"); + checkBoxSquare310x310Logo = element.querySelector("#checkboxsquare310x310logo"); + checkBoxShowNameOnSquare150x150Logo = element.querySelector("#checkboxshownameonsquare150x150logo"); + checkBoxShowNameOnWide310x150Logo = element.querySelector("#checkboxshownameonwide310x150logo"); + checkBoxShowNameOnSquare310x310Logo = element.querySelector("#checkboxshownameonsquare310x310logo"); + } + }); + + function pinTiles() { + pinCommand.disabled = true; + + var tile = new SecondaryTile(new Date().getTime()); + tile.arguments = "args"; + tile.displayName = displayNameInput.value; + + if (checkBoxSquare150x150Logo.checked) { + tile.visualElements.square150x150Logo = new Uri("ms-appx:///images/Square150x150Logo.png"); + } + if (checkBoxSquare71x71Logo.checked) { + tile.visualElements.square71x71Logo = new Uri("ms-appx:///images/Square150x150Logo.png"); + } + if (checkBoxWide310x150Logo.checked) { + tile.visualElements.wide310x150Logo = new Uri("ms-appx:///images/Wide310x150Logo.png"); + } + if (checkBoxSquare310x310Logo.checked) { + tile.visualElements.square310x310Logo = new Uri("ms-appx:///images/Square310x310Logo.png"); + } + + tile.visualElements.backgroundColor = Colors.purple; + tile.visualElements.showNameOnSquare150x150Logo = checkBoxShowNameOnSquare150x150Logo.checked; + tile.visualElements.showNameOnSquare310x310Logo = checkBoxShowNameOnSquare310x310Logo.checked; + tile.visualElements.showNameOnWide310x150Logo = checkBoxShowNameOnWide310x150Logo.checked; + + var asyncOp = tile.requestCreateAsync(); + + asyncOp.done(function () { + pinCommand.disabled = false; + }); + } + +})(); \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/js/scenario2-updatesecondarytile.js b/Samples/Notifications/js/Notifications/js/scenario2-updatesecondarytile.js new file mode 100644 index 0000000000..0b3ce15051 --- /dev/null +++ b/Samples/Notifications/js/Notifications/js/scenario2-updatesecondarytile.js @@ -0,0 +1,88 @@ +//// Copyright (c) Microsoft Corporation. All rights reserved + +(function () { + "use strict"; + + var SecondaryTile = Windows.UI.StartScreen.SecondaryTile; + var TileSize = Windows.UI.StartScreen.TileSize; + var Uri = Windows.Foundation.Uri; + var MessageDialog = Windows.UI.Popups.MessageDialog; + var _tileId; + + // UI elements on the page + var pinCommand; + var updateCommand; + var restartCommand; + + var page = WinJS.UI.Pages.define("/html/scenario2-updatesecondarytile.html", { + ready: function (element, options) { + + pinCommand = element.querySelector("#pincommand"); + pinCommand.addEventListener("click", pinTile); + pinCommand.disabled = false; + + updateCommand = element.querySelector("#updatecommand"); + updateCommand.addEventListener("click", updateTile); + updateCommand.disabled = true; + + restartCommand = element.querySelector("#restartcommand"); + restartCommand.addEventListener("click", restartScenario); + } + }); + + function pinTile() { + + pinCommand.disabled = true; + + // Generate a unique tile ID for the purposes of the sample + _tileId = new Date().getTime().toString(); + + // Initialize and pin a new secondary tile that we will later update + var tile = new SecondaryTile(_tileId, "Original", "args", new Uri("ms-appx:///images/cancel.png"), TileSize.default); + tile.visualElements.square71x71Logo = new Uri("ms-appx:///images/cancel.png"); + tile.visualElements.wide310x150Logo = new Uri("ms-appx:///images/cancel.png"); + tile.visualElements.square310x310Logo = new Uri("ms-appx:///images/cancel.png"); + tile.visualElements.showNameOnSquare150x150Logo = true; + tile.visualElements.showNameOnSquare310x310Logo = true; + tile.visualElements.showNameOnWide310x150Logo = true; + + tile.requestCreateAsync().then(function complete() { + // unlock the rest of the scenario + updateCommand.disabled = false; + }); + } + + function updateTile() { + updateCommand.disabled = true; + + // Grab the existing tile + SecondaryTile.findAllAsync().then(function complete(tiles) { + + var tile = tiles.find(function (tile) { + return tile.tileId === _tileId; + }); + + if (!tile) { + new MessageDialog("The secondary tile that was previously pinned could not be found. Has it been removed from Start?", "Error").showAsync(); + } else { + + // Change its name and logo + tile.displayName = "Updated"; + tile.visualElements.square150x150Logo = new Uri("ms-appx:///images/check.png"); + tile.visualElements.square71x71Logo = new Uri("ms-appx:///images/check.png"); + tile.visualElements.square310x310Logo = new Uri("ms-appx:///images/check.png"); + tile.visualElements.wide310x150Logo = new Uri("ms-appx:///images/check.png"); + + // And request its properties to be updated + tile.updateAsync(); + } + + }); + } + + function restartScenario() { + pinCommand.disabled = false; + updateCommand.disabled = true; + } + +})(); \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/js/scenario3-primarytilenotifications.js b/Samples/Notifications/js/Notifications/js/scenario3-primarytilenotifications.js new file mode 100644 index 0000000000..c195d47d73 --- /dev/null +++ b/Samples/Notifications/js/Notifications/js/scenario3-primarytilenotifications.js @@ -0,0 +1,66 @@ +//// Copyright (c) Microsoft Corporation. All rights reserved + +(function () { + "use strict"; + + var TileNotification = Windows.UI.Notifications.TileNotification; + var TileUpdateManager = Windows.UI.Notifications.TileUpdateManager; + var Tiles = NotificationsExtensions.Tiles; + + // UI elements on the page + var sendCommand; + var clearCommand; + + var page = WinJS.UI.Pages.define("/html/scenario3-primarytilenotifications.html", { + ready: function (element, options) { + + sendCommand = element.querySelector("#sendcommand"); + sendCommand.addEventListener("click", sendNotification); + sendCommand.disabled = false; + + clearCommand = element.querySelector("#clearcommand"); + clearCommand.addEventListener("click", clearNotification); + + } + }); + + function sendNotification() { + + var nowTimeString = new Date().toLocaleString(); + + var textConfigs = [ + { text: "New primary tile notification", hintWrap: true }, + { text: nowTimeString, hintWrap: true, hintStyle: NotificationsExtensions.AdaptiveTextStyle.captionSubtle } + ]; + + // Build and append content from textConfigs, line by line. + var adaptiveContent = new Tiles.TileBindingContentAdaptive(); + textConfigs.forEach(function (lineConfig) { + var lineOfText = new NotificationsExtensions.AdaptiveText(); + for (var key in lineConfig) { + lineOfText[key] = lineConfig[key]; + } + adaptiveContent.children.push(lineOfText); + }); + + // Specify templates and send Notification. + var tileContent = new Tiles.TileContent(); + tileContent.visual = new Tiles.TileVisual(); + tileContent.visual.branding = Tiles.TileBranding.nameAndLogo; + tileContent.visual.tileMedium = new Tiles.TileBinding(); + tileContent.visual.tileMedium.content = adaptiveContent; + tileContent.visual.tileWide = new Tiles.TileBinding(); + tileContent.visual.tileWide.content = adaptiveContent; + tileContent.visual.tileLarge = new Tiles.TileBinding(); + tileContent.visual.tileLarge.content = adaptiveContent; + + var doc = tileContent.getXml(); + var notification = new TileNotification(doc); + TileUpdateManager.createTileUpdaterForApplication().update(notification); + } + + function clearNotification() { + TileUpdateManager.createTileUpdaterForApplication().clear(); + } + +})(); \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/js/scenario4-secondarytilenotifications.js b/Samples/Notifications/js/Notifications/js/scenario4-secondarytilenotifications.js new file mode 100644 index 0000000000..9aab6ac578 --- /dev/null +++ b/Samples/Notifications/js/Notifications/js/scenario4-secondarytilenotifications.js @@ -0,0 +1,87 @@ +//// Copyright (c) Microsoft Corporation. All rights reserved + +(function () { + "use strict"; + + var SecondaryTile = Windows.UI.StartScreen.SecondaryTile; + var TileSize = Windows.UI.StartScreen.TileSize; + var Uri = Windows.Foundation.Uri; + + var TileNotification = Windows.UI.Notifications.TileNotification; + var TileUpdateManager = Windows.UI.Notifications.TileUpdateManager; + var Tiles = NotificationsExtensions.Tiles; + + var _tileId; + + // UI elements on the page + var sendCommand; + var pinCommand; + + + var page = WinJS.UI.Pages.define("/html/scenario4-secondarytilenotifications.html", { + ready: function (element, options) { + + pinCommand = element.querySelector("#pincommand"); + pinCommand.addEventListener("click", pinTile); + + sendCommand = element.querySelector("#sendcommand"); + sendCommand.addEventListener("click", sendNotification); + } + }); + + function pinTile() { + + pinCommand.disabled = true; + + // Generate a unique tile ID for the purposes of the sample + _tileId = new Date().getTime().toString(); + + // Initialize and pin a new secondary tile. + var tile = new SecondaryTile(_tileId, "Secondary notifications", "args", new Uri("ms-appx:///images/Square150x150Logo.png"), TileSize.default); + tile.visualElements.wide310x150Logo = new Uri("ms-appx:///images/Wide310x150Logo.png"); + tile.visualElements.square310x310Logo = new Uri("ms-appx:///images/Square310x310Logo.png"); + tile.visualElements.showNameOnSquare150x150Logo = true; + tile.visualElements.showNameOnSquare310x310Logo = true; + tile.visualElements.showNameOnWide310x150Logo = true; + + tile.requestCreateAsync().then(function complete() { + pinCommand.disabled = false; + }); + } + + function sendNotification() { + + var nowTimeString = new Date().toLocaleString(); + + var textConfigs = [ + { text: "New secondary tile notification", hintWrap: true }, + { text: nowTimeString, hintWrap: true, hintStyle: NotificationsExtensions.AdaptiveTextStyle.captionSubtle } + ]; + + // Build and append content from textConfigs, line by line. + var adaptiveContent = new Tiles.TileBindingContentAdaptive(); + textConfigs.forEach(function (lineConfig) { + var lineOfText = new NotificationsExtensions.AdaptiveText(); + for (var key in lineConfig) { + lineOfText[key] = lineConfig[key]; + } + adaptiveContent.children.push(lineOfText); + }); + + // Specify templates and send Notification. + var tileContent = new Tiles.TileContent(); + tileContent.visual = new Tiles.TileVisual(); + tileContent.visual.branding = Tiles.TileBranding.nameAndLogo; + tileContent.visual.tileMedium = new Tiles.TileBinding(); + tileContent.visual.tileMedium.content = adaptiveContent; + tileContent.visual.tileWide = new Tiles.TileBinding(); + tileContent.visual.tileWide.content = adaptiveContent; + tileContent.visual.tileLarge = new Tiles.TileBinding(); + tileContent.visual.tileLarge.content = adaptiveContent; + + var doc = tileContent.getXml(); + var notification = new TileNotification(doc); + TileUpdateManager.createTileUpdaterForSecondaryTile(_tileId).update(notification); + } + +})(); \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/js/scenario5-expiringtilenotifications.js b/Samples/Notifications/js/Notifications/js/scenario5-expiringtilenotifications.js new file mode 100644 index 0000000000..515f776c8f --- /dev/null +++ b/Samples/Notifications/js/Notifications/js/scenario5-expiringtilenotifications.js @@ -0,0 +1,83 @@ +//// Copyright (c) Microsoft Corporation. All rights reserved + +(function () { + "use strict"; + + var SecondaryTile = Windows.UI.StartScreen.SecondaryTile; + var TileSize = Windows.UI.StartScreen.TileSize; + var Uri = Windows.Foundation.Uri; + + var TileNotification = Windows.UI.Notifications.TileNotification; + var TileUpdateManager = Windows.UI.Notifications.TileUpdateManager; + var Tiles = NotificationsExtensions.Tiles; + + var _tileId; + + // UI elements on the page + var pinCommand; + var sendCommand; + + var page = WinJS.UI.Pages.define("/html/scenario5-expiringtilenotifications.html", { + ready: function (element, options) { + + pinCommand = element.querySelector("#pincommand"); + pinCommand.addEventListener("click", pinTile); + + sendCommand = element.querySelector("#sendcommand"); + sendCommand.addEventListener("click", sendNotification); + } + }); + + function pinTile() { + + pinCommand.disabled = true; + + // Generate a unique tile ID for the purposes of the sample + _tileId = new Date().getTime().toString(); + + // Initialize and pin a new secondary tile. + var tile = new SecondaryTile(_tileId, "Expiring Notification", "args", new Uri("ms-appx:///images/Square150x150Logo.png"), TileSize.default); + tile.visualElements.square71x71Logo = new Uri("ms-appx:///images/Small.png"); + tile.visualElements.wide310x150Logo = new Uri("ms-appx:///images/WideLogo.png"); + tile.visualElements.square310x310Logo = new Uri("ms-appx:///images/LargeLogo.png"); + tile.visualElements.showNameOnSquare150x150Logo = true; + tile.visualElements.showNameOnSquare310x310Logo = true; + tile.visualElements.showNameOnWide310x150Logo = true; + + tile.requestCreateAsync().then(function complete() { + pinCommand.disabled = false; + }); + } + + function sendNotification() { + + // Set expiration time to 20 seconds. + var expirationTime = new Date(); + expirationTime.setSeconds(expirationTime.getSeconds() + 20); + var expirationTimeString = expirationTime.toLocaleTimeString(); + + // Build TileText + var lineOfText = new NotificationsExtensions.AdaptiveText(); + lineOfText.text = "This notification will expire at " + expirationTimeString; + lineOfText.hintWrap = true; + var adaptiveContent = new Tiles.TileBindingContentAdaptive(); + adaptiveContent.children.push(lineOfText); + + // Specify templates and send Notification. + var tileContent = new Tiles.TileContent(); + tileContent.visual = new Tiles.TileVisual(); + tileContent.visual.branding = Tiles.TileBranding.nameAndLogo; + tileContent.visual.tileMedium = new Tiles.TileBinding(); + tileContent.visual.tileMedium.content = adaptiveContent; + tileContent.visual.tileWide = new Tiles.TileBinding(); + tileContent.visual.tileWide.content = adaptiveContent; + tileContent.visual.tileLarge = new Tiles.TileBinding(); + tileContent.visual.tileLarge.content = adaptiveContent; + + var doc = tileContent.getXml(); + var notification = new TileNotification(doc); + notification.expirationTime = expirationTime; + TileUpdateManager.createTileUpdaterForSecondaryTile(_tileId).update(notification); + } + +})(); \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/js/scenario6-schedulingtilenotifications.js b/Samples/Notifications/js/Notifications/js/scenario6-schedulingtilenotifications.js new file mode 100644 index 0000000000..6de2565f08 --- /dev/null +++ b/Samples/Notifications/js/Notifications/js/scenario6-schedulingtilenotifications.js @@ -0,0 +1,113 @@ +//// Copyright (c) Microsoft Corporation. All rights reserved + +(function () { + "use strict"; + + var SecondaryTile = Windows.UI.StartScreen.SecondaryTile; + var TileSize = Windows.UI.StartScreen.TileSize; + var Uri = Windows.Foundation.Uri; + + var TileNotification = Windows.UI.Notifications.TileNotification; + var TileUpdateManager = Windows.UI.Notifications.TileUpdateManager; + var Tiles = NotificationsExtensions.Tiles; + + var _tileId; + + // UI elements on the page + var pinCommand; + var scheduleCommand; + var restartCommand; + + var page = WinJS.UI.Pages.define("/html/scenario6-schedulingtilenotifications.html", { + ready: function (element, options) { + + pinCommand = element.querySelector("#pincommand"); + pinCommand.addEventListener("click", pinTile); + pinCommand.disabled = false; + + scheduleCommand = element.querySelector("#schedulecommand"); + scheduleCommand.addEventListener("click", scheduleNotifications); + scheduleCommand.disabled = true; + + restartCommand = element.querySelector("#restartcommand"); + restartCommand.addEventListener("click", restartScenario); + } + }); + + function pinTile() { + + pinCommand.disabled = true; + + // Generate a unique tile ID for the purposes of the sample + _tileId = new Date().getTime().toString(); + + // Initialize and pin a new secondary tile that we will later update + var tile = new SecondaryTile(_tileId, "Scheduling Notifications", "args", new Uri("ms-appx:///images/Square150x150Logo.png"), TileSize.default); + tile.visualElements.wide310x150Logo = new Uri("ms-appx:///images/Wide310x150Logo.png"); + tile.visualElements.square310x310Logo = new Uri("ms-appx:///images/Square310x310Logo.png"); + tile.visualElements.showNameOnSquare150x150Logo = true; + tile.visualElements.showNameOnSquare310x310Logo = true; + tile.visualElements.showNameOnWide310x150Logo = true; + + tile.requestCreateAsync().then(function complete() { + // unlock the rest of the scenario + scheduleCommand.disabled = false; + }); + } + + // Schedule a single notification. + function scheduleNotification(text, dueTime) { + // Build TileText + var lineOfText = new NotificationsExtensions.AdaptiveText(); + lineOfText.text = text; + lineOfText.hintWrap = true; + var adaptiveContent = new Tiles.TileBindingContentAdaptive(); + adaptiveContent.children.push(lineOfText); + + // Specify templates and send Notification. + var tileContent = new Tiles.TileContent(); + tileContent.visual = new Tiles.TileVisual(); + tileContent.visual.branding = Tiles.TileBranding.nameAndLogo; + tileContent.visual.tileMedium = new Tiles.TileBinding(); + tileContent.visual.tileMedium.content = adaptiveContent; + tileContent.visual.tileWide = new Tiles.TileBinding(); + tileContent.visual.tileWide.content = adaptiveContent; + tileContent.visual.tileLarge = new Tiles.TileBinding(); + tileContent.visual.tileLarge.content = adaptiveContent; + + var doc = tileContent.getXml(); + + /// Create the notification object. + var futureNotification = new Windows.UI.Notifications.ScheduledTileNotification(doc, dueTime); + futureNotification.id = dueTime.getTime(); + + // Add to the schedule. + TileUpdateManager.createTileUpdaterForSecondaryTile(_tileId).addToSchedule(futureNotification); + } + + function scheduleNotifications() { + + scheduleCommand.disabled = true; + + // Schedule 4 notifications over 20 seconds. + var dateTime = new Date(); + + dateTime.setSeconds(dateTime.getSeconds() + 1); + scheduleNotification("20 seconds to go...", dateTime); + + dateTime.setSeconds(dateTime.getSeconds() + 10); + scheduleNotification("10 seconds to go..", dateTime); + + dateTime.setSeconds(dateTime.getSeconds() + 5); + scheduleNotification("5 seconds to go.", dateTime); + + dateTime.setSeconds(dateTime.getSeconds() + 5); + scheduleNotification("Done :)", dateTime); + } + + function restartScenario() { + pinCommand.disabled = false; + scheduleCommand.disabled = true; + } + +})(); \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/js/scenario7-primarytilebadges.js b/Samples/Notifications/js/Notifications/js/scenario7-primarytilebadges.js new file mode 100644 index 0000000000..18d72f8aef --- /dev/null +++ b/Samples/Notifications/js/Notifications/js/scenario7-primarytilebadges.js @@ -0,0 +1,82 @@ +//// Copyright (c) Microsoft Corporation. All rights reserved + +(function () { + "use strict"; + + var BadgeUpdateManager = Windows.UI.Notifications.BadgeUpdateManager; + var BadgeNotification = Windows.UI.Notifications.BadgeNotification; + var Badges = NotificationsExtensions.Badges; + var GlyphValue = Badges.GlyphValue; + + var _tileId; + + // UI elements on the page + var pinCommand; + var clearCommand; + var updateNumberCommand; + var numberInput; + var updateGlyphCommand; + var glyphSelect; + var restartCommand; + + var page = WinJS.UI.Pages.define("/html/scenario7-primarytilebadges.html", { + ready: function (element, options) { + + clearCommand = element.querySelector("#clearcommand"); + clearCommand.addEventListener("click", clearBadge, false); + + updateNumberCommand = element.querySelector("#updatenumbercommand"); + updateNumberCommand.addEventListener("click", updateBadgeAsNumber, false); + + numberInput = element.querySelector("#numberinput"); + + updateGlyphCommand = element.querySelector("#updateglyphcommand"); + updateGlyphCommand.addEventListener("click", updateBadgeAsGlyph, false); + + glyphSelect = element.querySelector("#glyphselect"); + Object.keys(GlyphValue).forEach(function (glyphName) { + var option = document.createElement("option"); + option.value = glyphName; + option.innerText = glyphName; + if (GlyphValue[glyphName] === GlyphValue.activity) { + option.selected = true; + } + glyphSelect.appendChild(option); + }); + } + }); + + function clearBadge() { + // Clear the badge from the primary tile. + BadgeUpdateManager.createBadgeUpdaterForApplication().clear(); + } + function updateBadgeAsNumber() { + var num = numberInput.value; + + var badgeXml = new Badges.BadgeNumericNotificationContent(num).getXml(); + + // Create the badge notification + var badge = new BadgeNotification(badgeXml); + + // Create the badge updater for the application. + var badgeUpdater = BadgeUpdateManager.createBadgeUpdaterForApplication(); + + // And update the badge + badgeUpdater.update(badge); + } + function updateBadgeAsGlyph() { + var glyph = GlyphValue[glyphSelect.value]; + + var badgeXml = new Badges.BadgeGlyphNotificationContent(glyph).getXml(); + + // Create the badge notification + var badge = new BadgeNotification(badgeXml); + + // Create the badge updater for our application. + var badgeUpdater = BadgeUpdateManager.createBadgeUpdaterForApplication(); + + // And update the badge + badgeUpdater.update(badge); + } + +})(); \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/js/scenario8-secondarytilebadges.js b/Samples/Notifications/js/Notifications/js/scenario8-secondarytilebadges.js new file mode 100644 index 0000000000..3534b58872 --- /dev/null +++ b/Samples/Notifications/js/Notifications/js/scenario8-secondarytilebadges.js @@ -0,0 +1,133 @@ +//// Copyright (c) Microsoft Corporation. All rights reserved + +(function () { + "use strict"; + + var SecondaryTile = Windows.UI.StartScreen.SecondaryTile; + var TileSize = Windows.UI.StartScreen.TileSize; + var Uri = Windows.Foundation.Uri; + + var BadgeUpdateManager = Windows.UI.Notifications.BadgeUpdateManager; + var BadgeNotification = Windows.UI.Notifications.BadgeNotification; + var Badges = NotificationsExtensions.Badges; + var GlyphValue = Badges.GlyphValue; + + var _tileId; + + // UI elements on the page + var pinCommand; + var clearCommand; + var updateNumberCommand; + var numberInput; + var updateGlyphCommand; + var glyphSelect; + var restartCommand; + + var page = WinJS.UI.Pages.define("/html/scenario8-secondarytilebadges.html", { + ready: function (element, options) { + + pinCommand = element.querySelector("#pincommand"); + pinCommand.addEventListener("click", pinTile, false); + pinCommand.disabled = false; + + clearCommand = element.querySelector("#clearcommand"); + clearCommand.addEventListener("click", clearBadge, false); + clearCommand.disabled = true; + + updateNumberCommand = element.querySelector("#updatenumbercommand"); + updateNumberCommand.addEventListener("click", updateBadgeAsNumber, false); + updateNumberCommand.disabled = true; + + numberInput = element.querySelector("#numberinput"); + numberInput.disabled = true; + + updateGlyphCommand = element.querySelector("#updateglyphcommand"); + updateGlyphCommand.addEventListener("click", updateBadgeAsGlyph, false); + updateGlyphCommand.disabled = true; + + glyphSelect = element.querySelector("#glyphselect"); + Object.keys(GlyphValue).forEach(function (glyphName) { + var option = document.createElement("option"); + option.value = glyphName; + option.innerText = glyphName; + if (GlyphValue[glyphName] === GlyphValue.activity) { + option.selected = true; + } + glyphSelect.appendChild(option); + }); + glyphSelect.disabled = true; + + restartCommand = element.querySelector("#restartcommand"); + restartCommand.addEventListener("click", restartScenario); + } + }); + + function pinTile() { + pinCommand.disabled = true; + + // Generate a unique tile ID for the purposes of the sample + _tileId = new Date().getTime().toString(); + + // Initialize and pin a new secondary tile that we will later update + var tile = new SecondaryTile(_tileId, "Badges", "args", new Uri("ms-appx:///images/Square150x150Logo.png"), TileSize.default); + tile.visualElements.square71x71Logo = new Uri("ms-appx:///images/Small.png"); + tile.visualElements.wide310x150Logo = new Uri("ms-appx:///images/WideLogo.png"); + tile.visualElements.square310x310Logo = new Uri("ms-appx:///images/LargeLogo.png"); + tile.visualElements.backgroundColor = Windows.UI.Colors.blue; + tile.visualElements.showNameOnSquare150x150Logo = true; + tile.visualElements.showNameOnSquare310x310Logo = true; + tile.visualElements.showNameOnWide310x150Logo = true; + + tile.requestCreateAsync().then(function complete() { + // Unlock the rest of the scenario + clearCommand.disabled = false; + updateNumberCommand.disabled = false; + updateGlyphCommand.disabled = false; + numberInput.disabled = false; + glyphSelect.disabled = false; + }); + } + + function clearBadge() { + // Clear the badge from the secondary tile + BadgeUpdateManager.createBadgeUpdaterForSecondaryTile(_tileId).clear(); + } + function updateBadgeAsNumber() { + var num = numberInput.value; + + var badgeXml = new Badges.BadgeNumericNotificationContent(num).getXml(); + + // Create the badge notification + var badge = new BadgeNotification(badgeXml); + + // Create the badge updater for our secondary tile, using our tile ID for the secondary tile + var badgeUpdater = BadgeUpdateManager.createBadgeUpdaterForSecondaryTile(_tileId); + + // And update the badge + badgeUpdater.update(badge); + } + + function updateBadgeAsGlyph() { + var glyph = GlyphValue[glyphSelect.value]; + + var badgeXml = new Badges.BadgeGlyphNotificationContent(glyph).getXml(); + + // Create the badge notification + var badge = new BadgeNotification(badgeXml); + + // Create the badge updater for our secondary tile, using our tile ID for the secondary tile + var badgeUpdater = BadgeUpdateManager.createBadgeUpdaterForSecondaryTile(_tileId); + + // And update the badge + badgeUpdater.update(badge); + } + + function restartScenario() { + pinCommand.disabled = false; + clearCommand.disabled = true; + updateNumberCommand.disabled = true; + updateGlyphCommand.disabled = true; + numberInput.disabled = true; + glyphSelect.disabled = true; + } +})(); \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/js/scenario9-unpineverything.js b/Samples/Notifications/js/Notifications/js/scenario9-unpineverything.js new file mode 100644 index 0000000000..40dd62a52d --- /dev/null +++ b/Samples/Notifications/js/Notifications/js/scenario9-unpineverything.js @@ -0,0 +1,88 @@ +//// Copyright (c) Microsoft Corporation. All rights reserved + +(function () { + "use strict"; + + var SecondaryTile = Windows.UI.StartScreen.SecondaryTile; + + // UI elements on the page + var unpinCommand; + + // UI controls on the page + var secondaryTilesListView; + + var page = WinJS.UI.Pages.define("/html/scenario9-unpineverything.html", { + ready: function (element, options) { + + unpinCommand = element.querySelector("#unpincommand"); + unpinCommand.addEventListener("click", unpinTiles); + + secondaryTilesListView = element.querySelector("#scenariocontrol").winControl; + + unpinCommand.disabled = true; + setListViewDataAsync(secondaryTilesListView).done(function () { + unpinCommand.disabled = false; + }); + } + }); + + function uriToString(uri) { + return uri ? uri.displayUri : "null"; + } + + function setListViewDataAsync(listView) { + return SecondaryTile.findAllAsync().then(function (tiles) { + var data = tiles.map(function(tile) { + + var bgColor = tile.visualElements.backgroundColor; + var bgColorString = "{a: " + bgColor.a + ", b: " + bgColor.b + ", g: " + bgColor.g + ", r: " + bgColor.r + "}"; + + var foregroundTextString = tile.visualElements.foregroundText; + switch (foregroundTextString) { + case Windows.UI.StartScreen.ForegroundText.dark: + foregroundTextString = "dark"; + break; + case Windows.UI.StartScreen.ForegroundText.light: + foregroundTextString = "light"; + } + + return { + displayName: tile.displayName, + tileId: tile.tileId, + arguments: tile.arguments, + visualElements: { + backgroundColor: bgColorString, + foregroundText: foregroundTextString, + showNameOnSquare150x150Logo: tile.visualElements.showNameOnSquare150x150Logo, + showNameOnSquare310x310Logo: tile.visualElements.showNameOnSquare310x310Logo, + showNameOnWide310x150Logo: tile.visualElements.showNameOnWide310x150Logo, + square30x30Logo: uriToString(tile.visualElements.square30x30Logo), + square44x44Logo: uriToString(tile.visualElements.square44x44Logo), + square70x70Logo: uriToString(tile.visualElements.square70x70Logo), + square71x71Logo: uriToString(tile.visualElements.square71x71Logo), + square150x150Logo: uriToString(tile.visualElements.square150x150Logo), + square310x310Logo: uriToString(tile.visualElements.square310x310Logo), + wide310x150Logo: uriToString(tile.visualElements.wide310x150Logo), + } + }; + }); + + listView.itemDataSource = new WinJS.Binding.List(data).dataSource; + }); + } + + function unpinTiles() { + unpinCommand.disabled = true; + + SecondaryTile.findAllAsync().then(function (tiles) { + return WinJS.Promise.join(tiles.map(function (tile) { + return tile.requestDeleteAsync(); + })); + }).then(function () { + return setListViewDataAsync(secondaryTilesListView); + }).done(function () { + unpinCommand.disabled = false; + }); + } + +})(); \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/package.appxmanifest b/Samples/Notifications/js/Notifications/package.appxmanifest new file mode 100644 index 0000000000..b261d6ab99 --- /dev/null +++ b/Samples/Notifications/js/Notifications/package.appxmanifest @@ -0,0 +1,41 @@ + + + + + + Notifications JS Sample + Microsoft Corporation + images\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + diff --git a/Samples/Notifications/js/Notifications/packages.config b/Samples/Notifications/js/Notifications/packages.config new file mode 100644 index 0000000000..3ad1eb847d --- /dev/null +++ b/Samples/Notifications/js/Notifications/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Samples/Notifications/js/Notifications/sample-utils/placeholder.txt b/Samples/Notifications/js/Notifications/sample-utils/placeholder.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Samples/WebView/js/WinRTComponent/WinRTSharedObject.cpp b/Samples/WebView/js/WinRTComponent/WinRTSharedObject.cpp index 0c55f66e0d..05c9c8e6a2 100644 --- a/Samples/WebView/js/WinRTComponent/WinRTSharedObject.cpp +++ b/Samples/WebView/js/WinRTComponent/WinRTSharedObject.cpp @@ -5,27 +5,52 @@ #include using namespace WinRTComponent; -using namespace std; +using namespace Windows::Foundation; +using namespace Windows::System::Threading; WinRTSharedObject::WinRTSharedObject() { } -void WinRTSharedObject::CheckPrimesInRange() +EventRegistrationToken WinRTSharedObject::PrimeFound::add(PrimeFoundHandler^ handler) { - vector numsVector; + // Since the WinRTSharedObject is shared between threads, we capture the context + // at registration time so that the callback is made on the correct thread. + return m_primeFoundAgile += ref new Windows::Foundation::EventHandler( + [handler](Platform::Object^ sender, Platform::Object^ args) + { + handler->Invoke(safe_cast(sender), safe_cast(args)); + }, Platform::CallbackContext::Same); +} - for (int num = startNumber; num <= endNumber; num++) +void WinRTSharedObject::PrimeFound::remove(EventRegistrationToken token) +{ + m_primeFoundAgile -= token; +} + +void WinRTSharedObject::PrimeFound::raise(WinRTSharedObject^ sender, PrimeFoundEventArgs^ args) +{ + m_primeFoundAgile(sender, args); +} + +void WinRTSharedObject::CheckPrimesInRange() +{ + ThreadPool::RunAsync(ref new WorkItemHandler([this](IAsyncAction^ action) { - if (IsPrime(num)) + for (int num = startNumber; num <= endNumber && action->Status != AsyncStatus::Canceled; num++) { - numsVector.push_back(num); - NotifyAppOfPrimes(num); + if (IsPrime(num)) + { + auto args = ref new PrimeFoundEventArgs(num); + PrimeFound(this, args); + // An event handler can set cancel=true to stop the computation. + if (args->Cancel) + { + break; + } + } } - } - - int* numsArray = &numsVector[0]; - //return numsArray; + }), WorkItemPriority::Normal, WorkItemOptions::TimeSliced); } bool WinRTSharedObject::IsPrime(int n) diff --git a/Samples/WebView/js/WinRTComponent/WinRTSharedObject.h b/Samples/WebView/js/WinRTComponent/WinRTSharedObject.h index 276858b6d5..f9ca5465a3 100644 --- a/Samples/WebView/js/WinRTComponent/WinRTSharedObject.h +++ b/Samples/WebView/js/WinRTComponent/WinRTSharedObject.h @@ -4,16 +4,37 @@ namespace WinRTComponent { - - public delegate void NotifyAppHandler(int number); - + [Windows::Foundation::Metadata::AllowForWebAttribute] + public ref class PrimeFoundEventArgs sealed + { + internal: + PrimeFoundEventArgs(int prime) : m_prime(prime) { } + public: + property int Prime { int get() { return m_prime; } }; + property bool Cancel { bool get() { return m_cancel; } + void set(bool value) { m_cancel = value; } } + + private: + const int m_prime; + bool m_cancel = false; + }; + [Windows::Foundation::Metadata::AllowForWebAttribute] public ref class WinRTSharedObject sealed { public: WinRTSharedObject(); - event NotifyAppHandler^ NotifyAppOfPrimes; +#pragma warning(suppress:4462) // We manually marshal this interface. + using PrimeFoundHandler = Windows::Foundation::TypedEventHandler; + + event PrimeFoundHandler^ PrimeFound + { + Windows::Foundation::EventRegistrationToken add(PrimeFoundHandler^ handler); + void remove(Windows::Foundation::EventRegistrationToken token); + internal: + void raise(WinRTSharedObject^ sender, PrimeFoundEventArgs^ args); + } void CheckPrimesInRange(); bool IsPrime(int number); @@ -23,5 +44,7 @@ namespace WinRTComponent private: int startNumber; int endNumber; + + event Windows::Foundation::EventHandler^ m_primeFoundAgile; }; } diff --git a/Samples/WebView/js/css/10_AppWebviewComm.css b/Samples/WebView/js/css/10_AppWebviewComm.css index e460a04e2e..72d7da5f46 100644 --- a/Samples/WebView/js/css/10_AppWebviewComm.css +++ b/Samples/WebView/js/css/10_AppWebviewComm.css @@ -24,6 +24,10 @@ Copyright (c) Microsoft Corporation. All rights reserved visibility: hidden; } +#scenario10_output { + height: 50%; +} + #outputArea { width: 100%; height: 100%; diff --git a/Samples/WebView/js/html/10_AppWebviewComm.html b/Samples/WebView/js/html/10_AppWebviewComm.html index 8fb20ea81a..e351c07f9d 100644 --- a/Samples/WebView/js/html/10_AppWebviewComm.html +++ b/Samples/WebView/js/html/10_AppWebviewComm.html @@ -12,16 +12,20 @@ -
+

Sometimes, webpage loaded inside the webview and vice versa needs to communicate or share some object with each other. To do this, you can implement a winrt object that implements IAgileObject and send it to the webview using AddWebAllowedObject method. A new metadata attribute AllowForWeb should be specified above the class which object will be projected. This provides a security option to filter context which can be exposed to the webpage loaded inside webview.

-

Under the Output heading below, the displayed HTML has been loaded into the WebView control. The Winrt object is a simple prime number caclulator. Enter a valid range below and then tap the "Reload" button. The webview page notifies - the app whenever it finds a new prime number in the range.

+

Under the Output heading below, the displayed HTML has been loaded into the WebView control. The Winrt object is a simple prime number calculator. Enter a valid range below and then tap the "Reload" button. The webview page notifies + the app whenever it finds a new prime number in the range. + The WinRT object will stop calculating when it reaches the end of the range or when the app sets the cancel property in the event handler.

- +
+
-
+
diff --git a/Samples/WebView/js/js/10_AppWebviewComm.js b/Samples/WebView/js/js/10_AppWebviewComm.js index 2aeea38b15..7b6f20ae62 100644 --- a/Samples/WebView/js/js/10_AppWebviewComm.js +++ b/Samples/WebView/js/js/10_AppWebviewComm.js @@ -2,9 +2,16 @@ (function () { "use strict"; + var webview; + var outputArea; + var cancelCheckbox; var page = WinJS.UI.Pages.define("/html/10_AppWebviewComm.html", { ready: function (element, options) { + outputArea = document.getElementById("outputArea"); + webview = document.getElementById("webview"); + cancelCheckbox = document.getElementById("cancelCheckbox"); + // Load the contents of the sample HTML file to be displayed in the text area WinJS.xhr({ url: "ms-appx-web:///html/appwebviewcomm_example.html", responseType: "text" }).done(function (request) { document.getElementById("htmlString").value = request.responseText; @@ -12,7 +19,7 @@ document.getElementById("reloadButton").addEventListener("click", reloadPage, false); - document.getElementById("webview").addEventListener("MSWebViewNavigationStarting", navigationStarting); + webview.addEventListener("MSWebViewNavigationStarting", navigationStarting); // create winrt object, pass it to the webview and load the page reloadPage(); @@ -20,27 +27,29 @@ }); function navigationStarting() { - if (document.getElementById("webview").addWebAllowedObject !== undefined) { - // create the winrt object, pass it to webview. This winrt object can be used inside webview till the next navigation. + if (webview.addWebAllowedObject) { + // Create the winrt object, and pass it to webview. This winrt object can be used inside webview until the next navigation. var winRTSharedObject = new WinRTComponent.WinRTSharedObject(); - winRTSharedObject.onnotifyappofprimes = function (e) { appendOutput("Notification from webview for prime number: " + e.target.toString()); } + winRTSharedObject.addEventListener("primefound", function(e) { + appendOutput("Notification from webview for prime number: " + e.prime); + e.cancel = cancelCheckbox.checked; + }); winRTSharedObject.setStartNumber(document.getElementById("startnumField").value); winRTSharedObject.setEndNumber(document.getElementById("endnumField").value); - document.getElementById("webview").addWebAllowedObject("winRTSharedObject", winRTSharedObject); + webview.addWebAllowedObject("winRTSharedObject", winRTSharedObject); } else { WinJS.log && WinJS.log("addWebAllowedObject method is not supported by WebView", "sdksample", "error"); } } function reloadPage() { - document.getElementById("outputArea").value = ""; - document.getElementById("webview").navigate("ms-appx-web:///html/appwebviewcomm_example.html"); + outputArea.value = ""; + webview.navigate("ms-appx-web:///html/appwebviewcomm_example.html"); } // Appends a line of text to outputArea function appendOutput(message) { - var outputArea = document.getElementById("outputArea"); outputArea.value += message + "\n"; outputArea.scrollTop = outputArea.scrollHeight; } diff --git a/Samples/XamlBind/cpp/OtherBindings.xaml b/Samples/XamlBind/cpp/OtherBindings.xaml index 9c56c1129f..5604aa8381 100644 --- a/Samples/XamlBind/cpp/OtherBindings.xaml +++ b/Samples/XamlBind/cpp/OtherBindings.xaml @@ -75,8 +75,8 @@ - - + + diff --git a/Samples/XamlBind/cs/OtherBindings.xaml b/Samples/XamlBind/cs/OtherBindings.xaml index 7968a2b249..ca8ce3c263 100644 --- a/Samples/XamlBind/cs/OtherBindings.xaml +++ b/Samples/XamlBind/cs/OtherBindings.xaml @@ -78,8 +78,8 @@ - - + + diff --git a/SharedContent/cpp/GameContent/MoveLookController.cpp b/SharedContent/cpp/GameContent/MoveLookController.cpp index 9c02479c2e..0a10250146 100644 --- a/SharedContent/cpp/GameContent/MoveLookController.cpp +++ b/SharedContent/cpp/GameContent/MoveLookController.cpp @@ -658,16 +658,19 @@ void MoveLookController::UpdatePollingDevices() m_gamepadsChanged = false; unsigned int index = 0; - if (Gamepad::Gamepads->Size == 0) + // Capture the list of gamepads so it won't change while we are studying it. + auto gamepads = Gamepad::Gamepads; + + if (gamepads->Size == 0) { m_activeGamepad = nullptr; } // Check if the cached gamepad is still connected. - else if(!Gamepad::Gamepads->IndexOf(m_activeGamepad, &index)) + else if (!gamepads->IndexOf(m_activeGamepad, &index)) { // MoveLookController is intended to handle input for a single player, so it // defaults to the first active gamepad. - m_activeGamepad = Gamepad::Gamepads->GetAt(0); + m_activeGamepad = gamepads->GetAt(0); } } diff --git a/SharedContent/media/Square310x310Logo.png b/SharedContent/media/Square310x310Logo.png new file mode 100644 index 0000000000000000000000000000000000000000..c96f294a472dcfeb1eb7c4fb0b7878a47db256e0 G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