zoukankan      html  css  js  c++  java
  • WindowsPhone8.1和Win10常用的API

    1. APP打开后保持屏幕唤醒,不进入休眠

    在OnNavigatedTo中加:

    DisplayRequest displayRequest = new DisplayRequest();
    displayRequest.RequestActive();

    2. App全屏:

    a. 隐藏Status Bar

    await Windows.UI.ViewManagement.StatusBar.GetForCurrentView().HideAsync();

    b. 隐藏下面虚拟导航键

    Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().SuppressSystemOverlays = true;

    3. 处理Windows Phone的Back键消息

    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
            HardwareButtons.BackPressed += HardwareButtons_BackPressed;         
    }
    
    protected override void OnNavigatedFrom(NavigationEventArgs e)
    {
        if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
            HardwareButtons.BackPressed -= HardwareButtons_BackPressed;
        base.OnNavigatedFrom(e);
    }
    
    private void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
    {
        e.Handled = true;//按Back无反应
      //Application.Current.Exit(); //退出程序 }
  • 相关阅读:
    Python之路Day11
    Python之路Day10
    Python中需要注意的一些小坑
    Python之路Day09
    Python之路Day08
    关于谷歌浏览器安装非官方商城插件
    Python之路Day07
    Python之路Day06
    Python之路Day05
    Python 之路Day04
  • 原文地址:https://www.cnblogs.com/kunkka/p/4952417.html
Copyright © 2011-2022 走看看