04 | Handling Files in Windows Store...

Post on 11-Jul-2020

6 views 0 download

transcript

04 | Handling Files in Windows Store Apps

Jerry Nixon | Microsoft Developer Evangelist

Daren May | President & Co-founder, Crank211

Microsoft

Virtual

Academy

File Namespaces

File Namespaces

• Windows.Storage.StorageFolder– Copy, Move, Rename, Delete

• Windows.Storage.StorageFile

• Copy, Move, Rename, Delete

• Windows.Storage.FileIO– Read, Write, Append methods

• Windows.Storage.Pickers– Folder, save/open File, Third Party

Capabilities and Strategies

• AppxManifest Capabilities

• App Storage (readonly)– “ms-appx://folder/file”

• Local Storage

• “ms-appdata://local/folder/file”

• “ms-appdata://roaming/folder/file”

• “ms-appdata://temp/folder/file”

File Namespaces

Read from Isolated Storage

Read Project Files

With a file picker

Without a picker

Microsoft

Virtual

Academy

Process Lightcycle Lifecycle Management

The User

Activates

Your App

splash screen

The User

Activates

Your App

splash screen

Trigger Condition

InternetAvailable,

InternetNotAvailable,

SessionConnected,

SessionDisconnected,

UserNotPresent,

UserPresent

TimeTrigger*

PushNotificationTrigger*

SessionStart*

ControlChannelTrigger*(**)

ServicingComplete

SessionConnected

SessionDisconnected

SmsReceived

TimeZoneChange

UserAway/UserPresent,

LockScreenApplicationAdded/Removed

OnlineIdConnectedStateChangeInternetAvailable

InternetAvailable/InternetNotAvailable

NetworkNotificationChannelReset

NetworkStateChange

MaintenanceTrigger

PushNotificationTrigger** *requires lock permission

**can run in App (not BackgroundHost.exe)

Microsoft

Virtual

Academy

Activating Windows Store Apps

ActivationPrimary

Tile

Secondary

Tile

Toast

Notification

Share

Target

Search

Contract

File

Activation

Protocol

Activation

Resume

File Activation

• AppxManifest Declaration– MIME Type

– Extension (File Type)

– Tool Tip

– Display Name

– Logo

• Reserved Words like: – Com, Exe, Lnk

• Can have command arguments

• Search the Store

Activations

Protocol Activation

• AppxManifest Declaration– Protocol

– Display Name

– Logo

• Reserved Words like: – Ms-windows-store

– InternetShortcut

• Using URL://Data/Data/Data

• Search the Store

Activations

Microsoft

Virtual

Academy

State Management Strategy

1. Resume as the user left it

2. Start fresh if a long period of time has elapsed

3. Save data when suspending (5 seconds)– Save along the way

4. Release exclusive resources

State Management Guidelines

• Comes with some Visual Studio templates

• RegisterFrame(frame), SaveAsync(), RestoreState()

Helpers :: Suspension manager

• Orientation Events– Visual State Changes

• SaveState(suspension), LoadState(suspension)

Helpers :: Layout aware page

State Management

©2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Office, Azure, System Center, Dynamics and other product names are or may be registered trademarks and/or trademarks in

the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because

Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information

provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.