我如何检查我的windows手机设备的当前方向?

本文关键字:方向 手机 windows 何检查 检查 我的 | 更新日期: 2023-09-27 18:10:09

我需要知道玩家何时在切换设备的方向。因此,我使用这个事件,但我总是这个错误消息。怎么了?

不重载方法'OrientationChanged'接受0个参数

如何在一夫一妻制Windows Phone 8游戏中使用此事件?

我使用以下代码在Game1.cs:

this.OrientationChanged += OrientationChanged();
void OrientationChanged(object sender, OrientationChangedEventArgs e)
{
    if (e.Orientation == PageOrientation.LandscapeLeft)
    {
    }
}

我的项目:https://www.dropbox.com/s/qa1ty2ydo1hqfwn/MonogameFarseerDemo.rar

我如何检查我的windows手机设备的当前方向?

更改以下行:

this.OrientationChanged += OrientationChanged();
与这个:

this.OrientationChanged += OnOrientationChanged;
void OnOrientationChanged(object sender, OrientationChangedEventArgs e)
{
    if (e.Orientation == PageOrientation.LandscapeLeft)
    {
    }
}