问题
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.
it looks like this:
Record type: windows.com/LaunchApp
Arguments: 'testData'
Platform: WIndowsPhone
App ID: {734sd....}
回答1:
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");
}
}
edit
you can find a sample in this article
来源:https://stackoverflow.com/questions/19682476/how-to-get-the-argument-data-from-a-launchapp-nfc-tag-in-the-application-wp8