Hi Big Ben's win10 UAP Development Preview version finally out, this update with 8.1 change is not very big, but the original win8.1 and WP8.1UAP of the sub-project form, instead of integration into a project, after a compilation packaged into a appx package, to achieve a seamless cross-platform.
Each platform-specific API becomes the extension API, the following
Below, take the WP unique fallback key for example, look at the use of different platform extension API.
If you create a new WIN10UAP project, run on WP running, you will find that back key unexpectedly he meow is backstage! This is not the job of robbing the home key!
Some of the styles of the page, unexpectedly is the upper left corner of the virtual back key, this perverse behavior of Microsoft you really enough!
Be sure to find back the function of back!!
The extension API is used:
1.ADD References
2. Select Universal App platform–extensions
3. Tick the Windows Mobile Extension SDK
4. Happy to use Windows.Phone.UI.Input.HardwareButtons.BackPressed + = hardwarebuttons_backpressed;
This code in the WIN10 desktop run is crash, because the desktop version does not have this API, so need to use
Windows.Foundation.Metadata.ApiInformation.IsTypePresent ("Windows.Phone.UI.Input.HardwareButtons")
The runtime determines whether there is support for the API.
So, the final code might be:
12345 |
if ( Windows.Foundation.Metadata.ApiInformation.IsTypePresent ( " Windows.Phone.UI.Input.HardwareButtons " { //http:// Www.liubaicai.net/archives/444 windows.phone.ui.input.hardwarebuttons.backpressed-= hardwarebuttons_backpressed;              Code class= "CSharp Plain" >windows.phone.ui.input.hardwarebuttons.backpressed + = hardwarebuttons_backpressed;          |
123456789 |
private
void
HardwareButtons_BackPressed(
object
sender, Windows.Phone.UI.Input.BackPressedEventArgs e)
{ http://www.liubaicai.net/archives/444
e.Handled =
true
;
Frame rootFrame = Window.Current.Content
as Frame;
if
(rootFrame.CanGoBack)
rootFrame.GoBack();
else
Application.Current.Exit();
}
|
So happily realized the back key back function.
Win10 Desktop and Mobile Extensions API to determine if there is an entity back key API