C# 如何检查XForms UWP中运行的辅助工具

C# 如何检查XForms UWP中运行的辅助工具,c#,xamarin.forms,xamarin.uwp,C#,Xamarin.forms,Xamarin.uwp,我需要检查辅助功能工具(讲述人)是否在windows平台上运行。我已经尝试了以下操作 1一个不工作,2一个也是我尝试过的,在获取系统参数时,它总是显示为false。 一, AutomationPeer.ListenerExists(AutomationEvents.AutomationFocusChanged) 二, 我发现这种情况:daserge建议您可以尝试使用AutomationEvents。LiveRegionChanged@CherryBu我已经试过了,但不管用 [DllImport(

我需要检查辅助功能工具(讲述人)是否在windows平台上运行。我已经尝试了以下操作

1一个不工作,2一个也是我尝试过的,在获取系统参数时,它总是显示为false。 一,

AutomationPeer.ListenerExists(AutomationEvents.AutomationFocusChanged)

二,


我发现这种情况:daserge建议您可以尝试使用AutomationEvents。LiveRegionChanged@CherryBu我已经试过了,但不管用
[DllImport("user32", CharSet = CharSet.Auto)]
internal static extern long SystemParametersInfo(long uAction, int lpvParam, ref bool uParam, int fuWinIni);



public static bool IsScreenReaderRunning()
{
    long SPI_GETSCREENREADER = 70L;
    bool bScreenReader = false;
    long retVal;

    retVal = SystemParametersInfo(SPI_GETSCREENREADER, 0, ref bScreenReader, 0);

    //uint iParam = 0;
    //uint iUpdate = 0;
    //bool result = false;
    //bool bReturn = SystemParametersInfo(SPI_GETSCREENREADER, iParam, &bScreenReader, iUpdate);
    return bScreenReader;
}

public static void ScreenReaderOn()
{
    long SPI_GETSCREENREADER = 71L;
    bool bScreenReader = true;
    long retVal;

    retVal = SystemParametersInfo(SPI_GETSCREENREADER, 0, ref bScreenReader, 0);
}

public static void ScreenReaderOff()
{
    long SPI_GETSCREENREADER = 71L;
    bool bScreenReader = false;
    long retVal;

    retVal = SystemParametersInfo(SPI_GETSCREENREADER, 0, ref bScreenReader, 0);
}