X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcec-config-gui%2Factions%2FConnectToDevice.cs;h=8c198f4c60a20f86042aada349c0c0618ca81118;hb=04be3a97ee3b6779909af7d2655f09ec10930a23;hp=128223f94ec01a919b8f11f37b295bc1f300ef8b;hpb=68b94c34ec2f7de6cd5db434e50242f3ebf8f65a;p=deb_libcec.git diff --git a/src/cec-config-gui/actions/ConnectToDevice.cs b/src/cec-config-gui/actions/ConnectToDevice.cs index 128223f..8c198f4 100644 --- a/src/cec-config-gui/actions/ConnectToDevice.cs +++ b/src/cec-config-gui/actions/ConnectToDevice.cs @@ -18,10 +18,26 @@ namespace CecConfigGui.actions //TODO read the com port setting from the configuration CecAdapter[] adapters = Lib.FindAdapters(string.Empty); - if (adapters.Length == 0 || !Lib.Open(adapters[0].ComPort, 10000)) + if (adapters.Length == 0) { - MessageBox.Show("Could not connect to any CEC adapter. Please check your configuration and try again.", "Pulse-Eight USB-CEC Adapter", MessageBoxButtons.OK); - Application.Exit(); + DialogResult result = MessageBox.Show("Could not detect to any CEC adapter. Please check your configuration. Do you want to try again?", "Pulse-Eight USB-CEC Adapter", MessageBoxButtons.YesNo); + if (result == DialogResult.No) + { + SendEvent(UpdateEventType.ExitApplication); + return; + } + else + adapters = Lib.FindAdapters(string.Empty); + } + + while (!Lib.Open(adapters[0].ComPort, 10000)) + { + DialogResult result = MessageBox.Show("Could not connect to any CEC adapter. Please check your configuration. Do you want to try again?", "Pulse-Eight USB-CEC Adapter", MessageBoxButtons.YesNo); + if (result == DialogResult.No) + { + SendEvent(UpdateEventType.ExitApplication); + return; + } } SendEvent(UpdateEventType.ProgressBar, 20);