Skip to content

Commit

Permalink
Windows 10 RTM Release - December 2015 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
oldnewthing committed Dec 17, 2015
1 parent 0b2568a commit 215408b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private void UpdateUVCOnNewTrack(MediaPlaybackItem item)
/// <param name="args"></param>
void smtc_PropertyChanged(SystemMediaTransportControls sender, SystemMediaTransportControlsPropertyChangedEventArgs args)
{
// TODO: If soundlevel turns to muted, app can choose to pause the music
// If soundlevel turns to muted, app can choose to pause the music
}

/// <summary>
Expand Down Expand Up @@ -382,9 +382,6 @@ private void SkipToPrevious()
{
smtc.PlaybackStatus = MediaPlaybackStatus.Changing;
playbackList.MovePrevious();

// TODO: Work around playlist bug that doesn't continue playing after a switch; remove later
BackgroundMediaPlayer.Current.Play();
}

/// <summary>
Expand All @@ -394,10 +391,6 @@ private void SkipToNext()
{
smtc.PlaybackStatus = MediaPlaybackStatus.Changing;
playbackList.MoveNext();

// TODO: Work around playlist bug that doesn't continue playing after a switch; remove later
BackgroundMediaPlayer.Current.Play();

}
#endregion

Expand Down Expand Up @@ -477,9 +470,6 @@ void BackgroundMediaPlayer_MessageReceivedFromForeground(object sender, MediaPla
Debug.WriteLine("Skipping to track " + index);
smtc.PlaybackStatus = MediaPlaybackStatus.Changing;
playbackList.MoveTo((uint)index);

// TODO: Work around playlist bug that doesn't continue playing after a switch; remove later
BackgroundMediaPlayer.Current.Play();
return;
}

Expand Down
34 changes: 10 additions & 24 deletions Samples/LockScreenApps/cs/ScenarioInput1.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,40 +16,26 @@

<StackPanel>
<TextBlock Style="{StaticResource DescriptionTextStyle}" TextWrapping="Wrap">
In this scenario, the app will request to be added to the lock screen, remove itself from the lock screen, and
query its current lock screen status.
In this scenario, the app will request that the user add it to the lock screen.
<LineBreak/>
<LineBreak/>
Lock screen apps are apps that can notify users when the users are not using their device. Lock screen apps are
special in that they have permission to run in the background. For example, lock screen apps can run code
periodically on a timer every 15 minutes, maintain a TCP socket in the background, or receive push notifications
from the Windows Push Notification Service (WNS). Lock screen apps have the ability to show updates to the user
Lock screen apps are apps that can notify users when the users are not using their device.
Lock screen apps have the ability to show updates to the user
on the lock screen by updating badge counts and glyphs, showing toast notifications, or by allowing a text-only
version of their Start tile to appear on the lock screen. An app must be granted permission by the user to be a
lock screen app.
version of their Start tile to appear on the lock screen.
<LineBreak/>
<LineBreak/>
There are only 7 lock screen slots and an app may request to fill a single one of these. Of these seven apps, one
may also take the detailed status slot on the lock screen. If the user declines to give your app permission, you
may not prompt again. Apps can query the current state of the setting and may prompt the user a single time to see
if they want to allow the app to appear on their lock screen. Subsequent attempts to prompt the user will result
in returning the app's current status, without showing any UI to the user.
<LineBreak/>
<LineBreak/>
An app must set the appropriate information in the manifest in order to be background capable. In the Visual Studio
An app must set the appropriate information in the manifest in order to appear on the lock screen. In the Visual Studio
manifest editor, under the Lock screen notifications option in the Application UI tab, set the value to either
"Badge" or "Badge and Tile Text". Additionally, apps must specify a background task of type "Control channel",
"Timer", or "Push notification" in the Declarations tab. For more information, see the "Background Tasks" sample.
<LineBreak/>
<LineBreak/>
Users can manually add the app to the lock screen (or remove it) through the Personalize page in PC Settings, or
in the Permissions tab in the app's Settings page. When declared in the manifest as described above, the app will
appear in the list of allowable lock screen apps on the Lock screen tab of the Personalize page.
To appear on the lock screen, the user must add it manually
through the Notifications page in Settings.
When declared in the manifest as described above, the app will
appear in the list of allowable lock screen apps.
</TextBlock>
<StackPanel Orientation="Horizontal" >
<Button x:Name="RequestLockScreenAccess" Content="Request lock screen access"/>
<Button x:Name="RemoveLockScreenAccess" Content="Remove lock screen access"/>
<Button x:Name="QueryLockScreenAccess" Content="Query lock screen access"/>
</StackPanel>
<Button Content="Go to Notification Settings" Click="{x:Bind OpenNotificationSettings}" Margin="0,10,0,0"/>
</StackPanel>
</Page>
63 changes: 2 additions & 61 deletions Samples/LockScreenApps/cs/ScenarioInput1.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

using System;
using System.Threading.Tasks;
using Windows.ApplicationModel.Background;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
Expand All @@ -23,71 +22,13 @@ public sealed partial class ScenarioInput1 : Page
public ScenarioInput1()
{
InitializeComponent();
RequestLockScreenAccess.Click += new RoutedEventHandler(RequestLockScreenAccess_Click);
RemoveLockScreenAccess.Click += new RoutedEventHandler(RemoveLockScreenAccess_Click);
QueryLockScreenAccess.Click += new RoutedEventHandler(QueryLockScreenAccess_Click);
}

private async void RequestLockScreenAccess_Click(object sender, RoutedEventArgs e)
private async void OpenNotificationSettings()
{
BackgroundAccessStatus status = BackgroundAccessStatus.Unspecified;
try
{
status = await BackgroundExecutionManager.RequestAccessAsync();
}
catch (UnauthorizedAccessException)
{
// An access denied exception may be thrown if two requests are issued at the same time
// For this specific sample, that could be if the user double clicks "Request access"
}

switch (status)
{
case BackgroundAccessStatus.AllowedWithAlwaysOnRealTimeConnectivity:
rootPage.NotifyUser("This app is on the lock screen and has access to Always-On Real Time Connectivity.", NotifyType.StatusMessage);
break;
case BackgroundAccessStatus.AllowedMayUseActiveRealTimeConnectivity:
rootPage.NotifyUser("This app is on the lock screen and has access to Active Real Time Connectivity.", NotifyType.StatusMessage);
break;
case BackgroundAccessStatus.Denied:
rootPage.NotifyUser("This app is not on the lock screen.", NotifyType.StatusMessage);
break;
case BackgroundAccessStatus.Unspecified:
rootPage.NotifyUser("The user has not yet taken any action. This is the default setting and the app is not on the lock screen.", NotifyType.StatusMessage);
break;
default:
break;
}
}

private void RemoveLockScreenAccess_Click(object sender, RoutedEventArgs e)
{
BackgroundExecutionManager.RemoveAccess();
rootPage.NotifyUser("This app has been removed from the lock screen.", NotifyType.StatusMessage);
await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings:notifications"));
}

private void QueryLockScreenAccess_Click(object sender, RoutedEventArgs e)
{
switch (BackgroundExecutionManager.GetAccessStatus())
{
case BackgroundAccessStatus.AllowedWithAlwaysOnRealTimeConnectivity:
rootPage.NotifyUser("This app is on the lock screen and has access to Always-On Real Time Connectivity.", NotifyType.StatusMessage);
break;
case BackgroundAccessStatus.AllowedMayUseActiveRealTimeConnectivity:
rootPage.NotifyUser("This app is on the lock screen and has access to Active Real Time Connectivity.", NotifyType.StatusMessage);
break;
case BackgroundAccessStatus.Denied:
rootPage.NotifyUser("This app is not on the lock screen.", NotifyType.StatusMessage);
break;
case BackgroundAccessStatus.Unspecified:
rootPage.NotifyUser("The user has not yet taken any action. This is the default setting and the app is not on the lock screen.", NotifyType.StatusMessage);
break;
default:
break;
}
}


#region Template-Related Code - Do not remove
protected override void OnNavigatedTo(NavigationEventArgs e)
{
Expand Down
2 changes: 1 addition & 1 deletion Samples/LockScreenApps/cs/ScenarioList.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</ListBox.ItemTemplate>
<!-- Add your scenarios here -->
<ListBoxItem x:Name="Scenario1">
<TextBlock Text="1) Adding, removing and querying lock screen capabilities"/>
<TextBlock Text="1) Adding app to the lock screen"/>
</ListBoxItem>
<ListBoxItem x:Name="Scenario2">
<TextBlock Text="2) Sending lock screen badge notifications and tile updates"/>
Expand Down
5 changes: 0 additions & 5 deletions Samples/LockScreenApps/cs/ScenarioOutput1.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,4 @@
d:DesignHeight="300"
d:DesignWidth="400">

<Grid>
<TextBlock Style="{StaticResource DescriptionTextStyle}" TextWrapping="Wrap">
Apps can only prompt the user once, as enforced by the API.
</TextBlock>
</Grid>
</Page>

0 comments on commit 215408b

Please sign in to comment.