有人知道如何使用设备当前连接的Wi-Fi网络的名称吗?
答案 0 :(得分:0)
var orientation = DeviceDisplay.MainDisplayInfo.Orientation;
if (orientation == Orientation.Landscape)
{
MainPage = new Page1();
} else {
MainPage = new Page2();
}
答案 1 :(得分:0)
解决我的问题的方法,目前,我是这样解决的:
在App.cs中:
公共应用() {
MainPage =new NavigationPage( new HomePage());
}
在HomePage.xaml.cs中:
受保护的覆盖无效OnSizeAllocated(双倍宽度,双倍高度) {
base.OnSizeAllocated(width, height);
if(width > height)
{
_ = GoToPageAsync();
}
}
private async Task GoToPageAsync()
{
await Navigation.PushAsync(new TestPage());
}
在TestPage.xaml.cs中:
受保护的覆盖无效OnSizeAllocated(双倍宽度,双倍高度) {
base.OnSizeAllocated(width, height);
if (width < height)
{
_ = GoToPageAsync();
}
}
private async Task GoToPageAsync()
{
await Navigation.PopAsync();
}
如果有人有更好的主意...