2017-05-09 22 views
0

我試圖將現有的Back,Start按鈕使用javascript映射到兩個按鈕中。我在下面試過。如何在Windows Mobile 10中使用C#訪問返回和啓動按鈕?

https://docs.microsoft.com/en-us/uwp/api/windows.phone.ui.input.hardwarebuttons

var hardwareButtons = Windows.Phone.UI.Input.HardwareButtons; 
function backPressed() { 
hardwareButtons.addEventListener("backpressed", function (e) { 
    // Navigate back in your webview. 
    e.handled = true; // Notifies OS that you've handled the back button event. 
    alert("Back pressed"); 
}); 
} 

但這隻有攝像頭,只有後退按鈕。我想分別訪問開始和結束按鈕,或觸發多任務視圖並顯示開始操作。任何人有一個想法?

+0

有一個['SystemNavigationManager'](https://docs.microsoft.com/en-us/uwp/api/windows.ui.core.systemnavigationmanager)類來處理返回按鈕按下。 –

回答

0

不幸的是,微軟並沒有提供它(使用公共API)。如果您不介意使用非官方的API來阻止您的應用出現在商店中,那麼可能有可能 - 至少在以前的Windows Phone版本上 - 但是無法使用官方API來完成。

+0

這對我很好。您能否向我發送您提到的非官方API? –

相關問題