Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TransportDevice.ConnectAsync() not working on Windows Form application. #28

Open
PongManao opened this issue Dec 7, 2023 · 0 comments

Comments

@PongManao
Copy link

I've tried to follow the codes in project "MyPhone" which is an UWP app to build a Windows Form app for making phone call.
I've stuck in a trouble where TransportDevice.ConnectAsync() always returns 'false', so phone line cannot be initialed.
Can anyone explain or guide me to the correct implementation of Windows Form?

Here are my codes:

protected override async Task<bool> ConnectToServiceAsync()
{
    var accessResult = await TransportDevice.RequestAccessAsync();
    if (accessResult == Windows.Devices.Enumeration.DeviceAccessStatus.Allowed)
    {
        //_logger.LogInformation("PhoneLineTransportDevice access granted");
    }
    else
    {
        //_logger.LogWarning("PhoneLineTransportDevice access denied, reason: {Reason}, contine anyway", accessResult);
    }

    if (!TransportDevice.IsRegistered())
    {
        //_logger.LogInformation("PhoneLineTransportDevice not registered, registering.");
        TransportDevice.RegisterApp();
    }
    //_logger.LogInformation("PhoneLineTransportDevice registered.");

    bool success = await TransportDevice.ConnectAsync();
    if (success)
    {
        //_logger.LogInformation("CallService connected.");
        //_logger.LogInformation("Initiate PhoneLine auto discovery.");
        _taskInitPhoneLine = InitPhoneLine();
    }
    else
    {
        //_taskInitPhoneLine = InitPhoneLine();
    }
    return success;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant