小编sch*_*tom的帖子

动态获取本地化字符串WP8 c#

如何在Windows Phone 8中动态获取本地化文本?我发现,如果我想要一个文本,我可以做到这一点:

AppResources.ERR_VERSION_NOT_SUPPORTED
Run Code Online (Sandbox Code Playgroud)

但我们假设我从服务器获取了我的关键字.我只收回字符串

ERR_VERSION_NOT_SUPPORTED
Run Code Online (Sandbox Code Playgroud)

现在我想从中获取正确的文字AppResources.

我尝试过以下方法:

string methodName = "ERR_VERSION_NOT_SUPPORTED";
AppResources res = new AppResources();
//Get the method information using the method info class
MethodInfo mi = res.GetType().GetMethod(methodName);

//Invoke the method
// (null- no parameter for the method call
// or you can pass the array of parameters...)
string message = (string)mi.Invoke(res, null);
Run Code Online (Sandbox Code Playgroud)

问题是在这个例子中MethodInfomi是null ...

谁有想法?

编辑:

谢谢大家的快速回复.事实上我对c#很新,Properties因为getter和setter语法,我总是混淆.

我AppResources看起来像这样:

/// <summary>
///   A strongly-typed resource class, for looking up localized …
Run Code Online (Sandbox Code Playgroud)

c# windows-phone-8

7
推荐指数
1
解决办法
4452
查看次数

WP8后退按钮后退两步

我试图找出如何在Windows Phone 8 sdk中返回两页.我知道我可以覆盖这个功能:

protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
Run Code Online (Sandbox Code Playgroud)

问题是,我无法理解我怎么能回两页...我有一个类似的应用程序:

显示概览>选择预订>确认预订>预订完成

预订完成后,我想回到概述页面...

有人建议吗?

c# windows-phone windows-phone-8

1
推荐指数
1
解决办法
1983
查看次数

标签 统计

c# ×2

windows-phone-8 ×2

windows-phone ×1