ConnectionInfo = $"Connecting to {CurrentDevice?.Name ?? "selected device"}...";
try
{
using var connection = AudioPlaybackConnection.TryCreateFromId(device.DeviceInformation.Id);
await connection.OpenAsync();
ConnectionInfo = $"▷ Connected to {CurrentDevice?.Name ?? "device"}";
}
catch (Exception x)
{
_ = await ShowDialogueAsync($"An error occurred while trying to open a connection:\n\n\n{x}", "Error");
Disconnect();
}
ConnectionInfo = $"Connecting to {CurrentDevice?.Name ?? "selected device"}...";
try
{
using var connection = AudioPlaybackConnection.TryCreateFromId(device.DeviceInformation.Id);
await connection.OpenAsync();
ConnectionInfo = $"▷ Connected to {CurrentDevice?.Name ?? "device"}";
}
catch (Exception x)
{
_ = await ShowDialogueAsync($"An error occurred while trying to open a connection:\n\n\n{x}", "Error");
Disconnect();
}