device.DisconnectAudio();
}
+ private static void PopAlertDialog()
+ {
+ Navigator navigator = NUIApplication.GetDefaultWindow().GetDefaultNavigator();
+ navigator?.Pop();
+ }
+
private static void DoPairUnpair(Device device)
{
if (device.BtItem.IsPaired)
{
if (device.BtItem.IsA2dpConnected)
{
- device.BtItem.DisconnectAudio();
+ var cancelButton = new Button()
+ {
+ Text = Resources.IDS_BR_SK_CANCEL,
+ };
+ cancelButton.Clicked += (obj, ev) =>
+ {
+ Log.Info(Program.LogTag, "Disconnect canceled");
+ PopAlertDialog();
+ };
+
+ var disconnectButton = new Button()
+ {
+ Text = Resources.IDS_BT_SK_DISCONNECT,
+ };
+ disconnectButton.Clicked += (obj, ev) =>
+ {
+ device.BtItem.DisconnectAudio();
+ PopAlertDialog();
+ };
+ DialogPage.ShowAlertDialog(Resources.IDS_BT_HEADER_DISCONNECT_DEVICE_ABB, String.Format(Resources.IDS_WMGR_POP_THIS_WILL_END_YOUR_CONNECTION_WITH_PS, device.Name), cancelButton, disconnectButton);
}
else
{
}
else
{
- Log.Error(Program.LogTag, mDeviceState == BtDeviceState.Connecting ? "Connect" : "Disconnect" + "failed. result: " + ev.Result);
+ Log.Error(Program.LogTag, (mDeviceState == BtDeviceState.Connecting ? "Connect" : "Disconnect") + "failed. result: " + ev.Result);
mDeviceState = BtDeviceState.Idle;
BtModel.NotifyDeviceChanged(this);
}
if (mPairedDevice.FindDevice(ev.BtDevice) == null)
{
mPairedDevice.AddDevice(ev.BtDevice);
+ if (ev.BtDevice.IsA2dpSupported)
+ {
+ DeviceController.ConnectA2dp(ev.BtDevice);
+ }
}
-
- if (ev.BtDevice.IsA2dpSupported)
+ else // audio disconnected case
{
- DeviceController.ConnectA2dp(ev.BtDevice);
+ mPairedDevice.UpdateState(ev.BtDevice, "");
}
-
break;
case BtDeviceState.Unpaired:
if (mSearchedDevice.FindDevice(ev.BtDevice) == null)