From: Lars Op den Kamp Date: Sun, 19 Feb 2012 01:16:05 +0000 (+0100) Subject: cec-config-gui: ask the user whether he wants to try to reconnect when the connection... X-Git-Tag: upstream/2.2.0~1^2~35^2~1 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=f916b582a00b685f0c6b29f8567f703492af2f76;p=deb_libcec.git cec-config-gui: ask the user whether he wants to try to reconnect when the connection failed. --- diff --git a/src/cec-config-gui/actions/ConnectToDevice.cs b/src/cec-config-gui/actions/ConnectToDevice.cs index 128223f..fedc313 100644 --- a/src/cec-config-gui/actions/ConnectToDevice.cs +++ b/src/cec-config-gui/actions/ConnectToDevice.cs @@ -18,10 +18,20 @@ 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) + Application.Exit(); + 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) + Application.Exit(); } SendEvent(UpdateEventType.ProgressBar, 20);