複数の画面解像度をサポートする Windows Phone ゲームをやりたいです。この Microsoft チュートリアルを試しましたが、ResolutionHelper クラスで常にエラー メッセージが表示されます。
チュートリアル: http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj206974(v=vs.105).aspx
エラー メッセージ: The name 'App' does not exist in the current context
なにが問題ですか?
namespace WindowsPhoneGame1
{
public enum Resolutions { WVGA, WXGA, HD720p };
public static class ResolutionHelper
{
private static bool IsWvga
{
get
{
return App.Current.Host.Content.ScaleFactor == 100;
}
}
private static bool IsWxga
{
get
{
return App.Current.Host.Content.ScaleFactor == 160;
}
}
private static bool Is720p
{
get
{
return App.Current.Host.Content.ScaleFactor == 150;
}
}
public static Resolutions CurrentResolution
{
get
{
if (IsWvga) return Resolutions.WVGA;
else if (IsWxga) return Resolutions.WXGA;
else if (Is720p) return Resolutions.HD720p;
else throw new InvalidOperationException("Unknown resolution");
}
}
}
}