Re-imagine Windows 8.1 Store Apps (85), re-imagine apps

Source: Internet
Author: User

Re-imagine Windows 8.1 Store Apps (85), re-imagine apps

[Download source code]


New Features of Windows 8.1 Store Apps (85)-alarm notification (alarm clock) and Tile



Author: webabcd


Introduction
New Features of Windows 8.1 Store Apps notifications

  • Alarm notification (alarm)
  • New Features of Tile



Example
1. Demonstrate the new alarm toast (alarm clock) in win8.1)
AlarmToast. xaml

<Page    x:Class="Windows81.Notification.AlarmToast"    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    xmlns:local="using:Windows81.Notification"    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"    mc:Ignorable="d">    <Grid Background="Transparent">        <StackPanel Margin="120 0 0 0">            <TextBlock Name="lblMsg" FontSize="14.667" Margin="0 10 0 0" />        </StackPanel>    </Grid></Page>

AlarmToast. xaml. cs

/** Demonstrate the new alarm toast (alarm clock) in win8.1 ** for the basics of toast, see: http://www.cnblogs.com/webabcd/archive/2013/06/20/3145356.html * ** Note: * 1. You need to set toast notifications and screen lock notifications in manifest. * 2. You need to set the following settings in Application/Extensions in manifest. * <! -- Declare that this app is an alarm application, it will appear in the "Settings"> "computer and device"> "lock screen application"> "select the application to display reminders" list --> <m2: extension Category = "windows. alarm "/> <! -- To demonstrate Notification/AlarmToast, you need to set a background task as follows --> <Extension Category = "windows. backgroundTasks "EntryPoint =" SampleForAlarmToast "> <BackgroundTasks> <Task Type =" audio "/> <Task Type =" timer "/> </BackgroundTasks> </Extension> * 3, the System can also play audio when it is muted * 4. Do not disturb the Time Limit */using System; using Windows. applicationModel. background; using Windows. UI. xaml; using Windows. UI. xaml. controls; using Windows. UI. xaml. navigation; namespace Windows81.Notification {public sealed partial class AlarmToast: Page {public AlarmToast () {this. initializeComponent (); this. loaded + = AlarmToast_Loaded;} protected async override void OnNavigatedTo (NavigationEventArgs e) {try {// request the permission to become an alarm application to the system. The confirmation dialog box await AlarmApplicationManager is displayed. requestAccessAsync (). asTask (); // obtain the permission of the current application to become an alarm application (AlarmAccessStatus enumeration) // Unspecified-the user has not responded to the application's permission request for setting alerts // AllowedWithWakeupCapability-the user has granted the application the permission to set alerts, and alarms can wake up the computer from the STANDBY state // AllowedWithoutWakeupCapability-the user has granted the application the permission to set alarms, however, the alarm cannot wake up the computer from the STANDBY state // Denied-the user has Denied the application's permission to set the alarm AlarmAccessStatus alarmAccessStatus = AlarmApplicationManager. getAccessStatus (); lblMsg. text = alarmAccessStatus. toString ();} catch (Exception ex) {lblMsg. text = ex. toString () ;}} void AlarmToast_Loaded (object sender, RoutedEventArgs e) {// For details about toast notifications, see: http://www.cnblogs.com/webabcd/archive/2013/06/20/3145356.html String toastXmlString = "<toast duration = \" long \ "> \ n" + "<visual> \ n" + "<binding template = \" ToastText02 \ "> \ n" + "<text id = \" 1 \ "> text1 </text> \ n" + "<text id = \" 2 \ "> text2 </text> \ n" + "</binding> \ n" + "</visual> \ n" + "<commands scenario = \" alarm \ "> \ n" + // besides alarm and incomingCall "<command id = \" snooze \ "/> \ n" + // snooze indicates that the "pause" button is displayed in the toast of the alarm (take a nap) "<command id = \" dismiss \ "/> \ n" + // dismiss indicates that the "cancel" button "</commands> \ n" +/is displayed in the toast of the alarm // alert tone: notification. default, Notification. IM, Notification. mail, Notification. reminder, Notification. SMS, Notification. looping. alarm, Notification. looping. alarm2, Notification. looping. alarm3, Notification. looping. alarm4, Notification. looping. alarm5, Notification. looping. alarm6, Notification. looping. alarm7, Notification. looping. alarm8, Notification. looping. alarm9. looping. alarm10, Notification. looping. call, Notification. looping. call2, Notification. looping. call3, Notification. looping. call4, Notification. looping. call5, Notification. looping. call6, Notification. looping. call7, Notification. looping. call8, Notification. looping. call9, Notification. looping. call10 "<audio src = \" Notification. looping. alarm2 \ "loop = \" true \ "/> \ n" + "</toast> \ n"; var toastDOM = new Windows. data. xml. dom. xmlDocument (); toastDOM. loadXml (toastXmlString); var toastNotifier = Windows. UI. communications. toasticationicationmanager. createToastNotifier (); // when the toast prompt appears, if you click the "pause" button, the toast will continue to pop up after the time specified by the 3rd parameters, in this example, 120 seconds var customAlarmScheduledToast = new Windows. UI. communications. scheduledToastNotification (toastDOM, DateTime. now. addSeconds (5), TimeSpan. fromSeconds (120), 0); toastNotifier. addToSchedule (customAlarmScheduledToast );}}}


2. Add tile templates in win8.1 to 75
Tile. xaml

<Page x: Class = "Windows81.Notification. Tile" xmlns =" http://schemas.microsoft.com/winfx/2006/xaml /Presentation "xmlns: x =" http://schemas.microsoft.com/winfx/2006/xaml "Xmlns: local =" using: Windows81.Notification "xmlns: d =" http://schemas.microsoft.com/expression/blend/2008 "Xmlns: mc =" http://schemas.openxmlformats.org/markup-compatibility/2006 "Mc: Ignorable =" d "> <Grid Background =" Transparent "> <Grid. resources> <Style x: Key = "ItemTitleStyle" TargetType = "TextBlock"> <Setter Property = "FontSize" Value = "14.667"/> </Style> <ItemsPanelTemplate x: key = "Courier"> <WrapGrid MaximumRowsOrColumns = "3" VerticalChildrenAlignment = "Top" placement = "Left"/> </ItemsPanelTemplate> <Style x: Key = "StoreFrontTileStyle" T ArgetType = "GridViewItem"> <Setter Property = "FontFamily" Value = "Segoe UI"/> <Setter Property = "Height" Value = "310"/> <Setter Property =" width "Value =" 310 "/> <Setter Property =" Padding "Value =" 0 "/> <Setter Property =" Margin "Value =" 5 "/> <Setter Property = "HorizontalContentAlignment" Value = "Left"/> <Setter Property = "VerticalContentAlignment" Value = "Top"/> <Setter Property = "BorderThickness" Value = "0 "/> <Setter Property =" TabNavigation "Value =" Local "/> </Style> <DataTemplate x: key = "StoreFrontTileTemplate"> <Grid layout = "Left" Background = "Transparent"> <StackPanel Orientation = "Vertical"> <TextBlock TextWrapping = "Wrap" verticalignment = "Center" Text "= "{Binding FileName}" HorizontalAlignment = "Left"/> <Image Source = "{Binding Path}" Stretch = "None" verticalignment = "Center" Horizonta LAlignment = "Left" Margin = ","/> </StackPanel> </Grid> </DataTemplate> </Grid. Resources> <! -- Display 75 different Tile templates --> <GridView x: name = "gridView" Margin = "120 0 0 0" ItemTemplate = "{StaticResource StoreFrontTileTemplate}" ItemContainerStyle = "{StaticResource StoreFrontTileStyle}" ItemsPanel = "{StaticResource layout}" BorderBrush =" lightGray "verticalignment =" Top "ScrollViewer. verticalScrollBarVisibility = "Auto" ScrollViewer. horizontalScrollBarVisibility = "Auto" SelectionMode = "None"/> </Grid> </Page>

Tile. xaml. cs

/** Add the tile template in win8.1 to 75. ** for more information about tile, see: http://www.cnblogs.com/webabcd/archive/2013/06/24/3151864.html * ** New Features of tile in win 8.1 are as follows: * 1. tile is divided into four types: Small = square70cross, medium = Square150x150, rectangle = Wide310x150, large = Square310x310 * 2. You can specify the default tile type after app installation in manifest * 3. When the tile template is used, its naming rules also change, see icationicationsextensions project (for example, TileSquareImage in win8 is changed to TileSquare150x150Image in win8.1) * 4. tile BASICS (created through icationicationsextensions) see: http://www.cnblogs.com/webabcd/archive/2013/06/24/3151864.html * 5. For tile BASICS (by manually constructing xml), see: http://www.cnblogs.com/webabcd/archive/2013/06/17/3139740.html * 6. If you want to support Square310x310, you must support Wide310x150 * 7. We recommend that you provide corresponding resources for the scaling ratio 0.8x, 1x, 1.4x, and 1.8x, to achieve better display * 8. tile notification queues, except TileUpdater. in addition to enablenotifqueue (), tile queue: TileUpdater can be enabled only on the specified tile. enableNotificationQueueForSquare150x150 (), TileUpdater. enableNotificationQueueForSquare310x310 (), TileUpdater. enableNotificationQueueForWide310x150 () * 9. Added SecondaryTile. phoneticName: Specifies the pinyin name of SecondaryTile. The system sorts the UI x 10 accordingly. To support both win8 and win8.1, the fallback attribute is added, use this method as follows (TileSquareImage is used if TileSquareImage is not found, TileWide310x150Image is used if TileWideImage is not found) <tile> <visual version = "2"> <binding template = "TileSquare150x150Image" fallback = "TileSquareImage" branding = "None"> <image id = "1" src = "Assets /Images/w6.png "/> </binding> <binding template =" TileWide310x150Image "fallback =" TileWideImage "branding =" None "> <image id =" 1 "src =" Assets /Images/sq5.png "/> </binding> <binding template =" TileSquare310x310Image "branding =" None "> <image id =" 1 "src =" Assets/Images/sq6.png" /> </binding> </visual> </tile> */using System; using System. linq; using Windows. applicationModel; using Windows. UI. xaml. controls; using Windows. UI. xaml. navigation; namespace Windows81.Notification {public sealed partial class Tile: Page {public Tile () {this. initializeComponent ();} protected async override void OnNavigatedTo (NavigationEventArgs e) {// 75 images in the Windows 81/Notification/tiles folder are used to demonstrate the 75 templates var folder = await Package of Tile. current. installedLocation. getFolderAsync (@ "Notification \ tiles"); var files = await folder. getFilesAsync (); var dataSource = from p in files select new {FileName = p. displayName, Path = "ms-appx: // Notification/tiles/" + p. name}; gridView. itemsSource = dataSource ;}}}



OK
[Download source code]


Why can't I automatically upgrade my windows 8 instance from windows store to windows 81? The patch has been installed and has not been upgraded and pushed? Why

This is not a piracy issue because Windows 8.1 was just released in the United States and it takes some time to promote it to the app store of the Chinese version. In addition, if your Windows 8 version is a mass authorized version, that is, the Vol version, the update push prompt is not displayed. You can download the Windows 8. 1 previewed iso package: Windows .microsoft.com/zh-cn/windows-8/preview-iso, and copy the product secret.

How does one upgrade Windows Store on Windows 81?

If it is not a trial version, you may not be able to reinstall the system.
Windows Store version!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.