Xamarin Forms如何获取设备连接的wi-fi网络的名称

Xamarin Forms How to get the name of the wi-fi network in which the device is connected

有谁知道如何知道设备当前连接的 Wi-Fi 网络的名称?

使用Essentials

var orientation = DeviceDisplay.MainDisplayInfo.Orientation;

if (orientation == Orientation.Landscape) 
{
  MainPage = new Page1();
} else {
  MainPage = new Page2();
}

我的问题的解决方法,目前我是这样解决的:

在 App.cs 中:

public应用() {

            MainPage =new NavigationPage( new HomePage());

    }

在 HomePage.xaml.cs 中:

受保护的覆盖 void OnSizeAllocated(双倍宽度,双倍高度) {

        base.OnSizeAllocated(width, height);

        if(width > height)
        {
            _ = GoToPageAsync();
        }
    }

    private  async Task GoToPageAsync()
    {
        await Navigation.PushAsync(new TestPage());
    }

在TestPage.xaml.cs中:

受保护的覆盖 void OnSizeAllocated(双倍宽度,双倍高度) {

        base.OnSizeAllocated(width, height);

        if (width < height)
        {
            _ = GoToPageAsync();
        }
    }

    private async Task GoToPageAsync()
    {
        await Navigation.PopAsync();
    }

如果有人有更好的想法...