From: Lars Op den Kamp Date: Wed, 15 Feb 2012 19:51:18 +0000 (+0100) Subject: cec-config-gui: open the connection in the background thread X-Git-Tag: upstream/2.2.0~1^2~35^2~35 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=a70f3777b8fc0cbf4bfb1c1546bc1bae94b60f9d;p=deb_libcec.git cec-config-gui: open the connection in the background thread --- diff --git a/src/cec-config-gui/CecConfigGUI.cs b/src/cec-config-gui/CecConfigGUI.cs index 6d5bb47..b2b6c55 100644 --- a/src/cec-config-gui/CecConfigGUI.cs +++ b/src/cec-config-gui/CecConfigGUI.cs @@ -39,14 +39,6 @@ namespace CecConfigGui InitializeComponent(); LoadButtonConfiguration(); - //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)) - { - 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(); - } - ActiveProcess = new ConnectToDevice(ref Lib, Config); ActiveProcess.EventHandler += new EventHandler(ProcessEventHandler); (new Thread(new ThreadStart(ActiveProcess.Run))).Start(); diff --git a/src/cec-config-gui/actions/ConnectToDevice.cs b/src/cec-config-gui/actions/ConnectToDevice.cs index cb84a00..a1e1ef6 100644 --- a/src/cec-config-gui/actions/ConnectToDevice.cs +++ b/src/cec-config-gui/actions/ConnectToDevice.cs @@ -13,6 +13,17 @@ namespace CecConfigGui.actions public override void Process() { + SendEvent(UpdateEventType.StatusText, "Opening connection..."); + SendEvent(UpdateEventType.ProgressBar, 10); + + //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)) + { + 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(); + } + SendEvent(UpdateEventType.StatusText, "Detecting TV vendor..."); SendEvent(UpdateEventType.ProgressBar, 25); SendEvent(UpdateEventType.TVVendorId, (int)Lib.GetDeviceVendorId(CecLogicalAddress.Tv));