如何获得“论点"?来自应用程序中的LaunchApp NFC标签的数据. WP8 [英] How to get the "argument" data from a LaunchApp NFC tag in the application. WP8

查看:114
本文介绍了如何获得“论点"?来自应用程序中的LaunchApp NFC标签的数据. WP8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个LaunchApp标签,并且可以正常运行,启动了我的Testapp,但是我的LaunchApp标签还给了我一个参数("TestData").所以这是我的问题,如何在Windows Phone应用程序中轻松获得此参数?例如,我只想将字符串TestData赋予我的应用程序中的文本块.有可能吗?我的launchapp标签是基本的Windows launchApp记录类型.

I created a LaunchApp Tag, and its working fine, launching my Testapp, but with my LaunchApp tag im giving an argument too ("TestData"). So here comes my problem, how can i easily get this argument in my windows phone application? For example i just want to give the string TestData to a textblock in my app. Is it possible somehow ? My launchapp tag is a basic windows launchApp record type.

它看起来像这样:

记录类型:windows.com/LaunchApp

Record type: windows.com/LaunchApp

参数:"testData"

Arguments: 'testData'

平台:Windows Phone

Platform: WIndowsPhone

应用程序ID:{734sd ....}

App ID: {734sd....}

推荐答案

在OnNavigatedTo函数中,您可以访问

In the OnNavigatedTo function you can access NavigationContext.QueryString to get ms_nfp_launchargs value. This value will be your argument

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
            base.OnNavigatedTo(e);
            string parameter = string.Empty;
            if (NavigationContext.QueryString.TryGetValue("ms_nfp_launchargs", out parameter))
            {
                MessageBox.Show("Congratulation\nYou launch application with a NFC tag.\nParamaters : "+ parameter);
                NavigationContext.QueryString.Remove("ms_nfp_launchargs");
             }
}

编辑

您可以在此文章

这篇关于如何获得“论点"?来自应用程序中的LaunchApp NFC标签的数据. WP8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆