簡體   English   中英

如何從應用程序內部啟動內置應用程序

[英]How to Launch a Built In App from within Application

我想允許用戶從“開始”屏幕上的固定圖塊管理其WiFi設置。 我已經將圖塊設置為正確固定,但是我在應用程序的MainPage OnNavigatedTo事件中對此進行了檢查。 一切正常,除了從輔助磁貼啟動時,您可以在啟動內置WiFi應用之前一秒鍾內看到實際的應用負載。 我使用此功能看到的所有其他應用程序都沒有此問題。 我想避免這種情況,但是我不確定將代碼放置在哪里?

MainPage.xaml.cs中

protected async override void OnNavigatedTo(NavigationEventArgs e)
    {
        if (fromTile == true) //flag to force the app to close if navigating back from Built in App
            App.Current.Terminate();

        //From Pinned Tile
        if (NavigationContext.QueryString.ContainsKey(Constants.Key))
        {
            string _title = null;
            _title = NavigationContext.QueryString[Constants.Key];

            if (_title != null)
            {
                switch (_title)
                {
                    case "Tile_WiFi":
                        await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings-wifi:"));

                    .. do more stuff ..
                }

                NavigationContext.QueryString.Remove(Constants.Key);
                fromTile = true;
            }
        }
    }

編輯*

當將此代碼放置在構造函數中時,我在NavigationContext.QueryString.ContainsKey(Constants.Key)行上得到一個System.AccessViolationException,它表示Attempt to read or write protected memory.

請參考以下鏈接以實現您的要求,

http://abundantcode.com/how-to-launch-the-device-wifi-settings-app-from-the-windows-phone-8-app/

此致Riyaj Ahamed I

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM